Clone Tools
  • last updated 24 mins ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
DRILL-4452: Uses Apache Calcite Avatica driver vs Optiq driver for Drill JDBC

Drill JDBC driver uses Optiq Avatica as its basis, but this dependency has

been moved over to Calcite, for quite some time without Drill code being

updated for it.

This patch updates Avatica version to the version from Calcite

(1.4.0-drill-r19). It also refactors Drill JDBC driver to comply with the

packages and API changes in Avatica. Finally it fixes the the SQL types for

lists and structs, since Drill doesn't support java.sql.Array and

java.sql.Struct interfaces.

this closes #395

Change-Id: Ia608adf900e8708d9e6f6f58ed41e104321a9914

    • -0
    • +477
    ./java/org/apache/drill/jdbc/impl/DrillMetaImpl.java
  1. … 8 more files in changeset.
DRILL-4732: Update JDBC driver to use the new prepared statement APIs on DrillClient

this closes #532

  1. … 3 more files in changeset.
DRILL-3510: Add ANSI_QUOTES option so that Drill's SQL Parser will recognize ANSI_SQL identifiers

- added supporing of quoting identifiers with DOUBLE_QUOTES or BRACKETS via setting new

sys/sess EnumString option QUOTING_IDENTIFIERS;

- added possibility of setting QUOTING_IDENTIFIERS by the jdbc connection URL string;

- added relevant unit tests;

close #520

  1. … 19 more files in changeset.
DRILL-4184: Support variable length decimal fields in parquet

  1. … 68 more files in changeset.
DRILL-4382: Remove dependency on drill-logical from vector package

  1. … 80 more files in changeset.
DRILL-3987: (CLEANUP) Final cleanups to get complete working build/distribution

- small cleanups

- move Hook to drill-adbc

- update distribution assembly to include new modules

This closes #250

  1. … 30 more files in changeset.
DRILL-3927: use OutOfMemoryException in more places Some code cleanup required for the upcoming introduction of the rewritten direct memory allocator. Chiefly the introduction of OutOfMemoryException handling in a few spots, the use of DrillAutoCloseables for some allocator close() calls, and some other minor cleanup. - removed the exclusion of exec/work from the jdbc-all jar, because it now depends on OutOfMemoryException, and that is derived from FragmentSetupException and Foreman Exception

this closes #199

  1. … 14 more files in changeset.
DRILL-3766: Fix ResultSet.getRow() (make 1-based; return 0 at end).

Corrected for Avatica's non-JDBC-compliant behavior.

Also purged unused imports.

  1. … 1 more file in changeset.
DRILL-3778: Add missed part of DRILL-3160 (making JDBC Javadoc available).

This closes #158

Main:

Configured Javadoc generation (title, package groups, version in headers).

Added link to JDBC page in Drill documentation site.

Edited/fixed some JDBC Javadoc comments.

Added explicit SQLConversionOverflowException to throws clauses for Javadoc

effect.

Added some imports for Javadoc references.

Misc.:

Fixed a couple Javadoc syntax errors.

Fixed POM indentation.

    • -18
    • +30
    ./java/org/apache/drill/jdbc/DrillResultSet.java
    • -2
    • +8
    ./java/org/apache/drill/jdbc/package-info.java
  1. … 3 more files in changeset.
DRILL-3661: Update: Added a @link and a @code.

This closes #119

DRILL-3661: Update: Fixed "DRILL-xxxx" reference.

DRILL-2769: Fix most non-SQLException not-supported-yet exceptions.

Core:

Added (auto-scanning) unit test. [Drill2769UnsupportedReportsUseSqlExceptionTest]

Added translation of lots of UnsupportedOperationExceptions (and some

RuntimeExceptions) from Avatica code to SQLFeatureNotSupportedExceptions (tons

of method overrides).

Also:

Added explicit bounds checks in ResultSetMetaData methods and checking of

last-accessed column in DrillAccessorList.wasNull() (to fix other

RuntimeExceptions to SQLExceptions).

Added resetting of last-accessed column to fix latent bug in DrillAccessorList.

Hygiene:

- Renamed some zero-based index/ordinal-position parameters to "...Offset".

- Renamed some one-based index/ordinal-position parameters to "...Number".

- Renamed DrillAccessorList lastColumn to rowLastColumnOffset; declared

explicit logical null value for rowLastColumnOffset.

  1. … 1 more file in changeset.
DRILL-2489: Throw exception from remaining methods for closed JDBC objects.

Refactored unit test to check all methods per interface. (Replaced individual,

static test methods with bulk reflection-based checking.)

[Drill2489CallsAfterCloseThrowExceptionsTest]

Added DrillResultSetMetaDataImpl.

Added method overrides to check state for remaining methods from Connection,

Statement, PreparedStatement, ResultSet, ResultSetMetaData and DatabaseMetaData.

Also:

- renamed checkNotClosed to throwIfClosed.

    • -0
    • +198
    ./java/org/apache/drill/jdbc/impl/DrillResultSetMetaDataImpl.java
  1. … 4 more files in changeset.
DRILL-3661: Edit JDBC doc. for clarity, more consistency, bug fixes.

