You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by se...@apache.org on 2014/09/05 23:19:59 UTC

svn commit: r1622799 - in /hive/trunk/ql/src: java/org/apache/hadoop/hive/ql/io/orc/ java/org/apache/hadoop/hive/ql/io/sarg/ test/org/apache/hadoop/hive/ql/io/orc/ test/org/apache/hadoop/hive/ql/io/sarg/

Author: sershe
Date: Fri Sep  5 21:19:58 2014
New Revision: 1622799

URL: http://svn.apache.org/r1622799
Log:
HIVE-7208 : move SearchArgument interface into serde package (Sergey Shelukhin, reviewed by Prasanth J)

Modified:
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcInputFormat.java
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcInputFormat.java
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/sarg/SearchArgumentImpl.java
    hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestInputOutputFormat.java
    hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestOrcFile.java
    hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestRecordReaderImpl.java
    hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/io/sarg/TestSearchArgumentImpl.java

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcInputFormat.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcInputFormat.java?rev=1622799&r1=1622798&r2=1622799&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcInputFormat.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcInputFormat.java Fri Sep  5 21:19:58 2014
@@ -51,6 +51,7 @@ import org.apache.hadoop.hive.ql.io.Reco
 import org.apache.hadoop.hive.ql.io.StatsProvidingRecordReader;
 import org.apache.hadoop.hive.ql.io.sarg.PredicateLeaf;
 import org.apache.hadoop.hive.ql.io.sarg.SearchArgument;
+import org.apache.hadoop.hive.ql.io.sarg.SearchArgumentFactory;
 import org.apache.hadoop.hive.ql.log.PerfLogger;
 import org.apache.hadoop.hive.ql.io.sarg.SearchArgument.TruthValue;
 import org.apache.hadoop.hive.ql.plan.TableScanDesc;
