diff options
Diffstat (limited to 'exec/jdbc')
22 files changed, 58 insertions, 92 deletions
diff --git a/exec/jdbc/src/main/java/org/apache/drill/jdbc/AvaticaDrillSqlAccessor.java b/exec/jdbc/src/main/java/org/apache/drill/jdbc/AvaticaDrillSqlAccessor.java index d06c42054..cf5829a5e 100644 --- a/exec/jdbc/src/main/java/org/apache/drill/jdbc/AvaticaDrillSqlAccessor.java +++ b/exec/jdbc/src/main/java/org/apache/drill/jdbc/AvaticaDrillSqlAccessor.java @@ -45,7 +45,7 @@ public class AvaticaDrillSqlAccessor implements Accessor{ private SqlAccessor a; private DrillCursor cursor; - + public AvaticaDrillSqlAccessor(SqlAccessor drillSqlAccessor, DrillCursor cursor) { super(); this.a = drillSqlAccessor; @@ -55,7 +55,7 @@ public class AvaticaDrillSqlAccessor implements Accessor{ private int row(){ return cursor.currentRecord; } - + @Override public boolean wasNull() { return a.isNull(row()); diff --git a/exec/jdbc/src/main/java/org/apache/drill/jdbc/BasicList.java b/exec/jdbc/src/main/java/org/apache/drill/jdbc/BasicList.java index 74fa72b68..290d680f5 100644 --- a/exec/jdbc/src/main/java/org/apache/drill/jdbc/BasicList.java +++ b/exec/jdbc/src/main/java/org/apache/drill/jdbc/BasicList.java @@ -89,11 +89,11 @@ abstract class BasicList<T> implements List<T>{ throw new UnsupportedOperationException(); } - + public void clear(){ throw new UnsupportedOperationException(); } - + @Override public T set(int index, T element) { throw new UnsupportedOperationException(); diff --git a/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillColumnMetaDataList.java b/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillColumnMetaDataList.java index 51722eafd..61afbfb4d 100644 --- a/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillColumnMetaDataList.java +++ b/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillColumnMetaDataList.java @@ -18,19 +18,17 @@ package org.apache.drill.jdbc; import java.sql.ResultSetMetaData; -import java.util.ArrayList; -import java.util.List; -import org.apache.drill.common.types.Types; +import net.hydromatic.avatica.ColumnMetaData; +import net.hydromatic.avatica.ColumnMetaData.AvaticaType; +import net.hydromatic.avatica.ColumnMetaData.Rep; + import org.apache.drill.common.types.TypeProtos.DataMode; import org.apache.drill.common.types.TypeProtos.MajorType; +import org.apache.drill.common.types.Types; import org.apache.drill.exec.record.BatchSchema; import org.apache.drill.exec.record.MaterializedField; -import net.hydromatic.avatica.ColumnMetaData; -import net.hydromatic.avatica.ColumnMetaData.AvaticaType; -import net.hydromatic.avatica.ColumnMetaData.Rep; - public class DrillColumnMetaDataList extends BasicList<ColumnMetaData>{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(DrillColumnMetaDataList.class); diff --git a/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillConnection.java b/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillConnection.java index 5434f3d40..a52644d33 100644 --- a/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillConnection.java +++ b/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillConnection.java @@ -36,6 +36,6 @@ public interface DrillConnection extends Connection{ * within Optiq should use this view rather than calling * {@link java.util.Properties#getProperty(String)}. */ DrillConnectionConfig config(); - + public DrillClient getClient(); } diff --git a/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillConnectionConfig.java b/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillConnectionConfig.java index 0c0989d7e..584bbb4ea 100644 --- a/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillConnectionConfig.java +++ b/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillConnectionConfig.java @@ -20,26 +20,25 @@ package org.apache.drill.jdbc; import java.util.Properties; import java.util.TimeZone; -import net.hydromatic.avatica.ConnectionConfig; import net.hydromatic.avatica.ConnectionConfigImpl; public class DrillConnectionConfig extends ConnectionConfigImpl { private final Properties props; - + public DrillConnectionConfig(Properties p){ super(p); this.props = p; } - + public boolean isLocal(){ return "local".equals(props.getProperty("zk")); } public String getZookeeperConnectionString(){ return props.getProperty("zk"); } - + public TimeZone getTimeZone(){ - return TimeZone.getDefault(); + return TimeZone.getDefault(); } - + } diff --git a/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillConnectionImpl.java b/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillConnectionImpl.java index 224d59f63..f4ca79b9b 100644 --- a/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillConnectionImpl.java +++ b/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillConnectionImpl.java @@ -95,6 +95,7 @@ abstract class DrillConnectionImpl extends AvaticaConnection implements org.apac } + @Override public DrillConnectionConfig config(){ return config; } diff --git a/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillCursor.java b/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillCursor.java index 380ee9947..9d4630f7c 100644 --- a/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillCursor.java +++ b/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillCursor.java @@ -24,7 +24,6 @@ import java.util.List; import net.hydromatic.avatica.ArrayImpl.Factory; import net.hydromatic.avatica.ColumnMetaData; import net.hydromatic.avatica.Cursor; -import net.hydromatic.avatica.Cursor.Accessor; import org.apache.drill.exec.exception.SchemaChangeException; import org.apache.drill.exec.record.BatchSchema; diff --git a/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillJdbc41Factory.java b/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillJdbc41Factory.java index e6e533ef4..7fb0a34eb 100644 --- a/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillJdbc41Factory.java +++ b/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillJdbc41Factory.java @@ -52,6 +52,7 @@ public class DrillJdbc41Factory extends DrillFactory { super(major, minor); } + @Override public DrillJdbc41Connection newDrillConnection(Driver driver, DrillFactory factory, String url, Properties info) throws SQLException{ return new DrillJdbc41Connection((Driver) driver, factory, url, info); } diff --git a/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillPrepareResult.java b/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillPrepareResult.java index 836f3466e..a388c4e13 100644 --- a/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillPrepareResult.java +++ b/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillPrepareResult.java @@ -29,7 +29,7 @@ public class DrillPrepareResult implements AvaticaPrepareResult{ final String sql; final DrillColumnMetaDataList columns = new DrillColumnMetaDataList(); - + public DrillPrepareResult(String sql) { super(); this.sql = sql; diff --git a/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillPreparedStatement.java b/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillPreparedStatement.java index 6d4ee957a..cfcee8c3e 100644 --- a/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillPreparedStatement.java +++ b/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillPreparedStatement.java @@ -24,7 +24,7 @@ import net.hydromatic.avatica.AvaticaPreparedStatement; /** * Implementation of {@link java.sql.PreparedStatement} for Drill. - * + * * <p> * This class has sub-classes which implement JDBC 3.0 and JDBC 4.0 APIs; it is instantiated using * {@link net.hydromatic.avatica.AvaticaFactory#newPreparedStatement}. diff --git a/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillStatementRegistry.java b/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillStatementRegistry.java index 480caca8b..cc797fa91 100644 --- a/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillStatementRegistry.java +++ b/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillStatementRegistry.java @@ -19,10 +19,10 @@ package org.apache.drill.jdbc; class DrillStatementRegistry { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(DrillStatementRegistry.class); - - + + public void addStatement(DrillRemoteStatement statement){} public void removeStatement(DrillRemoteStatement statement){} - + public void close(){} } diff --git a/exec/jdbc/src/main/java/org/apache/drill/jdbc/Driver.java b/exec/jdbc/src/main/java/org/apache/drill/jdbc/Driver.java index 696ef26e6..974e786a4 100644 --- a/exec/jdbc/src/main/java/org/apache/drill/jdbc/Driver.java +++ b/exec/jdbc/src/main/java/org/apache/drill/jdbc/Driver.java @@ -17,8 +17,6 @@ */ package org.apache.drill.jdbc; -import org.apache.drill.common.config.DrillConfig; - import net.hydromatic.avatica.DriverVersion; import net.hydromatic.avatica.Handler; import net.hydromatic.avatica.HandlerImpl; @@ -59,6 +57,7 @@ public class Driver extends UnregisteredDriver { } } + @Override protected DriverVersion createDriverVersion() { return DriverVersion.load( Driver.class, diff --git a/exec/jdbc/src/main/java/org/apache/drill/jdbc/GlobalServiceSetReference.java b/exec/jdbc/src/main/java/org/apache/drill/jdbc/GlobalServiceSetReference.java index 932628303..7c9329c62 100644 --- a/exec/jdbc/src/main/java/org/apache/drill/jdbc/GlobalServiceSetReference.java +++ b/exec/jdbc/src/main/java/org/apache/drill/jdbc/GlobalServiceSetReference.java @@ -21,9 +21,9 @@ import org.apache.drill.exec.server.RemoteServiceSet; public class GlobalServiceSetReference { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(GlobalServiceSetReference.class); - + public static final ThreadLocal<RemoteServiceSet> SETS = new ThreadLocal<RemoteServiceSet>(); - - - + + + } diff --git a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/JdbcAssert.java b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/JdbcAssert.java index 198d272f8..8f2ddd9ec 100644 --- a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/JdbcAssert.java +++ b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/JdbcAssert.java @@ -29,21 +29,17 @@ import java.util.Properties; import java.util.SortedSet; import java.util.TreeSet; -import com.fasterxml.jackson.core.JsonFactory; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.google.common.base.Predicate; -import com.google.common.collect.Iterables; import net.hydromatic.linq4j.Ord; import org.apache.drill.common.config.DrillConfig; import org.apache.drill.common.logical.LogicalPlan; import org.apache.drill.common.logical.data.LogicalOperator; import org.apache.drill.common.util.Hook; -import org.codehaus.jackson.node.ObjectNode; import org.junit.Assert; import com.google.common.base.Function; +import com.google.common.base.Predicate; +import com.google.common.collect.Iterables; /** * Fluent interface for writing JDBC and query-planning tests. diff --git a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/JdbcTestQueryBase.java b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/JdbcTestQueryBase.java index 6ab761955..2dba4029e 100644 --- a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/JdbcTestQueryBase.java +++ b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/JdbcTestQueryBase.java @@ -17,17 +17,6 @@ */ package org.apache.drill.jdbc.test; -import com.google.common.base.Stopwatch; -import org.apache.commons.io.FileUtils; -import org.apache.drill.common.util.TestTools; -import org.apache.drill.exec.store.hive.HiveTestDataGenerator; -import org.apache.drill.jdbc.Driver; -import org.apache.drill.jdbc.JdbcTest; -import org.junit.BeforeClass; -import org.junit.Rule; -import org.junit.rules.TestRule; - -import java.io.File; import java.nio.file.Paths; import java.sql.Connection; import java.sql.DriverManager; @@ -36,6 +25,14 @@ import java.sql.ResultSetMetaData; import java.sql.Statement; import java.util.concurrent.TimeUnit; +import org.apache.drill.common.util.TestTools; +import org.apache.drill.jdbc.Driver; +import org.apache.drill.jdbc.JdbcTest; +import org.junit.Rule; +import org.junit.rules.TestRule; + +import com.google.common.base.Stopwatch; + public class JdbcTestQueryBase extends JdbcTest { // Set a timeout unless we're debugging. @Rule diff --git a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestAggregateFunctionsQuery.java b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestAggregateFunctionsQuery.java index 812ee40bf..f6295bcef 100644 --- a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestAggregateFunctionsQuery.java +++ b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestAggregateFunctionsQuery.java @@ -18,28 +18,11 @@ package org.apache.drill.jdbc.test; import java.nio.file.Paths; -import java.sql.Connection; import java.sql.Date; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -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.apache.drill.jdbc.JdbcTest; import org.joda.time.chrono.ISOChronology; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.TestRule; - -import com.google.common.base.Function; -import com.google.common.base.Stopwatch; public class TestAggregateFunctionsQuery { diff --git a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestFunctionsQuery.java b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestFunctionsQuery.java index cad5b4df0..881834be0 100644 --- a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestFunctionsQuery.java +++ b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestFunctionsQuery.java @@ -559,7 +559,7 @@ public class TestFunctionsQuery { "DATE1=2011-02-01; " + "DATE2=2011-01-01\n"); } - + @Test @Ignore public void testToTimeStamp() throws Exception { diff --git a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestHiveScalarUDFs.java b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestHiveScalarUDFs.java index ce26c5597..705152ef0 100644 --- a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestHiveScalarUDFs.java +++ b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestHiveScalarUDFs.java @@ -20,11 +20,9 @@ package org.apache.drill.jdbc.test; import org.apache.drill.exec.store.hive.HiveTestDataGenerator; -import org.apache.hadoop.hive.ql.exec.UDF; -import org.apache.hadoop.hive.ql.udf.generic.GenericUDF; import org.junit.BeforeClass; -import org.junit.Test; import org.junit.Ignore; +import org.junit.Test; public class TestHiveScalarUDFs { diff --git a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestJdbcDistQuery.java b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestJdbcDistQuery.java index d10eeb289..58b36159b 100644 --- a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestJdbcDistQuery.java +++ b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestJdbcDistQuery.java @@ -26,19 +26,17 @@ import java.sql.Statement; import java.util.List; import java.util.concurrent.TimeUnit; -import com.google.common.collect.Lists; import org.apache.drill.common.util.TestTools; -import org.apache.drill.exec.store.hive.HiveTestDataGenerator; import org.apache.drill.jdbc.Driver; import org.apache.drill.jdbc.JdbcTest; import org.junit.Assert; -import org.junit.BeforeClass; +import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; -import org.junit.Ignore; import org.junit.rules.TestRule; import com.google.common.base.Stopwatch; +import com.google.common.collect.Lists; public class TestJdbcDistQuery extends JdbcTest{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TestJdbcDistQuery.class); diff --git a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestJdbcQuery.java b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestJdbcQuery.java index b681719a8..6ef87c2cf 100644 --- a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestJdbcQuery.java +++ b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestJdbcQuery.java @@ -17,8 +17,8 @@ */ package org.apache.drill.jdbc.test; -import java.lang.Exception; -import java.lang.RuntimeException; +import static org.junit.Assert.assertEquals; + import java.sql.Connection; import java.sql.ResultSet; import java.sql.Statement; @@ -29,8 +29,6 @@ import org.junit.Test; import com.google.common.base.Function; -import static org.junit.Assert.assertEquals; - public class TestJdbcQuery extends JdbcTestQueryBase{ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TestJdbcQuery.class); @@ -328,7 +326,7 @@ public class TestJdbcQuery extends JdbcTestQueryBase{ "L_UTF8=5\n" ); } - + @Test public void testTimeIntervalAddOverflow() throws Exception { JdbcAssert.withNoDefaultSchema() diff --git a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestMetadataDDL.java b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestMetadataDDL.java index b1fc193f0..4dad7b380 100644 --- a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestMetadataDDL.java +++ b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestMetadataDDL.java @@ -17,18 +17,17 @@ */ package org.apache.drill.jdbc.test; -import com.google.common.base.Function; -import org.apache.commons.io.FileUtils; -import org.apache.drill.exec.store.hive.HiveTestDataGenerator; -import org.junit.BeforeClass; -import org.junit.Test; +import static org.junit.Assert.assertTrue; -import java.io.File; import java.sql.Connection; import java.sql.ResultSet; import java.sql.Statement; -import static org.junit.Assert.assertTrue; +import org.apache.drill.exec.store.hive.HiveTestDataGenerator; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.google.common.base.Function; /** * Contains tests for diff --git a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestViews.java b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestViews.java index 17772b624..28fa4a75b 100644 --- a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestViews.java +++ b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestViews.java @@ -17,7 +17,12 @@ */ package org.apache.drill.jdbc.test; -import com.google.common.base.Function; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.Statement; import org.apache.commons.io.FileUtils; import org.apache.drill.exec.store.hive.HiveTestDataGenerator; @@ -26,12 +31,7 @@ import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test; -import java.io.File; -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.Statement; - -import static org.junit.Assert.assertTrue; +import com.google.common.base.Function; /** Contains tests for creating/droping and using views in Drill. */ public class TestViews extends JdbcTestQueryBase { |