You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by "zabetak (via GitHub)" <gi...@apache.org> on 2023/03/22 17:48:27 UTC

[GitHub] [hive] zabetak commented on a diff in pull request #4135: HIVE-27157: AssertionError when inferring return type for unix_timestamp function

zabetak commented on code in PR #4135:
URL: https://github.com/apache/hive/pull/4135#discussion_r1145203540


##########
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/reloperators/HiveToUnixTimestampSqlOperator.java:
##########
@@ -18,15 +18,24 @@
 
 package org.apache.hadoop.hive.ql.optimizer.calcite.reloperators;
 
-import org.apache.calcite.sql.fun.SqlAbstractTimeFunction;
-import org.apache.calcite.sql.type.SqlTypeName;
+import org.apache.calcite.sql.SqlFunction;
+import org.apache.calcite.sql.SqlFunctionCategory;
+import org.apache.calcite.sql.SqlKind;
+import org.apache.calcite.sql.type.OperandTypes;
+import org.apache.calcite.sql.type.ReturnTypes;
 
 /**
  * Sql UNIX_TIMESTAMP calcite operator.
  */
-public class HiveToUnixTimestampSqlOperator extends SqlAbstractTimeFunction {
-  public static final HiveToUnixTimestampSqlOperator INSTANCE = new HiveToUnixTimestampSqlOperator();
-  protected HiveToUnixTimestampSqlOperator() {
-    super("UNIX_TIMESTAMP", SqlTypeName.BIGINT);
-  }
+public class HiveToUnixTimestampSqlOperator {
+  public static final SqlFunction INSTANCE =
+      new SqlFunction("UNIX_TIMESTAMP", SqlKind.OTHER_FUNCTION, ReturnTypes.BIGINT, null,
+          OperandTypes.or(OperandTypes.NILADIC,
+              OperandTypes.or(OperandTypes.STRING, OperandTypes.TIMESTAMP, OperandTypes.DATE),
+              OperandTypes.STRING_STRING), SqlFunctionCategory.NUMERIC) {
+        @Override
+        public boolean isDynamicFunction() {
+          return true;
+        }

Review Comment:
   It was the same before and it remains the same now. Ultimately, I would like to get rid one of them completely but it was not trivial to do now (correlation with code in Druid storage handler) thus in order to keep the PR minimal I decided to defer this to HIVE-27162.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org