You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by kg...@apache.org on 2018/10/19 19:54:32 UTC

hive git commit: HIVE-20477: OptimizedSql is not shown if the expression contains INs (Zoltan Haindrich reviewed by Ashutosh Chauhan)

Repository: hive
Updated Branches:
  refs/heads/master bd3c05d72 -> 14c72c68a


HIVE-20477: OptimizedSql is not shown if the expression contains INs (Zoltan Haindrich reviewed by Ashutosh Chauhan)

Signed-off-by: Zoltan Haindrich <ki...@rxd.hu>


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

Branch: refs/heads/master
Commit: 14c72c68a87260cca11a8ff14060a99e2e3d60a4
Parents: bd3c05d
Author: Zoltan Haindrich <ki...@rxd.hu>
Authored: Fri Oct 19 21:54:11 2018 +0200
Committer: Zoltan Haindrich <ki...@rxd.hu>
Committed: Fri Oct 19 21:54:11 2018 +0200

----------------------------------------------------------------------
 .../optimizer/calcite/reloperators/HiveIn.java  | 27 ++++++++++++++++++++
 1 file changed, 27 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/14c72c68/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/reloperators/HiveIn.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/reloperators/HiveIn.java b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/reloperators/HiveIn.java
index 138332a..2136255 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/reloperators/HiveIn.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/reloperators/HiveIn.java
@@ -17,8 +17,15 @@
  */
 package org.apache.hadoop.hive.ql.optimizer.calcite.reloperators;
 
+import java.util.List;
+
+import org.apache.calcite.sql.SqlCall;
 import org.apache.calcite.sql.SqlKind;
+import org.apache.calcite.sql.SqlNode;
 import org.apache.calcite.sql.SqlSpecialOperator;
+import org.apache.calcite.sql.SqlWriter;
+import org.apache.calcite.sql.SqlWriter.Frame;
+import org.apache.calcite.sql.SqlWriter.FrameTypeEnum;
 import org.apache.calcite.sql.type.InferTypes;
 import org.apache.calcite.sql.type.ReturnTypes;
 
@@ -38,4 +45,24 @@ public class HiveIn extends SqlSpecialOperator {
         null);
   }
 
+  @Override
+  public void unparse(
+      SqlWriter writer,
+      SqlCall call,
+      int leftPrec,
+      int rightPrec) {
+    List<SqlNode> opList = call.getOperandList();
+    assert (opList.size() >= 1);
+
+    SqlNode sqlNode = opList.get(0);
+    sqlNode.unparse(writer, leftPrec, getLeftPrec());
+    writer.sep("IN");
+    Frame frame = writer.startList(FrameTypeEnum.SETOP, "(", ")");
+    for (SqlNode op : opList.subList(1, opList.size())) {
+      writer.sep(",");
+      op.unparse(writer, 0, 0);
+    }
+    writer.endList(frame);
+
+  }
 }