drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject [1/2] drill git commit: DRILL-2507: most TestParquetWriter tests aren't actually launching the test queries
Date Thu, 26 Mar 2015 23:51:45 GMT
Repository: drill
Updated Branches:
  refs/heads/master 9d92b8e31 -> ee94a37e5


DRILL-2507: most TestParquetWriter tests aren't actually launching the test queries


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

Branch: refs/heads/master
Commit: d4285b2e70ae2f6929076bbc8b97b4dae90cf1b8
Parents: 9d92b8e
Author: adeneche <adeneche@gmail.com>
Authored: Thu Mar 19 20:46:01 2015 -0700
Committer: Jason Altekruse <altekrusejason@gmail.com>
Committed: Thu Mar 26 15:51:11 2015 -0700

----------------------------------------------------------------------
 .../physical/impl/writer/TestParquetWriter.java | 84 ++++++++++----------
 1 file changed, 41 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/d4285b2e/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/writer/TestParquetWriter.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/writer/TestParquetWriter.java
b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/writer/TestParquetWriter.java
index 76328c6..288a295 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/writer/TestParquetWriter.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/writer/TestParquetWriter.java
@@ -17,41 +17,19 @@
  */
 package org.apache.drill.exec.physical.impl.writer;
 
-import static org.junit.Assert.assertEquals;
-
-import java.io.UnsupportedEncodingException;
-import java.lang.reflect.Array;
 import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
 
 import org.apache.drill.BaseTestQuery;
 import org.apache.drill.exec.ExecConstants;
-import org.apache.drill.exec.HyperVectorValueIterator;
-import org.apache.drill.exec.exception.SchemaChangeException;
-import org.apache.drill.exec.proto.UserBitShared;
-import org.apache.drill.exec.record.BatchSchema;
-import org.apache.drill.exec.record.HyperVectorWrapper;
-import org.apache.drill.exec.record.MaterializedField;
-import org.apache.drill.exec.record.RecordBatchLoader;
-import org.apache.drill.exec.record.VectorWrapper;
-import org.apache.drill.exec.rpc.user.QueryResultBatch;
-import org.apache.drill.exec.vector.ValueVector;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.io.Text;
-import org.junit.Assert;
 import org.junit.BeforeClass;
 import org.junit.Ignore;
 import org.junit.Test;
 
 public class TestParquetWriter extends BaseTestQuery {
-  static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TestParquetWriter.class);
+//  private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TestParquetWriter.class);
 
   static FileSystem fs;
 
