[
https://issues.apache.org/jira/browse/HIVE-24157?focusedWorklogId=492499&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-492499
]
ASF GitHub Bot logged work on HIVE-24157:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 29/Sep/20 15:04
Start Date: 29/Sep/20 15:04
Worklog Time Spent: 10m
Work Description: jcamachor commented on a change in pull request #1497:
URL: https://github.com/apache/hive/pull/1497#discussion_r496775522
##########
File path:
ql/src/java/org/apache/hadoop/hive/ql/udf/TimestampCastRestrictorResolver.java
##########
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hive.ql.udf;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
+import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
+import org.apache.hadoop.hive.ql.exec.UDFMethodResolver;
+import org.apache.hadoop.hive.ql.session.SessionState;
+import
org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector.PrimitiveCategory;
+import
org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorUtils;
+import
org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorUtils.PrimitiveGrouping;
+import org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo;
+import org.apache.hadoop.hive.serde2.typeinfo.TypeInfo;
+
+public class TimestampCastRestrictorResolver implements UDFMethodResolver {
Review comment:
Could we add a comment to the class?
##########
File path: ql/src/test/queries/clientnegative/strict_numeric_to_timestamp.q
##########
@@ -0,0 +1,2 @@
+set hive.strict.timestamp.conversion=true;
+select cast(123 as timestamp);
Review comment:
Can we add a couple of negative tests on column ref instead of constant?
And/or with some complex expressions?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 492499)
Time Spent: 0.5h (was: 20m)
> Strict mode to fail on CAST timestamp <-> numeric
> -------------------------------------------------
>
> Key: HIVE-24157
> URL: https://issues.apache.org/jira/browse/HIVE-24157
> Project: Hive
> Issue Type: Improvement
> Components: SQL
> Reporter: Jesus Camacho Rodriguez
> Assignee: Zoltan Haindrich
> Priority: Major
> Labels: pull-request-available
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> There is some interest in enforcing that CAST numeric <\-> timestamp is
> disallowed to avoid confusion among users, e.g., SQL standard does not allow
> numeric <\-> timestamp casting, timestamp type is timezone agnostic, etc.
> We should introduce a strict config for timestamp (similar to others before):
> If the config is true, we shall fail while compiling the query with a
> meaningful message.
> To provide similar behavior, Hive has multiple functions that provide clearer
> semantics for numeric to timestamp conversion (and vice versa):
> https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF#LanguageManualUDF-DateFunctions
--
This message was sent by Atlassian Jira
(v8.3.4#803005)