Also fixed two serialVersionUID literals.

    • -11
    • +22
    ./java/org/apache/drill/jdbc/DrillResultSet.java
    • -2
    • +4
    ./java/org/apache/drill/jdbc/DrillStatement.java
    • -2
    • +2
    ./java/org/apache/drill/jdbc/Driver.java
  1. … 13 more files in changeset.
DRILL-3589: Update JDBC driver to shade and minimize dependencies.

Update build process to use shading, stop using Proguard.

Add simple integration test that verifies that the JDBC driver works

correctly with a clean classpath.

    • -10
    • +4
    ./java/org/apache/drill/jdbc/Driver.java
  1. … 9 more files in changeset.
DRILL-3347: VARCHAR ResultSet.getObject returned ...hadoop.io.Text, not String.

this closes #144

Core fix:

- Fixed {,Nullable}VarCharAccessor's getObject() to return String instead of

value vector's internal org.apache.hadoop.io.Text.

- Updated unit tests (to expect only String now).

[DatabaseMetaDataGetColumnsTest, ResultSetMetaDataTest]

Also Added getObject check in tracing proxy test. [TracingProxyDriverTest]

Changed hard references to Hadoop's Text and JodaTime's Period to strings in

warning check in tracing proxy. [InvocationReporterImpl]

Cleanup:

- Added @Override annotations. [SqlAccessors]

- (Unintentionally) fixed (undetected) missing comma. [ValueVectorTypes.tdd]

    • -0
    • +2
    ./java/org/apache/drill/jdbc/impl/MetaImpl.java
  1. … 5 more files in changeset.
DRILL-3598: use a factory to create the root allocator. - made the constructor for TopLevelAllocator package private to enforce this

Delete a test that had been commented out for over a year, it no longer compiles due to interface changes and there is plenty of other testing for hash aggregate.

  1. … 43 more files in changeset.
DRILL-3566: Fix: PreparedStatement.executeQuery() got ClassCastException.

Main:

Restored DrillResultSetImpl(...)'s statement parameter from overly

restrictive DrillStatementImpl to AvaticaStatement and removed caller

cast that was throwing. (Relatedly, adjusted getStatement() and moved

internal casting from statement to connection.)

Added basic test of querying via PreparedStatement. [PreparedStatementTest]

Added some case test of statement-creation methods. [ConnectionTest]

Removed now-unneeded DrillPrepareResult cast.

Eliminated redundant getConnection() and getClient calls, intermediate variables, etc.

Fixed comment error.

this closes #143

  1. … 3 more files in changeset.
DRILL-3153: Fix JDBC's getIdentifierQuoteString() to report Drill's backquote.

Added override of Avatica's default implementation returning SQL

standard value. Added Javadoc. Added unit test.

Also moved unit test for nullsAreSortedXxx methods.

DRILL-3153: Update: Comment fixes and whitespace only.

Close apache/drill#99

  1. … 2 more files in changeset.
DRILL-3151: Fix many ResultSetMetaData method return values.

Added ~unit test for ResultSetMetaData implementation.

Made getObject return classes available to implementation of getColumnClassName:

- Added SqlAccessor.getObjectClass() (to put that metadata right next to code

to which it corresponds rather than in far-away parallel code).

- Added similar AvaticaDrillSqlAccessor.getObjectClass().

- Changed DrillAccessorList.accessors from Accessor[] to

AvaticaDrillSqlAccessor[] for better access to JDBC getObject return class.

- Extracted return classes from accessors to pass to updateColumnMetaData.

Reworked some data type mapping and utilities:

- Added Added Types.getSqlTypeName(...).

- Renamed Types.getJdbcType(...) to getJdbcTypeCode(...)

- Replaced Types.isUnSigned with isJdbcSignedType.

- Fixed various bogus RPC-type XXX -> java.sql.Types.SMALLINT mappings.

- Removed DrillColumnMetaDataList.getJdbcTypeName.

- Moved getAvaticaType up (for bottom-up order).

- Revised DrillColumnMetaDataList.getAvaticaType(...).

MAIN:

- Updated updateColumnMetaData(...) to change many calculations of metadata

input to ColumnMetaData construction. [DrillColumnMetaDataList]

Updated other metadata tests per changes.

  1. … 11 more files in changeset.
DRILL-2494: Have PreparedStmt. set-param. methods throw "unsupported".

Added (integration-level) unit test.

Modified set-parameter methods to throw SQLFeatureNotSupportedException.

(Intercepted common getParameter method.)

Inserted DrillPreparedStatement into hierarchy for place for documentation.

Documented that parameter-setting methods are not supported.

  1. … 1 more file in changeset.
DRILL-3285: Part 3--Invert beforeFirstBatch -> ! afterFirstBatch.

DRILL-3285: Part 2--Renaming.

Renamed state/control-flow members:

- started -> initialSchemaLoaded

- first -> beforeFirstBatch

- redoFirstNext -> returnTrueForNextCallToNext

- finished -> afterLastRow

Renamed other items:

- changed -> schemaChanged

- currentBatch -> currentBatchHolder

- DrillResultSet's currentBatch -> batchLoader

