Formatting Date in Generate Statement

后端 未结 2 2018
遇见更好的自我
遇见更好的自我 2020-12-29 00:09

In Pig, I have a statement which basically appends the date to my generated values.

Data = FOREACH Input GENERATE (CurrentTime()),FLATTEN(group), COUNT(guid)         


        
2条回答
  •  孤独总比滥情好
    2020-12-29 00:54

    If you are using Pig 0.12 or later, you can use ToString(CurrentTime(),'yyyy-MM-dd')

    You can use any datetime type instead of CurrentTime()

    Refer to http://pig.apache.org/docs/r0.12.0/func.html#to-string for date time formats.

提交回复
热议问题