Attila Jeges has uploaded this change for review. ( 
http://gerrit.cloudera.org:8080/13363


Change subject: IMPALA-7369: part 1: Implement TRUNC, DATE_TRUNC, EXTRACT, 
DATE_PART functions for DATE
......................................................................

IMPALA-7369: part 1: Implement TRUNC, DATE_TRUNC, EXTRACT, DATE_PART functions 
for DATE

These functions are somewhat similar in that each of them takes a DATE
argument and a time unit to work with.

They work identically to the corresponding TIMESTAMP functions. The
only difference is that the DATE functions don't accept time-of-day
units.

TRUNC(DATE d, STRING unit)
Truncates a DATE value to the specified time unit. The 'unit' argument
is case insensitive. This argument string can be one of:
  SYYYY, YYYY, YEAR, SYEAR, YYY, YY, Y: Year.
  Q: Quarter.
  MONTH, MON, MM, RM: Month.
  WW: Same day of the week as the first day of the year.
  W: Same day of the week as the first day of the month.
  DDD, DD, J: Day.
  DAY, DY, D: Starting day (Monday) of the week.

DATE_TRUNC(STRING unit, DATE d)
Truncates a DATE value to the specified precision. The 'unit' argument
is case insensitive. This argument string can be one of: DAY, WEEK,
MONTH, YEAR, DECADE, CENTURY, MILLENNIUM.

EXTRACT(DATE d, STRING unit), EXTRACT(unit FROM DATE d)
Returns one of the numeric date fields from a DATE value. The 'unit'
string can be one of YEAR, QUARTER, MONTH, DAY. This argument value is
case-insensitive.

DATE_PART(STRING unit, DATE date)
Similar to EXTRACT(), with the argument order reversed. Supports the
same date units as EXTRACT().

Change-Id: I843358a45eb5faa2c134994600546fc1d0a797c8
---
M be/src/exprs/expr-test.cc
M be/src/exprs/udf-builtins-ir.cc
M be/src/exprs/udf-builtins.cc
M be/src/exprs/udf-builtins.h
M be/src/runtime/date-test.cc
M be/src/runtime/date-value.cc
M be/src/runtime/date-value.h
M common/function-registry/impala_functions.py
M fe/src/main/java/org/apache/impala/analysis/ExtractFromExpr.java
M fe/src/test/java/org/apache/impala/analysis/AnalyzeExprsTest.java
10 files changed, 1,122 insertions(+), 265 deletions(-)



  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/63/13363/1
--
To view, visit http://gerrit.cloudera.org:8080/13363
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I843358a45eb5faa2c134994600546fc1d0a797c8
Gerrit-Change-Number: 13363
Gerrit-PatchSet: 1
Gerrit-Owner: Attila Jeges <[email protected]>

Reply via email to