[ https://issues.apache.org/jira/browse/DRILL-8371?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17649378#comment-17649378 ]
ASF GitHub Bot commented on DRILL-8371: --------------------------------------- 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. > Add Write/Append Capability to Splunk Plugin > -------------------------------------------- > > Key: DRILL-8371 > URL: https://issues.apache.org/jira/browse/DRILL-8371 > Project: Apache Drill > Issue Type: Improvement > Components: Storage - Splunk > Affects Versions: 1.20.2 > Reporter: Charles Givre > Assignee: Charles Givre > Priority: Major > Fix For: 2.0.0 > > > While Drill can currently read from Splunk indexes, it cannot write to them > or create them. This proposed PR adds support for CTAS queries for Splunk as > well as INSERT and DROP TABLE. -- This message was sent by Atlassian Jira (v8.20.10#820010)