Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to calculate the length of a string in Apache Pig?

Tags:

apache-pig

In pig, the substring function has three arguments, I need to get the substring from 4th position to length of the string.

So I specified:

substring(division,4,string.length(division))

It is showing error Could not resolve string.LENGTH using imports:. How to find the length of string in pig?

like image 261
Keerthi Kn Avatar asked Mar 17 '23 22:03

Keerthi Kn


1 Answers

You can use SIZE for that.

SUBSTRING(division,4,SIZE(division))

like image 55
Frederic Avatar answered Apr 06 '23 04:04

Frederic