Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Drill, mail # dev - [6/6] git commit: Add a unit test case using TPCH related queries.


Copy link to this message
-
[6/6] git commit: Add a unit test case using TPCH related queries.
jacques@... 2014-01-14, 16:48
Add a unit test case using TPCH related queries.
Project: http://git-wip-us.apache.org/repos/asf/incubator-drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-drill/commit/f95e9336
Tree: http://git-wip-us.apache.org/repos/asf/incubator-drill/tree/f95e9336
Diff: http://git-wip-us.apache.org/repos/asf/incubator-drill/diff/f95e9336

Branch: refs/heads/master
Commit: f95e9336ccfe5627558d7dc5aefce37b659fcbb9
Parents: 4a87226
Author: Jinfeng Ni <[EMAIL PROTECTED]>
Authored: Wed Nov 20 09:57:09 2013 -0800
Committer: Jacques Nadeau <[EMAIL PROTECTED]>
Committed: Tue Jan 14 08:40:41 2014 -0800

----------------------------------------------------------------------
 .../drill/jdbc/test/FullEngineTPCHTest.java     | 127 +++++++++++++++++++
 1 file changed, 127 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/f95e9336/sqlparser/src/test/java/org/apache/drill/jdbc/test/FullEngineTPCHTest.java
----------------------------------------------------------------------
diff --git a/sqlparser/src/test/java/org/apache/drill/jdbc/test/FullEngineTPCHTest.java b/sqlparser/src/test/java/org/apache/drill/jdbc/test/FullEngineTPCHTest.java
new file mode 100644
index 0000000..f9d9274
--- /dev/null
+++ b/sqlparser/src/test/java/org/apache/drill/jdbc/test/FullEngineTPCHTest.java
@@ -0,0 +1,127 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.drill.jdbc.test;
+
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestName;
+import org.junit.rules.TestRule;
+import org.junit.rules.Timeout;
+
+
+public class FullEngineTPCHTest {
+  static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(FullEngineTPCHTest.class);
+
+  // Determine if we are in Eclipse Debug mode.
+  static final boolean IS_DEBUG = java.lang.management.ManagementFactory.getRuntimeMXBean().getInputArguments().toString().indexOf("-agentlib:jdwp") > 0;
+
+  // Set a timeout unless we're debugging.
+  @Rule public TestRule globalTimeout = IS_DEBUG ? new TestName() : new Timeout(1000000);
+  
+  @Test
+  @Ignore // since this is a specifically located file.
+  public void fullSelectStarEngine() throws Exception {
+    JdbcAssert.withFull("parquet-local")
+    // .sql("select cast(_MAP['red'] as bigint) + 1 as red_inc from donuts ")
+        .sql("select _MAP['d'] as d, _MAP['b'] as b from \"/tmp/parquet_test_file_many_types\" ").displayResults(50);
+  }
+
+  @Test
+  //this is used to test func with null input.
+  public void testSimpleFuncArgValidator() throws Exception {
+    JdbcAssert.withFull("parquet-local")
+    // .sql("select cast(_MAP['red'] as bigint) + 1 as red_inc from donuts ")
+        .sql(  "select 3 + cast(_MAP['NATIONKEY'] as numeric) FROM \"/Users/jni//work/tpc-h-parquet/nation\""
+            ).displayResults(100);
+  }
+
+  @Test
+  @Ignore
+  public void test2TableJoinIOBE() throws Exception {
+    JdbcAssert.withFull("parquet-local")
+    // .sql("select cast(_MAP['red'] as bigint) + 1 as red_inc from donuts ")
+        .sql(
+            "SELECT P.* " +
+            " FROM " +
+            " ( SELECT _MAP['P_PARTKEY'] as P_PARTKEY, " +
+            "          _MAP['P_MFGR'] as P_MFGR " +
+            "   FROM \"/Users/jni//work/tpc-h-parquet/part\") P,"+
+            " (SELECT _MAP['PS_PARTKEY'] AS PS_PARTKEY, " +
+            "         _MAP['PS_SUPPKEY'] AS PS_SUPPKEY " +
+            "  FROM \"/Users/jni//work/tpc-h-parquet/partsupp\") PS " +
+            " WHERE P.P_PARTKEY  = PS.PS_PARTKEY "+
+            " LIMIT 100 "
+            ).displayResults(100);
+  }
+
+  @Test
+  @Ignore
+  public void testAggOverEmptyBatch() throws Exception {
+    JdbcAssert.withFull("parquet-local")
+    // .sql("select cast(_MAP['red'] as bigint) + 1 as red_inc from donuts ")
+        .sql(  "select SUM(cast(_MAP['N_NATIONKEY'] as numeric)) FROM \"/Users/jni//work/tpc-h-parquet/nation\" where 0=1"
+            ).displayResults(100);
+  }
+  
+  @Test
+  @Ignore
+  public void test3TableJoins() throws Exception {
+    JdbcAssert.withFull("parquet-local")
+    // .sql("select cast(_MAP['red'] as bigint) + 1 as red_inc from donuts ")
+        .sql(
+            "SELECT S.S_ACCTBAL, S.S_NAME " +
+            "FROM " +
+            "( SELECT _MAP['P_PARTKEY'] as P_PARTKEY, " +
+            "         _MAP['P_MFGR'] as P_MFGR " +
+            "  FROM \"/Users/jni//work/tpc-h-parquet/part\") P, " +
+            " ( SELECT _MAP['S_SUPPKEY'] AS S_SUPPKEY, "+
+            "          _MAP['S_NATIONKEY'] AS S_NATIONKEY, " +
+            "          _MAP['S_ACCTBAL'] AS S_ACCTBAL, " +
+            "          _MAP['S_NAME']  AS S_NAME, " +
+            "          _MAP['S_ADDRESS'] AS S_ADDRESS, " +
+            "          _MAP['S_PHONE'] AS S_PHONE, " +
+            "          _MAP['S_COMMENT'] AS S_COMMENT " +
+            "   FROM \"/Users/jni//work/tpc-h-parquet/supplier\") S, " +
+            " (SELECT _MAP['PS_PARTKEY'] AS PS_PARTKEY, " +
+            "         _MAP['PS_SUPPKEY'] AS PS_SUPPKEY " +
+            " FROM \"/Users/jni//work/tpc-h-parquet/partsupp\") PS " +  
+            " WHERE P.P_PARTK