I want some unique identifier / pen_number / counter to be generated / added to my foreach construct, iterating through the records. Is there a way to do this without writing UDF?
B = foreach A generate a_unique_id, field1, ... etc
How can I implement this "a_unique_id"?
Thanks!
If you use pigs 0.11 or later, then the RANK statement is exactly what you are looking for. For instance.
RANK
DUMP A; (foo,19) (foo,19) (foo,7) (bar,90) (etc.,0) B = RANK A ; DUMP B ; (1,foo,19) (2,foo,19) (3,foo,7) (4,bar,90) (5,etc.,0)
There is no built-in UUID function in the main pig distribution or piggy bank. Unfortunately, I think your only option would be to write UDF.
There is a standard standard way to create UUIDs , and there is Java code that you can use to create your UDF.
Is there a specific reason why you do not want to write UDF?
Source: https://habr.com/ru/post/898531/More articles:Log4j configuration in EAR - javaPartial Matching Optimization of Dictionary Keys - optimizationhttps://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/898528/how-to-bind-existing-dom-elements-to-a-knockoutjs-viewmodel&usg=ALkJrhj6gPNYdFTp6fhN0i64Kgseu7runwFB auth.logout rises after logging in using "server workflow" (OAuth 2.0) - authenticationCheck if user is allowed (HTTP Basic Authentication, Rails 3.0.9) - ruby-on-rails-3Why does Rails preload all its dependencies (gems) at boot time? - performanceSource code is different from source - debuggingNumber of individual records - SQL - sqlHow to get page_id from facebook url - urlCross-domain queries using jQuery - jqueryAll Articles