Apache Pig - date&time- GetMinute() - Apache Pig

What is Apache Pig GetMinute()?

This function accepts a date-time object as parameter and returns the minute of the current hour of a given date-time object.

Syntax

Here is the syntax of the GetMinute() function.

Example

Assume that there is a file named date.txt in the HDFS directory /pig_data/ as shown below. This file contains the date-of-birth details of a particular person, id, date, and time.
date.txt
And, we have loaded this file into Pig with a relation named date_data as shown below.
Following is an example of the GetMinute() function. The GetMinute() function will retrive the minute of the hour from the given date-time object. Therefore, first of all, let’s generate the date-time objects of all employees using todate() function.
Now, let’s get the minutes from the birth time of each employee using GetMinute() and store it in the relation named getminute_data as shown below.
Now verify the contents of the getminute_data relation using the Dump operator as shown below.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Apache Pig Topics