Class DateFunctions.NearestDateFunction

java.lang.Object
org.apache.drill.exec.udfs.DateFunctions.NearestDateFunction
All Implemented Interfaces:
DrillFunc, DrillSimpleFunc
Enclosing class:
DateFunctions

public static class DateFunctions.NearestDateFunction extends Object implements DrillSimpleFunc
This function takes two arguments, an input date object, and an interval and returns the previous date that is the first date in that period. This function is intended to be used in time series analysis to aggregate by various units of time. Usage is:

SELECT , COUNT(*) AS event_count FROM ... GROUP BY nearestDate(`date_field`, 'QUARTER')

Currently supports the following time units:

YEAR QUARTER MONTH WEEK_SUNDAY WEEK_MONDAY DAY HOUR HALF_HOUR QUARTER_HOUR MINUTE 30SECOND 15SECOND SECOND

  • Constructor Details

    • NearestDateFunction

      public NearestDateFunction()
  • Method Details