Update hive to use generated data instead of packaged data. Remove unused test.
Project: http://git-wip-us.apache.org/repos/asf/incubator-drill/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-drill/commit/68d2c383 Tree: http://git-wip-us.apache.org/repos/asf/incubator-drill/tree/68d2c383 Diff: http://git-wip-us.apache.org/repos/asf/incubator-drill/diff/68d2c383 Branch: refs/heads/master Commit: 68d2c38391deb35fc8022b1c6f9914e2bbca74a1 Parents: 0ca797a Author: Jacques Nadeau <jacq...@apache.org> Authored: Sun Mar 2 18:29:27 2014 -0800 Committer: Jacques Nadeau <jacq...@apache.org> Committed: Mon Mar 3 23:22:18 2014 -0800 ---------------------------------------------------------------------- .../store/ischema/InfoSchemaBatchCreator.java | 17 ++++ .../exec/store/ischema/InfoSchemaConfig.java | 17 ++++ .../store/ischema/InfoSchemaDrillTable.java | 17 ++++ .../exec/store/ischema/InfoSchemaGroupScan.java | 17 ++++ .../store/ischema/InfoSchemaStoragePlugin.java | 17 ++++ .../exec/store/ischema/InfoSchemaSubScan.java | 17 ++++ .../drill/exec/store/ischema/SelectedTable.java | 17 ++++ .../drill/exec/store/TestOrphanSchema.java | 17 ++++ .../exec/store/hive/HiveTestDataGenerator.java | 97 ++++++++++++++++++++ .../drill/exec/store/hive/TestHiveScan.java | 67 -------------- .../drill/exec/store/ischema/OrphanSchema.java | 17 ++++ .../src/test/resources/storage-engines.json | 16 +--- sqlparser/pom.xml | 20 ---- .../apache/drill/jdbc/test/TestJdbcQuery.java | 15 ++- .../src/test/resources/storage-engines.json | 2 +- 15 files changed, 264 insertions(+), 106 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/68d2c383/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaBatchCreator.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaBatchCreator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaBatchCreator.java index 68844e1..a400245 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaBatchCreator.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaBatchCreator.java @@ -1,3 +1,20 @@ +/** + * 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.exec.store.ischema; import java.util.Collections; http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/68d2c383/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaConfig.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaConfig.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaConfig.java index 1447eb3..d0ae77a 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaConfig.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaConfig.java @@ -1,3 +1,20 @@ +/** + * 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.exec.store.ischema; import org.apache.drill.common.logical.StoragePluginConfig; http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/68d2c383/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaDrillTable.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaDrillTable.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaDrillTable.java index 7b6cb32..20609b8 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaDrillTable.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaDrillTable.java @@ -1,3 +1,20 @@ +/** + * 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.exec.store.ischema; import org.apache.drill.common.logical.StoragePluginConfig; http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/68d2c383/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaGroupScan.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaGroupScan.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaGroupScan.java index 1985d6a..ac625b7 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaGroupScan.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaGroupScan.java @@ -1,3 +1,20 @@ +/** + * 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.exec.store.ischema; import java.util.Collections; http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/68d2c383/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaStoragePlugin.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaStoragePlugin.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaStoragePlugin.java index e5ab158..04b027c 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaStoragePlugin.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaStoragePlugin.java @@ -1,3 +1,20 @@ +/** + * 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.exec.store.ischema; import java.io.IOException; http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/68d2c383/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaSubScan.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaSubScan.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaSubScan.java index 20375ca..dce4d3b 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaSubScan.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaSubScan.java @@ -1,3 +1,20 @@ +/** + * 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.exec.store.ischema; import org.apache.drill.exec.physical.base.AbstractSubScan; http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/68d2c383/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/SelectedTable.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/SelectedTable.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/SelectedTable.java index 3e354f8..1dd7c8a 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/SelectedTable.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/SelectedTable.java @@ -1,3 +1,20 @@ +/** + * 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.exec.store.ischema; import net.hydromatic.optiq.SchemaPlus; http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/68d2c383/exec/java-exec/src/test/java/org/apache/drill/exec/store/TestOrphanSchema.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/store/TestOrphanSchema.java b/exec/java-exec/src/test/java/org/apache/drill/exec/store/TestOrphanSchema.java index 2087dc2..429d5fe 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/store/TestOrphanSchema.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/store/TestOrphanSchema.java @@ -1,3 +1,20 @@ +/** + * 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.exec.store; import mockit.NonStrictExpectations; http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/68d2c383/exec/java-exec/src/test/java/org/apache/drill/exec/store/hive/HiveTestDataGenerator.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/store/hive/HiveTestDataGenerator.java b/exec/java-exec/src/test/java/org/apache/drill/exec/store/hive/HiveTestDataGenerator.java new file mode 100644 index 0000000..7155a52 --- /dev/null +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/store/hive/HiveTestDataGenerator.java @@ -0,0 +1,97 @@ +/** + * 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.exec.store.hive; + +import java.io.File; +import java.io.IOException; +import java.io.PrintWriter; + +import org.apache.hadoop.hive.conf.HiveConf; +import org.apache.hadoop.hive.ql.CommandNeedRetryException; +import org.apache.hadoop.hive.ql.Driver; +import org.apache.hadoop.hive.ql.processors.CommandProcessorResponse; +import org.apache.hadoop.hive.ql.session.SessionState; + +public class HiveTestDataGenerator { + static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(HiveTestDataGenerator.class); + + static int RETRIES = 5; + private Driver hiveDriver = null; + + public static void main(String[] args) throws Exception { + HiveTestDataGenerator htd = new HiveTestDataGenerator(); + htd.generateTestData(); + } + + public void generateTestData() throws Exception { + HiveConf conf = new HiveConf(); + + conf.set("javax.jdo.option.ConnectionURL", "jdbc:derby:;databaseName=/tmp/drill_hive_db;create=true"); + conf.set("fs.default.name", "file:///"); + conf.set("hive.metastore.warehouse.dir", "/tmp/drill_hive_wh"); + + String tableName = "kv"; + + SessionState ss = new SessionState(new HiveConf(SessionState.class)); + SessionState.start(ss); + hiveDriver = new Driver(conf); + executeQuery(String.format("CREATE TABLE IF NOT EXISTS default.kv(key INT, value STRING) "+ + "ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' STORED AS TEXTFILE", tableName)); + executeQuery(String.format("LOAD DATA LOCAL INPATH '%s' OVERWRITE INTO TABLE %s", generateTestDataFile(), tableName)); + ss.close(); + } + + private String generateTestDataFile() throws Exception { + File file = null; + while (true) { + file = File.createTempFile("drill-hive-test", ".txt"); + if (file.exists()) { + boolean success = file.delete(); + if (success) { + break; + } + } + logger.debug("retry creating tmp file"); + } + + PrintWriter printWriter = new PrintWriter(file); + for (int i=1; i<=5; i++) + printWriter.println (String.format("%d, key_%d", i, i)); + printWriter.close(); + + return file.getPath(); + } + + private void executeQuery(String query) { + CommandProcessorResponse response = null; + boolean failed = false; + int retryCount = RETRIES; + + try { + response = hiveDriver.run(query); + } catch(CommandNeedRetryException ex) { + if (--retryCount == 0) + failed = true; + } + + if (failed || response.getResponseCode() != 0 ) + throw new RuntimeException(String.format("Failed to execute command '%s', errorMsg = '%s'", + query, (response != null ? response.getErrorMessage() : ""))); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/68d2c383/exec/java-exec/src/test/java/org/apache/drill/exec/store/hive/TestHiveScan.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/store/hive/TestHiveScan.java b/exec/java-exec/src/test/java/org/apache/drill/exec/store/hive/TestHiveScan.java deleted file mode 100644 index c6edc20..0000000 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/store/hive/TestHiveScan.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * 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.exec.store.hive; - -import com.google.common.base.Charsets; -import com.google.common.io.Files; -import org.apache.drill.common.util.FileUtils; -import org.apache.drill.exec.client.DrillClient; -import org.apache.drill.exec.pop.PopUnitTestBase; -import org.apache.drill.exec.proto.UserProtos; -import org.apache.drill.exec.rpc.user.QueryResultBatch; -import org.apache.drill.exec.server.Drillbit; -import org.apache.drill.exec.server.RemoteServiceSet; -import org.junit.Ignore; -import org.junit.Test; - -import java.util.List; - -import static org.junit.Assert.assertEquals; - -/** - * Created with IntelliJ IDEA. - * User: sphillips - * Date: 1/23/14 - * Time: 5:22 AM - * To change this template use File | Settings | File Templates. - */ -public class TestHiveScan extends PopUnitTestBase { - @Ignore - @Test - public void twoBitTwoExchangeTwoEntryRun() throws Exception { - RemoteServiceSet serviceSet = RemoteServiceSet.getLocalServiceSet(); - - try(Drillbit bit1 = new Drillbit(CONFIG, serviceSet); - Drillbit bit2 = new Drillbit(CONFIG, serviceSet); - DrillClient client = new DrillClient(CONFIG, serviceSet.getCoordinator());) { - - bit1.run(); - bit2.run(); - client.connect(); - List<QueryResultBatch> results = client.runQuery(UserProtos.QueryType.PHYSICAL, - Files.toString(FileUtils.getResourceAsFile("/hive/test.json"), - Charsets.UTF_8)); - int count = 0; - for(QueryResultBatch b : results) { - if (b.getHeader().getRowCount() != 0) - count += b.getHeader().getRowCount(); - } - assertEquals(100, count); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/68d2c383/exec/java-exec/src/test/java/org/apache/drill/exec/store/ischema/OrphanSchema.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/store/ischema/OrphanSchema.java b/exec/java-exec/src/test/java/org/apache/drill/exec/store/ischema/OrphanSchema.java index 268b844..ee36493 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/exec/store/ischema/OrphanSchema.java +++ b/exec/java-exec/src/test/java/org/apache/drill/exec/store/ischema/OrphanSchema.java @@ -1,3 +1,20 @@ +/** + * 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.exec.store.ischema; http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/68d2c383/exec/java-exec/src/test/resources/storage-engines.json ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/test/resources/storage-engines.json b/exec/java-exec/src/test/resources/storage-engines.json index 7d3dc38..58f091e 100644 --- a/exec/java-exec/src/test/resources/storage-engines.json +++ b/exec/java-exec/src/test/resources/storage-engines.json @@ -3,18 +3,6 @@ dfs: { type: "file", connection: "file:///" - }, - hive : - { - type:"hive", - config : - { - "hive.metastore.uris" : "", - "javax.jdo.option.ConnectionURL" : "jdbc:derby:;databaseName=../../sample-data/drill_hive_db;create=true", - "hive.metastore.warehouse.dir" : "/tmp/drill_hive_wh", - "fs.default.name" : "file:///", - "hive.metastore.sasl.enabled" : "false" - } - } - } + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/68d2c383/sqlparser/pom.xml ---------------------------------------------------------------------- diff --git a/sqlparser/pom.xml b/sqlparser/pom.xml index 90e044f..f0606f1 100644 --- a/sqlparser/pom.xml +++ b/sqlparser/pom.xml @@ -91,26 +91,6 @@ </excludes> </configuration> </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-antrun-plugin</artifactId> - <version>1.7</version> - <executions> - <execution> - <phase>test</phase> - <goals> - <goal>run</goal> - </goals> - <configuration> - <tasks> - <copy todir="/tmp/drill_hive_wh"> - <fileset dir="${basedir}/../sample-data/drill_hive_wh"/> - </copy> - </tasks> - </configuration> - </execution> - </executions> - </plugin> </plugins> </build> <profiles> http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/68d2c383/sqlparser/src/test/java/org/apache/drill/jdbc/test/TestJdbcQuery.java ---------------------------------------------------------------------- diff --git a/sqlparser/src/test/java/org/apache/drill/jdbc/test/TestJdbcQuery.java b/sqlparser/src/test/java/org/apache/drill/jdbc/test/TestJdbcQuery.java index f5081b3..1d678cc 100644 --- a/sqlparser/src/test/java/org/apache/drill/jdbc/test/TestJdbcQuery.java +++ b/sqlparser/src/test/java/org/apache/drill/jdbc/test/TestJdbcQuery.java @@ -26,7 +26,9 @@ import java.sql.Statement; import java.util.concurrent.TimeUnit; import org.apache.drill.common.util.TestTools; +import org.apache.drill.exec.store.hive.HiveTestDataGenerator; import org.apache.drill.jdbc.Driver; +import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; @@ -37,8 +39,7 @@ import com.google.common.base.Stopwatch; public class TestJdbcQuery { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TestJdbcQuery.class); - 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 TIMEOUT = TestTools.getTimeoutRule(20000); @@ -46,17 +47,23 @@ public class TestJdbcQuery { static{ Driver.load(); WORKING_PATH = Paths.get("").toAbsolutePath().toString(); + + } + + @BeforeClass + public static void generateHive() throws Exception{ + new HiveTestDataGenerator().generateTestData(); } @Test public void testHiveRead() throws Exception{ - testQuery("select * from hive.kv_text"); + testQuery("select * from hive.kv"); } @Test @Ignore // something not working here. public void testHiveReadWithDb() throws Exception{ - testQuery("select * from hive.`default`.kv_text"); + testQuery("select * from hive.`default`.kv"); } @Test http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/68d2c383/sqlparser/src/test/resources/storage-engines.json ---------------------------------------------------------------------- diff --git a/sqlparser/src/test/resources/storage-engines.json b/sqlparser/src/test/resources/storage-engines.json index fca6b68..c16a971 100644 --- a/sqlparser/src/test/resources/storage-engines.json +++ b/sqlparser/src/test/resources/storage-engines.json @@ -17,7 +17,7 @@ config : { "hive.metastore.uris" : "", - "javax.jdo.option.ConnectionURL" : "jdbc:derby:;databaseName=../sample-data/drill_hive_db;create=true", + "javax.jdo.option.ConnectionURL" : "jdbc:derby:;databaseName=/tmp/drill_hive_db;create=true", "hive.metastore.warehouse.dir" : "/tmp/drill_hive_wh", "fs.default.name" : "file:///", "hive.metastore.sasl.enabled" : "false"