@@ -279,10 +280,10 @@ public class OrcInputFormat  implements 
     } else {
       SearchArgument sarg;
       if (serializedPushdown != null) {
-        sarg = SearchArgument.FACTORY.create
+        sarg = SearchArgumentFactory.create
             (Utilities.deserializeExpression(serializedPushdown));
       } else {
-        sarg = SearchArgument.FACTORY.create(sargPushdown);
+        sarg = SearchArgumentFactory.create(sargPushdown);
       }
       LOG.info("ORC pushdown predicate: " + sarg);
       String[] neededColumnNames = columnNamesString.split(",");

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcInputFormat.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcInputFormat.java?rev=1622799&r1=1622798&r2=1622799&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcInputFormat.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcInputFormat.java Fri Sep  5 21:19:58 2014
@@ -31,7 +31,6 @@ import org.apache.hadoop.hive.ql.exec.ve
 import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch;
 import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatchCtx;
 import org.apache.hadoop.hive.ql.io.InputFormatChecker;
-import org.apache.hadoop.hive.ql.io.sarg.SearchArgument;
 import org.apache.hadoop.hive.ql.metadata.HiveException;
 import org.apache.hadoop.io.NullWritable;
 import org.apache.hadoop.mapred.FileInputFormat;

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/sarg/SearchArgumentImpl.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/sarg/SearchArgumentImpl.java?rev=1622799&r1=1622798&r2=1622799&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/sarg/SearchArgumentImpl.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/sarg/SearchArgumentImpl.java Fri Sep  5 21:19:58 2014
@@ -27,6 +27,8 @@ import org.apache.commons.lang.StringUti
 import org.apache.hadoop.hive.common.type.HiveChar;
 import org.apache.hadoop.hive.common.type.HiveDecimal;
 import org.apache.hadoop.hive.common.type.HiveVarchar;
+import org.apache.hadoop.hive.ql.io.sarg.PredicateLeaf;
+import org.apache.hadoop.hive.ql.io.sarg.SearchArgument;
 import org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc;
 import org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc;
 import org.apache.hadoop.hive.ql.plan.ExprNodeDesc;

Modified: hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestInputOutputFormat.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestInputOutputFormat.java?rev=1622799&r1=1622798&r2=1622799&view=diff
==============================================================================
--- hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestInputOutputFormat.java (original)
+++ hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestInputOutputFormat.java Fri Sep  5 21:19:58 2014
@@ -67,6 +67,7 @@ import org.apache.hadoop.hive.ql.io.Comb
 import org.apache.hadoop.hive.ql.io.HiveInputFormat;
 import org.apache.hadoop.hive.ql.io.HiveOutputFormat;
 import org.apache.hadoop.hive.ql.io.InputFormatChecker;
+import org.apache.hadoop.hive.ql.io.sarg.SearchArgumentFactory;
 import org.apache.hadoop.hive.ql.io.sarg.PredicateLeaf;
 import org.apache.hadoop.hive.ql.io.sarg.SearchArgument;
 import org.apache.hadoop.hive.ql.plan.MapWork;
@@ -1586,7 +1587,7 @@ public class TestInputOutputFormat {
     types.add(builder.build());
     types.add(builder.build());
     types.add(builder.build());
-    SearchArgument isNull = SearchArgument.FACTORY.newBuilder()
+    SearchArgument isNull = SearchArgumentFactory.newBuilder()
         .startAnd().isNull("cost").end().build();
     conf.set(OrcInputFormat.SARG_PUSHDOWN, isNull.toKryo());
     conf.set(ColumnProjectionUtils.READ_COLUMN_NAMES_CONF_STR,

Modified: hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestOrcFile.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestOrcFile.java?rev=1622799&r1=1622798&r2=1622799&view=diff
==============================================================================
--- hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestOrcFile.java (original)
+++ hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestOrcFile.java Fri Sep  5 21:19:58 2014
@@ -44,6 +44,7 @@ import org.apache.hadoop.hive.common.typ
 import org.apache.hadoop.hive.conf.HiveConf;
 import org.apache.hadoop.hive.ql.io.orc.OrcFile.Version;
 import org.apache.hadoop.hive.ql.io.sarg.SearchArgument;
+import org.apache.hadoop.hive.ql.io.sarg.SearchArgumentFactory;
 import org.apache.hadoop.hive.serde2.io.ByteWritable;
 import org.apache.hadoop.hive.serde2.io.DoubleWritable;
 import org.apache.hadoop.hive.serde2.io.HiveDecimalWritable;
@@ -1777,7 +1778,7 @@ public class TestOrcFile {
         OrcFile.readerOptions(conf).filesystem(fs));
     assertEquals(3500, reader.getNumberOfRows());
 
-    SearchArgument sarg = SearchArgument.FACTORY.newBuilder()
+    SearchArgument sarg = SearchArgumentFactory.newBuilder()
         .startAnd()
           .startNot()
              .lessThan("int1", 300000)
@@ -1801,7 +1802,7 @@ public class TestOrcFile {
     assertEquals(3500, rows.getRowNumber());
 
     // look through the file with no rows selected
-    sarg = SearchArgument.FACTORY.newBuilder()
+    sarg = SearchArgumentFactory.newBuilder()
         .startAnd()
           .lessThan("int1", 0)
         .end()
@@ -1814,7 +1815,7 @@ public class TestOrcFile {
     assertTrue(!rows.hasNext());
 
     // select first 100 and last 100 rows
-    sarg = SearchArgument.FACTORY.newBuilder()
+    sarg = SearchArgumentFactory.newBuilder()
         .startOr()
           .lessThan("int1", 300 * 100)
           .startNot()

Modified: hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestRecordReaderImpl.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestRecordReaderImpl.java?rev=1622799&r1=1622798&r2=1622799&view=diff
==============================================================================
--- hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestRecordReaderImpl.java (original)
+++ hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestRecordReaderImpl.java Fri Sep  5 21:19:58 2014
@@ -41,7 +41,6 @@ import org.apache.hadoop.hive.ql.io.sarg
 import org.apache.hadoop.hive.ql.io.sarg.SearchArgument.TruthValue;
 import org.apache.hadoop.hive.ql.io.sarg.TestSearchArgumentImpl;
 import org.apache.hadoop.hive.serde2.io.DateWritable;
-import org.apache.hadoop.io.DataInputBuffer;
 import org.apache.hadoop.io.DataOutputBuffer;
 import org.junit.Test;
 import org.mockito.MockSettings;

Modified: hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/io/sarg/TestSearchArgumentImpl.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/io/sarg/TestSearchArgumentImpl.java?rev=1622799&r1=1622798&r2=1622799&view=diff
==============================================================================
--- hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/io/sarg/TestSearchArgumentImpl.java (original)
+++ hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/io/sarg/TestSearchArgumentImpl.java Fri Sep  5 21:19:58 2014
@@ -22,6 +22,8 @@ import com.google.common.collect.Sets;
 import org.apache.hadoop.hive.common.type.HiveChar;
 import org.apache.hadoop.hive.common.type.HiveDecimal;
 import org.apache.hadoop.hive.common.type.HiveVarchar;
+import org.apache.hadoop.hive.ql.io.sarg.PredicateLeaf;
+import org.apache.hadoop.hive.ql.io.sarg.SearchArgument;
 import org.apache.hadoop.hive.ql.io.sarg.SearchArgument.TruthValue;
 import org.apache.hadoop.hive.ql.io.sarg.SearchArgumentImpl.ExpressionBuilder;
 import org.apache.hadoop.hive.ql.io.sarg.SearchArgumentImpl.ExpressionTree;
@@ -743,7 +745,7 @@ public class TestSearchArgumentImpl {
         "</java> \n";
 
     SearchArgumentImpl sarg =
-        (SearchArgumentImpl) SearchArgument.FACTORY.create(getFuncDesc(exprStr));
+        (SearchArgumentImpl) SearchArgumentFactory.create(getFuncDesc(exprStr));
     List<PredicateLeaf> leaves = sarg.getLeaves();
     assertEquals(9, leaves.size());
 
@@ -1011,7 +1013,7 @@ public class TestSearchArgumentImpl {
         "</java> \n";
 
     SearchArgumentImpl sarg =
-        (SearchArgumentImpl) SearchArgument.FACTORY.create(getFuncDesc(exprStr));
+        (SearchArgumentImpl) SearchArgumentFactory.create(getFuncDesc(exprStr));
     List<PredicateLeaf> leaves = sarg.getLeaves();
     assertEquals(4, leaves.size());
 
@@ -1430,7 +1432,7 @@ public class TestSearchArgumentImpl {
         "</java> \n";
 
     SearchArgumentImpl sarg =
-        (SearchArgumentImpl) SearchArgument.FACTORY.create(getFuncDesc(exprStr));
+        (SearchArgumentImpl) SearchArgumentFactory.create(getFuncDesc(exprStr));
     List<PredicateLeaf> leaves = sarg.getLeaves();
     assertEquals(3, leaves.size());
 
@@ -1640,7 +1642,7 @@ public class TestSearchArgumentImpl {
         "\n";
 
     SearchArgumentImpl sarg =
-        (SearchArgumentImpl) SearchArgument.FACTORY.create(getFuncDesc(exprStr));
+        (SearchArgumentImpl) SearchArgumentFactory.create(getFuncDesc(exprStr));
     List<PredicateLeaf> leaves = sarg.getLeaves();
     assertEquals(3, leaves.size());
 
@@ -1895,7 +1897,7 @@ public class TestSearchArgumentImpl {
         "</java> \n";
 
     SearchArgumentImpl sarg =
-        (SearchArgumentImpl) SearchArgument.FACTORY.create(getFuncDesc(exprStr));
+        (SearchArgumentImpl) SearchArgumentFactory.create(getFuncDesc(exprStr));
     List<PredicateLeaf> leaves = sarg.getLeaves();
     assertEquals(1, leaves.size());
 
@@ -2372,7 +2374,7 @@ public class TestSearchArgumentImpl {
         "</java>";
 
     SearchArgumentImpl sarg =
-        (SearchArgumentImpl) SearchArgument.FACTORY.create(getFuncDesc(exprStr));
+        (SearchArgumentImpl) SearchArgumentFactory.create(getFuncDesc(exprStr));
     List<PredicateLeaf> leaves = sarg.getLeaves();
     assertEquals(9, leaves.size());
 
@@ -2506,7 +2508,7 @@ public class TestSearchArgumentImpl {
         "</java> ";
 
     SearchArgumentImpl sarg =
-        (SearchArgumentImpl) SearchArgument.FACTORY.create(getFuncDesc(exprStr));
+        (SearchArgumentImpl) SearchArgumentFactory.create(getFuncDesc(exprStr));
     List<PredicateLeaf> leaves = sarg.getLeaves();
     assertEquals(0, leaves.size());
 
@@ -2633,7 +2635,7 @@ public class TestSearchArgumentImpl {
         "</java> ";
 
     SearchArgumentImpl sarg =
-        (SearchArgumentImpl) SearchArgument.FACTORY.create(getFuncDesc(exprStr));
+        (SearchArgumentImpl) SearchArgumentFactory.create(getFuncDesc(exprStr));
     List<PredicateLeaf> leaves = sarg.getLeaves();
     assertEquals(0, leaves.size());
 
@@ -2758,7 +2760,7 @@ public class TestSearchArgumentImpl {
         "</java>";
 
     SearchArgumentImpl sarg =
-        (SearchArgumentImpl) SearchArgument.FACTORY.create(getFuncDesc(exprStr));
+        (SearchArgumentImpl) SearchArgumentFactory.create(getFuncDesc(exprStr));
     List<PredicateLeaf> leaves = sarg.getLeaves();
     assertEquals(1, leaves.size());
 
@@ -2788,7 +2790,7 @@ public class TestSearchArgumentImpl {
   @Test
   public void testBuilder() throws Exception {
     SearchArgument sarg =
-        SearchArgument.FACTORY.newBuilder()
+        SearchArgumentFactory.newBuilder()
             .startAnd()
               .lessThan("x", 10)
               .lessThanEquals("y", "hi")
@@ -2799,7 +2801,7 @@ public class TestSearchArgumentImpl {
         "leaf-1 = (LESS_THAN_EQUALS y hi)\n" +
         "leaf-2 = (EQUALS z 1.0)\n" +
         "expr = (and leaf-0 leaf-1 leaf-2)", sarg.toString());
-    sarg = SearchArgument.FACTORY.newBuilder()
+    sarg = SearchArgumentFactory.newBuilder()
         .startNot()
            .startOr()
              .isNull("x")
@@ -2819,7 +2821,7 @@ public class TestSearchArgumentImpl {
   @Test
   public void testBuilderComplexTypes() throws Exception {
     SearchArgument sarg =
-        SearchArgument.FACTORY.newBuilder()
+        SearchArgumentFactory.newBuilder()
             .startAnd()
               .lessThan("x", new DateWritable(10))
               .lessThanEquals("y", new HiveChar("hi", 10))
@@ -2831,7 +2833,7 @@ public class TestSearchArgumentImpl {
         "leaf-2 = (EQUALS z 1.0)\n" +
         "expr = (and leaf-0 leaf-1 leaf-2)", sarg.toString());
 
-    sarg = SearchArgument.FACTORY.newBuilder()
+    sarg = SearchArgumentFactory.newBuilder()
         .startNot()
            .startOr()
              .isNull("x")
@@ -2851,7 +2853,7 @@ public class TestSearchArgumentImpl {
   @Test
   public void testBuilderComplexTypes2() throws Exception {
     SearchArgument sarg =
-        SearchArgument.FACTORY.newBuilder()
+        SearchArgumentFactory.newBuilder()
             .startAnd()
             .lessThan("x", new DateWritable(10))
             .lessThanEquals("y", new HiveChar("hi", 10))
@@ -2863,7 +2865,7 @@ public class TestSearchArgumentImpl {
         "leaf-2 = (EQUALS z 1.0)\n" +
         "expr = (and leaf-0 leaf-1 leaf-2)", sarg.toString());
 
-    sarg = SearchArgument.FACTORY.newBuilder()
+    sarg = SearchArgumentFactory.newBuilder()
         .startNot()
         .startOr()
         .isNull("x")