Skip to content

Commit

Permalink
Remove return type override for FROM_DATE_TIME scalar function in Pin…
Browse files Browse the repository at this point in the history
…otOperatorTable
  • Loading branch information
yashmayya committed Sep 25, 2024
1 parent 49896eb commit 9410ad9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,7 @@ public static PinotOperatorTable instance() {
// SqlStdOperatorTable.COALESCE without rewrite
new SqlFunction("COALESCE", SqlKind.COALESCE,
ReturnTypes.LEAST_RESTRICTIVE.andThen(SqlTypeTransforms.LEAST_NULLABLE), null, OperandTypes.SAME_VARIADIC,
SqlFunctionCategory.SYSTEM),

// The scalar function version returns long instead of Timestamp
// TODO: Consider unifying the return type to Timestamp
new PinotSqlFunction("FROM_DATE_TIME", ReturnTypes.TIMESTAMP_NULLABLE, OperandTypes.family(
List.of(SqlTypeFamily.CHARACTER, SqlTypeFamily.CHARACTER, SqlTypeFamily.CHARACTER, SqlTypeFamily.ANY),
i -> i > 1))
SqlFunctionCategory.SYSTEM)
);

private static final List<Pair<SqlOperator, List<String>>> PINOT_OPERATORS_WITH_ALIASES = List.of(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"sql": "EXPLAIN PLAN FOR SELECT FROMDATETIME( '1997-02-01 00:00:00', 'yyyy-MM-dd HH:mm:ss') FROM d",
"output": [
"Execution Plan",
"\nLogicalProject(EXPR$0=[1997-02-01 00:00:00])",
"\nLogicalProject(EXPR$0=[854755200000:BIGINT])",
"\n LogicalTableScan(table=[[default, d]])",
"\n"
]
Expand All @@ -52,10 +52,10 @@
},
{
"description": "Select fromdatetime function in where clause",
"sql": "EXPLAIN PLAN FOR SELECT * FROM d WHERE CAST(ts AS TIMESTAMP) = FROMDATETIME('2019-01-01 00:00:00', 'yyyy-MM-dd HH:mm:ss')",
"sql": "EXPLAIN PLAN FOR SELECT * FROM d WHERE ts = FROMDATETIME('2019-01-01 00:00:00', 'yyyy-MM-dd HH:mm:ss')",
"output": [
"Execution Plan",
"\nLogicalFilter(condition=[=(CAST($6):TIMESTAMP(0) NOT NULL, 2019-01-01 00:00:00)])",
"\nLogicalFilter(condition=[=($6, 1546300800000)])",
"\n LogicalTableScan(table=[[default, d]])",
"\n"
]
Expand Down

0 comments on commit 9410ad9

Please sign in to comment.