Repository: hive
Updated Branches:
  refs/heads/master cb2d71055 -> 55e4dd080


HIVE-19619 : Allow comparisons between doubles and bigints (Ashutosh Chauhan 
via Jesus Camacho Rodriguez)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/55e4dd08
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/55e4dd08
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/55e4dd08

Branch: refs/heads/master
Commit: 55e4dd080d7479619a8a58d3b238afe68ee8fe43
Parents: cb2d710
Author: Ashutosh Chauhan <hashut...@apache.org>
Authored: Sun May 20 12:18:47 2018 -0700
Committer: Ashutosh Chauhan <hashut...@apache.org>
Committed: Mon May 21 07:27:50 2018 -0700

----------------------------------------------------------------------
 .../test/resources/testconfiguration.properties  |  1 +
 .../hive/ql/plan/ExprNodeGenericFuncDesc.java    |  2 --
 .../clientnegative/compare_double_bigint.q       |  8 --------
 .../clientnegative/compare_double_bigint_2.q     |  9 ---------
 .../clientpositive/compare_double_bigint_2.q     |  9 +++++++++
 .../clientnegative/compare_double_bigint.q.out   |  1 -
 .../clientnegative/compare_double_bigint_2.q.out |  1 -
 .../llap/compare_double_bigint_2.q.out           | 19 +++++++++++++++++++
 8 files changed, 29 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/55e4dd08/itests/src/test/resources/testconfiguration.properties
----------------------------------------------------------------------
diff --git a/itests/src/test/resources/testconfiguration.properties 
b/itests/src/test/resources/testconfiguration.properties
index b85d71d..f84d1a0 100644
--- a/itests/src/test/resources/testconfiguration.properties
+++ b/itests/src/test/resources/testconfiguration.properties
@@ -486,6 +486,7 @@ minillaplocal.query.files=\
   cbo_subq_not_in.q,\
   column_table_stats.q,\
   column_table_stats_orc.q,\
+  compare_double_bigint_2.q,\
   constprog_dpp.q,\
   current_date_timestamp.q,\
   correlationoptimizer1.q,\

http://git-wip-us.apache.org/repos/asf/hive/blob/55e4dd08/ql/src/java/org/apache/hadoop/hive/ql/plan/ExprNodeGenericFuncDesc.java
----------------------------------------------------------------------
diff --git 
a/ql/src/java/org/apache/hadoop/hive/ql/plan/ExprNodeGenericFuncDesc.java 
b/ql/src/java/org/apache/hadoop/hive/ql/plan/ExprNodeGenericFuncDesc.java
index 31bd290..961eea2 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/plan/ExprNodeGenericFuncDesc.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/plan/ExprNodeGenericFuncDesc.java
@@ -250,8 +250,6 @@ public class ExprNodeGenericFuncDesc extends ExprNodeDesc 
implements
         console.printError("WARNING: Comparing a bigint and a string may 
result in a loss of precision.");
       } else if ((oiTypeInfo0.equals(TypeInfoFactory.doubleTypeInfo) && 
oiTypeInfo1.equals(TypeInfoFactory.longTypeInfo)) ||
           (oiTypeInfo0.equals(TypeInfoFactory.longTypeInfo) && 
oiTypeInfo1.equals(TypeInfoFactory.doubleTypeInfo))) {
-        String error = StrictChecks.checkTypeSafety(conf);
-        if (error != null) throw new UDFArgumentException(error);
         console.printError("WARNING: Comparing a bigint and a double may 
result in a loss of precision.");
       }
     }

http://git-wip-us.apache.org/repos/asf/hive/blob/55e4dd08/ql/src/test/queries/clientnegative/compare_double_bigint.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientnegative/compare_double_bigint.q 
b/ql/src/test/queries/clientnegative/compare_double_bigint.q
deleted file mode 100644
index 435ea9c..0000000
--- a/ql/src/test/queries/clientnegative/compare_double_bigint.q
+++ /dev/null
@@ -1,8 +0,0 @@
---! qt:dataset:src
-set hive.strict.checks.bucketing=false; 
-
-set hive.mapred.mode=strict;
-
--- This should fail until we fix the issue with precision when casting a 
bigint to a double
-
-select * from src where cast(1 as bigint) = cast(1.0 as double) limit 10;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hive/blob/55e4dd08/ql/src/test/queries/clientnegative/compare_double_bigint_2.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientnegative/compare_double_bigint_2.q 
b/ql/src/test/queries/clientnegative/compare_double_bigint_2.q
deleted file mode 100644
index eb4db30..0000000
--- a/ql/src/test/queries/clientnegative/compare_double_bigint_2.q
+++ /dev/null
@@ -1,9 +0,0 @@
---! qt:dataset:src
-set hive.strict.checks.bucketing=false;
-
-reset hive.mapred.mode;
-set hive.strict.checks.type.safety=true;
-
--- This should fail until we fix the issue with precision when casting a 
bigint to a double
-
-select * from src where cast(1 as bigint) = cast(1.0 as double) limit 10;

