hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vg...@apache.org
Subject hive git commit: HIVE-19619 : Allow comparisons between doubles and bigints (Ashutosh Chauhan via Jesus Camacho Rodriguez)
Date Tue, 22 May 2018 21:51:38 GMT
Repository: hive
Updated Branches:
  refs/heads/branch-3 2bf4fef22 -> d4747f042


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/d4747f04
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/d4747f04
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/d4747f04

Branch: refs/heads/branch-3
Commit: d4747f0426b2d21f1df4116b59cc5b6122db714a
Parents: 2bf4fef
Author: Ashutosh Chauhan <hashutosh@apache.org>
Authored: Sun May 20 12:18:47 2018 -0700
Committer: Vineet Garg <vgarg@apache.org>
Committed: Tue May 22 14:51:29 2018 -0700

----------------------------------------------------------------------
 .../test/resources/testconfiguration.properties  |  1 +
 .../hive/ql/plan/ExprNodeGenericFuncDesc.java    |  2 --
 .../clientnegative/compare_double_bigint.q       |  7 -------
 .../clientnegative/compare_double_bigint_2.q     |  8 --------
 .../clientpositive/compare_double_bigint_2.q     |  8 ++++++++
 .../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, 28 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/d4747f04/itests/src/test/resources/testconfiguration.properties
----------------------------------------------------------------------
diff --git a/itests/src/test/resources/testconfiguration.properties b/itests/src/test/resources/testconfiguration.properties
index aaa0fb1..1ccb7ef 100644
--- a/itests/src/test/resources/testconfiguration.properties
+++ b/itests/src/test/resources/testconfiguration.properties
@@ -485,6 +485,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/d4747f04/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/d4747f04/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 6580d88..0000000
--- a/ql/src/test/queries/clientnegative/compare_double_bigint.q
+++ /dev/null
@@ -1,7 +0,0 @@
-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/d4747f04/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 bc2d7cd..0000000
--- a/ql/src/test/queries/clientnegative/compare_double_bigint_2.q
+++ /dev/null
@@ -1,8 +0,0 @@
-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/d4747f04/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..bc2d7cd
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/compare_double_bigint_2.q
@@ -0,0 +1,8 @@
+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/d4747f04/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/d4747f04/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/d4747f04/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


Mime
View raw message