pig tutorial - apache pig tutorial - Apache Pig TRIM() - pig latin - apache pig - pig hadoop
What is TRIM()?
- The TRIM() function accepts a string and returns its copy after removing the unwanted spaces before and after it.
Learn Apache Pig - Apache Pig tutorial - Apache Pig Trim - Apache Pig examples - Apache Pig programs
Syntax:
- Here is the syntax of the TRIM() function .
Example:
- Assume we have some unwanted spaces before and after the names of the employees in the records of the wikitechy_emp_data relation.
- Using the TRIM() function, we can remove these heading and tailing spaces from the names, as shown below.
- The above statement returns the copy of the names by removing the heading and tailing spaces from the names of the employees.
- The result is stored in the relation named trim_data .
- Verify the result of the relation trim_data using the Dump operator as shown below.