http://git-wip-us.apache.org/repos/asf/hive/blob/55e4dd08/ql/src/test/queries/clientpositive/compare_double_bigint_2.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/compare_double_bigint_2.q 
b/ql/src/test/queries/clientpositive/compare_double_bigint_2.q
new file mode 100644
index 0000000..eb4db30
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/compare_double_bigint_2.q
@@ -0,0 +1,9 @@
+--! qt:dataset:src
+set hive.strict.checks.bucketing=false;
+
+reset hive.mapred.mode;
+set hive.strict.checks.type.safety=true;
+
+-- This should fail until we fix the issue with precision when casting a 
bigint to a double
+
+select * from src where cast(1 as bigint) = cast(1.0 as double) limit 10;

http://git-wip-us.apache.org/repos/asf/hive/blob/55e4dd08/ql/src/test/results/clientnegative/compare_double_bigint.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/compare_double_bigint.q.out 
b/ql/src/test/results/clientnegative/compare_double_bigint.q.out
deleted file mode 100644
index a577f0e..0000000
--- a/ql/src/test/results/clientnegative/compare_double_bigint.q.out
+++ /dev/null
@@ -1 +0,0 @@
-FAILED: SemanticException Line 0:-1 Wrong arguments '1.0': Unsafe compares 
between different types are disabled for safety reasons. If you know what you 
are doing, please set hive.strict.checks.type.safety to false and make sure 
that hive.mapred.mode is not set to 'strict' to proceed. Note that you may get 
errors or incorrect results if you make a mistake while using some of the 
unsafe features.

http://git-wip-us.apache.org/repos/asf/hive/blob/55e4dd08/ql/src/test/results/clientnegative/compare_double_bigint_2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/compare_double_bigint_2.q.out 
b/ql/src/test/results/clientnegative/compare_double_bigint_2.q.out
deleted file mode 100644
index a577f0e..0000000
--- a/ql/src/test/results/clientnegative/compare_double_bigint_2.q.out
+++ /dev/null
@@ -1 +0,0 @@
-FAILED: SemanticException Line 0:-1 Wrong arguments '1.0': Unsafe compares 
between different types are disabled for safety reasons. If you know what you 
are doing, please set hive.strict.checks.type.safety to false and make sure 
that hive.mapred.mode is not set to 'strict' to proceed. Note that you may get 
errors or incorrect results if you make a mistake while using some of the 
unsafe features.

http://git-wip-us.apache.org/repos/asf/hive/blob/55e4dd08/ql/src/test/results/clientpositive/llap/compare_double_bigint_2.q.out
----------------------------------------------------------------------
diff --git 
a/ql/src/test/results/clientpositive/llap/compare_double_bigint_2.q.out 
b/ql/src/test/results/clientpositive/llap/compare_double_bigint_2.q.out
new file mode 100644
index 0000000..16a8079
--- /dev/null
+++ b/ql/src/test/results/clientpositive/llap/compare_double_bigint_2.q.out
@@ -0,0 +1,19 @@
+WARNING: Comparing a bigint and a double may result in a loss of precision.
+PREHOOK: query: select * from src where cast(1 as bigint) = cast(1.0 as 
double) limit 10
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+#### A masked pattern was here ####
+POSTHOOK: query: select * from src where cast(1 as bigint) = cast(1.0 as 
double) limit 10
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+#### A masked pattern was here ####
+238    val_238
+86     val_86
+311    val_311
+27     val_27
+165    val_165
+409    val_409
+255    val_255
+278    val_278
+98     val_98
+484    val_484

Reply via email to