DRILL-3285: Part 4--Reorder fields, updateColumns.

DRILL-3285: Part 1--Prep., Hygiene: Mainly, adding comments.

Added/edited comments:

- field doc. comments

- method doc. comments

- branch/block comments

Removed unused recordBatchCount and getRecordBatchCount().

Added logger call for spurious batch.

Various cleanup:

- Cleaned up logger.

- Added "final" on updateColumns().

- Wrapped some lines

- Misc. comment whitespace.

DRILL-3285: Part 5--Split old hacky next() into separate methods.

Split the original public next() method (which was hacked to handle an extra,

initial call to read the schema batch) into:

- new loadInitialSchema() (for handling the call for the schema)

- modified next() (for handling normal calls from ResultSet.next())

- new private nextRowInternally() (for common code)

Pulled invariant afterFirstBatch up out of bogus-batch loop.

DRILL-3262: Rename DrillDatabaseMetaData -> DrillDatabaseMetaDataImpl.

Renamed org.apache.drill.jdbc.impl.DrillDatabaseMetaData to

org.apache.drill.jdbc.impl.DrillDatabaseMetaDataImpl (re creating

org.apache.drill.jdbc.DrillDatabaseMetaDataImpl for DRILL-3198).

[DrillDatabaseMetaData -> DrillDatabaseMetaDataImpl, DrillJdbc41Factory]

    • -0
    • +118
    ./java/org/apache/drill/jdbc/impl/DrillDatabaseMetaDataImpl.java
DRILL-3198: Fix: DatabaseMetaData.getTypeInfo(...), etc., return null.

Fixed DatabaseMetaData.getTypeInfo(...) and similar methods enough to not return

null. (Each method now returns a ResultSet representing a result set with zero

rows, though not with JDBC-specified columns.)

- Changed utility method getEmptyResult().

- Added basic test methods.

- Added interface DrillDatabaseMetaData (for place to document current

Drill-specific behavior).

- Added Javadoc for current behavior.

    • -1
    • +2
    ./java/org/apache/drill/jdbc/DrillResultSet.java
    • -5
    • +15
    ./java/org/apache/drill/jdbc/impl/MetaImpl.java
  1. … 1 more file in changeset.
DRILL-3216: Part 2--Fix existing(+) INFORMATION_SCHEMA.COLUMNS columns.

Added unit test. [TempInformationSchemaColumnsTest]

Fixed/added INFORMATION_SCHEMA.COLUMNS columns:

- Changed -1 to NULL.

- Moved column NUMERIC_PRECISION to correct position.

- Fixed column ORDINAL_POSITION from 0-based to 1-based.

- Moved CHAR length to column CHARACTER_MAXIMUM_LENGTH.

- Moved BINARY and VARBINARY length to columnCHARACTER_MAXIMUM_LENGTH.

- Added precision and scale values for integer types and floating-point types.

- Added column COLUMN_DEFAULT.

- Added column CHARACTER_OCTET_LENGTH.

- Added column DATETIME_PRECISION.

- Added column INTERVAL_TYPE.

- Added column INTERVAL_PRECISION.

- Fixed column DATA_TYPE to correct form of type names:

- "INTERVAL_..." -> "INTERVAL"

- short (e.g., "CHAR") to specified (e.g., "CHARACTER")

Applied COLUMNS to JDBC DatabaseMetaData.getColumns() implementation:

- Changed some getColumns() result values:

- type names (DATA_TYPE changes)

- precision radix for some cases

- Adapted existing uses of COLUMNS data.

- Applied new COLUMNS data (e.g., interval precision).

- Updated getColumns() test (re changed result values).

- Augmented getColumns() test (e.g., more intervals).

Updated other tests using INFORMATION_SCHEMA.COLUMNS:

- -1 -> NULL

- integer types have precision and scale values

- "CHAR" -> "CHARACTER", etc.

[TestInfoSchema, TestInfoSchemaOnHiveStorage, TestInformationSchemaColumns,

TestViewSupport]

    • -214
    • +122
    ./java/org/apache/drill/jdbc/impl/MetaImpl.java
  1. … 8 more files in changeset.
DRILL-3216: Part 1--Pre-core code hygiene.

Many-instance changes: [DatabaseMetaDataGetColumnsTest]

- Renamed "...opt..." columns and methods to match "...mdrOpt" variables.

- Renamed "...req..." columns and methods to match "...mdrReq" variables.

- Renamed "testRow..." variables to "mdrUnk".

- Added/applied getIntOrNull(...) especially to simplify null cases.

- Put REAL, FLOAT, and DOUBLE in that order (smallest, ~variable, largest).

- (Edited "nullability code" -> "nullability code:".)

Renamed "type" -> "relDataType"; "sqlType" -> "sqlTypeName".

Changed "dfs_test.tmp" -> VIEW_SCHEMA.

Re-aligned query SQL.

Added 2 "final".

Edited 3253 (test plugin) TODOs.

Purged several comments.

Wrapped some lines.

    • -9
    • +11
    ./java/org/apache/drill/jdbc/impl/MetaImpl.java
  1. … 2 more files in changeset.