@@ -103,12 +81,17 @@ public class TestParquetWriter extends BaseTestQuery {
 
   @Test
   public void testTPCHReadWrite1_date_convertedType() throws Exception {
-    String selection = "L_ORDERKEY, L_PARTKEY, L_SUPPKEY, L_LINENUMBER, L_QUANTITY, L_EXTENDEDPRICE,
L_DISCOUNT, L_TAX, " +
+    try {
+      test("alter session set `%s` = false", ExecConstants.PARQUET_WRITER_ENABLE_DICTIONARY_ENCODING);
+      String selection = "L_ORDERKEY, L_PARTKEY, L_SUPPKEY, L_LINENUMBER, L_QUANTITY, L_EXTENDEDPRICE,
L_DISCOUNT, L_TAX, " +
         "L_RETURNFLAG, L_LINESTATUS, L_SHIPDATE, cast(L_COMMITDATE as DATE) as L_COMMITDATE,
cast(L_RECEIPTDATE as DATE) AS L_RECEIPTDATE, L_SHIPINSTRUCT, L_SHIPMODE, L_COMMENT";
-    String validationSelection = "L_ORDERKEY, L_PARTKEY, L_SUPPKEY, L_LINENUMBER, L_QUANTITY,
L_EXTENDEDPRICE, L_DISCOUNT, L_TAX, " +
+      String validationSelection = "L_ORDERKEY, L_PARTKEY, L_SUPPKEY, L_LINENUMBER, L_QUANTITY,
L_EXTENDEDPRICE, L_DISCOUNT, L_TAX, " +
         "L_RETURNFLAG, L_LINESTATUS, L_SHIPDATE,L_COMMITDATE ,L_RECEIPTDATE, L_SHIPINSTRUCT,
L_SHIPMODE, L_COMMENT";
-    String inputTable = "cp.`tpch/lineitem.parquet`";
-    runTestAndValidate(selection, validationSelection, inputTable, "lineitem_parquet_converted");
+      String inputTable = "cp.`tpch/lineitem.parquet`";
+      runTestAndValidate(selection, validationSelection, inputTable, "lineitem_parquet_converted");
+    } finally {
+      test("alter session set `%s` = %b", ExecConstants.PARQUET_WRITER_ENABLE_DICTIONARY_ENCODING,
ExecConstants.PARQUET_WRITER_ENABLE_DICTIONARY_ENCODING_VALIDATOR.getDefault().bool_val);
+    }
   }
 
   @Test
@@ -155,20 +138,26 @@ public class TestParquetWriter extends BaseTestQuery {
 
   @Test
   public void testTPCHReadWriteNoDictUncompressed() throws Exception {
-    test(String.format("alter session set `%s` = false;", ExecConstants.PARQUET_WRITER_ENABLE_DICTIONARY_ENCODING));
-    test(String.format("alter session set `%s` = 'none'", ExecConstants.PARQUET_WRITER_COMPRESSION_TYPE));
-    String inputTable = "cp.`tpch/supplier.parquet`";
-    runTestAndValidate("*", "*", inputTable, "supplier_parquet_no_dict_uncompressed");
-    test(String.format("alter session set `%s` = true;", ExecConstants.PARQUET_WRITER_ENABLE_DICTIONARY_ENCODING));
-    test(String.format("alter session set `%s` = 'snappy'", ExecConstants.PARQUET_WRITER_COMPRESSION_TYPE));
+    try {
+      test(String.format("alter session set `%s` = false", ExecConstants.PARQUET_WRITER_ENABLE_DICTIONARY_ENCODING));
+      test(String.format("alter session set `%s` = 'none'", ExecConstants.PARQUET_WRITER_COMPRESSION_TYPE));
+      String inputTable = "cp.`tpch/supplier.parquet`";
+      runTestAndValidate("*", "*", inputTable, "supplier_parquet_no_dict_uncompressed");
+    } finally {
+      test(String.format("alter session set `%s` = %b", ExecConstants.PARQUET_WRITER_ENABLE_DICTIONARY_ENCODING,
ExecConstants.PARQUET_WRITER_ENABLE_DICTIONARY_ENCODING_VALIDATOR.getDefault().bool_val));
+      test(String.format("alter session set `%s` = '%s'", ExecConstants.PARQUET_WRITER_COMPRESSION_TYPE,
ExecConstants.PARQUET_WRITER_COMPRESSION_TYPE_VALIDATOR.getDefault().string_val));
+    }
   }
 
   @Test
   public void testTPCHReadWriteDictGzip() throws Exception {
-    test(String.format("alter session set `%s` = 'gzip'", ExecConstants.PARQUET_WRITER_COMPRESSION_TYPE));
-    String inputTable = "cp.`tpch/supplier.parquet`";
-    runTestAndValidate("*", "*", inputTable, "supplier_parquet_dict_gzip");
-    test(String.format("alter session set `%s` = 'snappy'", ExecConstants.PARQUET_WRITER_COMPRESSION_TYPE));
+    try {
+      test(String.format("alter session set `%s` = 'gzip'", ExecConstants.PARQUET_WRITER_COMPRESSION_TYPE));
+      String inputTable = "cp.`tpch/supplier.parquet`";
+      runTestAndValidate("*", "*", inputTable, "supplier_parquet_dict_gzip");
+    } finally {
+      test(String.format("alter session set `%s` = '%s'", ExecConstants.PARQUET_WRITER_COMPRESSION_TYPE,
ExecConstants.PARQUET_WRITER_COMPRESSION_TYPE_VALIDATOR.getDefault().string_val));
+    }
   }
 
   // working to create an exhaustive test of the format for this one. including all convertedTypes
@@ -251,28 +240,33 @@ public class TestParquetWriter extends BaseTestQuery {
 
   @Test //DRILL-2030
   public void testWriterWithStarAndExp() throws Exception {
-    String selection = " *, r_regionkey + 1";
-    String validateSelection = "r_regionkey, r_name, r_comment, r_regionkey + 1";
+    String selection = " *, r_regionkey + 1 r_regionkey2";
+    String validateSelection = "r_regionkey, r_name, r_comment, r_regionkey + 1 r_regionkey2";
     String inputTable = "cp.`tpch/region.parquet`";
     runTestAndValidate(selection, validateSelection, inputTable, "region_star_exp");
   }
 
   public void compareParquetReadersColumnar(String selection, String table) throws Exception
{
     String query = "select " + selection + " from " + table;
-    testBuilder()
+
+    try {
+      testBuilder()
         .ordered()
         .sqlQuery(query)
         .optionSettingQueriesForTestQuery("alter system set `store.parquet.use_new_reader`
= false")
         .sqlBaselineQuery(query)
         .optionSettingQueriesForBaseline("alter system set `store.parquet.use_new_reader`
= true")
         .build().run();
-
+    } finally {
+      test("alter system set `%s` = %b", ExecConstants.PARQUET_NEW_RECORD_READER, ExecConstants.PARQUET_RECORD_READER_IMPLEMENTATION_VALIDATOR.getDefault().bool_val);
+    }
   }
 
   public void compareParquetReadersHyperVector(String selection, String table) throws Exception
{
 
     String query = "select " + selection + " from " + table;
-    testBuilder()
+    try {
+      testBuilder()
         .ordered()
         .highPerformanceComparison()
         .sqlQuery(query)
@@ -280,6 +274,9 @@ public class TestParquetWriter extends BaseTestQuery {
         .sqlBaselineQuery(query)
         .optionSettingQueriesForBaseline("alter system set `store.parquet.use_new_reader`
= true")
         .build().run();
+    } finally {
+      test("alter system set `%s` = %b", ExecConstants.PARQUET_NEW_RECORD_READER, ExecConstants.PARQUET_RECORD_READER_IMPLEMENTATION_VALIDATOR.getDefault().bool_val);
+    }
   }
 
   @Ignore
@@ -402,7 +399,8 @@ public class TestParquetWriter extends BaseTestQuery {
     testBuilder()
         .unOrdered()
         .sqlQuery(query)
-        .sqlBaselineQuery(validateQuery);
+        .sqlBaselineQuery(validateQuery)
+        .go();
   }
 
 }


Mime
View raw message