cgivre commented on code in PR #2722: URL: https://github.com/apache/drill/pull/2722#discussion_r1052356461
########## contrib/storage-splunk/src/test/java/org/apache/drill/exec/store/splunk/SplunkWriterTest.java: ########## @@ -0,0 +1,191 @@ +/* + * 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.splunk; + +import org.apache.drill.categories.SlowTest; +import org.apache.drill.common.types.TypeProtos; +import org.apache.drill.common.types.TypeProtos.MinorType; +import org.apache.drill.exec.physical.rowSet.DirectRowSet; +import org.apache.drill.exec.physical.rowSet.RowSet; +import org.apache.drill.exec.physical.rowSet.RowSetBuilder; +import org.apache.drill.exec.record.metadata.SchemaBuilder; +import org.apache.drill.exec.record.metadata.TupleMetadata; +import org.apache.drill.test.QueryBuilder.QuerySummary; +import org.apache.drill.test.rowSet.RowSetUtilities; +import org.junit.FixMethodOrder; +import org.junit.Test; +import org.junit.experimental.categories.Category; +import org.junit.runners.MethodSorters; + + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +@FixMethodOrder(MethodSorters.JVM) +@Category({SlowTest.class}) +public class SplunkWriterTest extends SplunkBaseTest { + + @Test + public void testBasicCTAS() throws Exception { + + // Verify that there is no index called t1 in Splunk + String sql = "SELECT * FROM INFORMATION_SCHEMA.`TABLES` WHERE TABLE_SCHEMA = 'splunk' AND TABLE_NAME LIKE 't1'"; + RowSet results = client.queryBuilder().sql(sql).rowSet(); + assertEquals(0, results.rowCount()); + results.clear(); + + // Now create the table + sql = "CREATE TABLE `splunk`.`t1` AS SELECT * FROM cp.`test_data.csvh`"; + QuerySummary summary = client.queryBuilder().sql(sql).run(); + assertTrue(summary.succeeded()); + + // Verify that an index was created called t1 in Splunk + sql = "SELECT * FROM INFORMATION_SCHEMA.`TABLES` WHERE TABLE_SCHEMA = 'splunk' AND TABLE_NAME LIKE 't1'"; + results = client.queryBuilder().sql(sql).rowSet(); + assertEquals(1, results.rowCount()); + results.clear(); + + // There seems to be some delay between the Drill query writing the data and the data being made + // accessible. + Thread.sleep(30000); Review Comment: Yeah.. There seems to be a processing delay between inserting data and it actually being queryable. I don't think this is a Drill issue. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
