Class DateFunctions.NearestDateFunctionWithString

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

public static class DateFunctions.NearestDateFunctionWithString extends Object implements DrillSimpleFunc
This function takes three arguments, an input date string, an input date format string, 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`, 'yyyy-mm-dd', '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

    • NearestDateFunctionWithString

      public NearestDateFunctionWithString()
  • Method Details