From 5d9013ce62e37fef71801a62b4ee0c15691a99ad Mon Sep 17 00:00:00 2001 From: Rafael Telles Date: Tue, 2 Nov 2021 14:15:54 -0300 Subject: [PATCH] Refactor ArrowDatabaseMetadata tests (#177) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Flight SQL Ratification Based On Community Feedback #7 (#98) * Remove scope from 'hamcrest' dependency on java/pom.xml * Use flight top-level module on parent pom.xml instead of declaring each one * Avoid using getStatement inside StatementContext methods * Make StatementContext.getQuery() return String * Minor fixes on pom.xml * Move 'os-maven-plugin' to parent pom.xml * Update protobuf generation on pom.xml files * Use ClassLoader#getResource to get network.properties on TestFlightSql * Bind to any ephemeral port on TestFlightSql * Move JDBC-Arrow type default conversion from JdbcToArrowConfig to JdbcToArrowUtils * Micro-optimization: initialize ArrayList with the right size * Fix null-check on PreparedStatement#setParameters * Avoid wrapping vector into a ImmutableList and then into an ArrayList on FlightSqlExample#getTablesRoot * Remove null-check on VectorSchemaRoot on FlightSqlClient#setParameters() * Remove the need of separate cache for ResultSets * Add missing 'final' modifiers * Fix maven build from different directories (#114) * Add CrossReference methods to SqlProducer * Clean-up: remove boilerplate code by replacing with tools provided by Arrow Flight JDBC Adapter * Fix checkstyle and dependency management errors * Ignore broken tests * Fix broken tests for CreatePreparedStatement * Fix Schema generation not setting an unknown column type to nullable * Change FlightSqlProducer from abstract class to interface * Refactor tests due to creation of new column of primaryKey * Nit: fix checkstyle * Fix leaking connections on connection pool * [WIP] FlightSQL Ratification based on Community Comments (#73) * Move FlightSql examples to their own subpackage * Fix checkstyle issues * fix: change Status use to CallStatus * Remove unnecessary overhead of wrapping nullable objects into Optionals for the sole purpose of null-checking * Replace Guava's Preconditions with the ones provided by Apache * Fix typo in FlightSql.proto * Fix ordering of schema for FlightSql.proto * Explain why reserved range of IDs for GetSqlInfo is not entirely in use * Add comment to CommandGetTables to explain the encoding of table_schema * Remove redundat information on schemas * Fixed Javadoc on some methods, added Thread interrupt to executeUpdate methods, and updated Signal exceptions to CallStatus with description * Replace int32 with uint32 for GetSqlInfo name representation * Replace AssertionError with StatusRuntimeException for whenever attempting to unpack an invalid protobuf message * add comment to FlightSql.proto to update_rule and delete_rule * Replace inconsistent exception handling with CallStatus predetermined exceptions * correct comment to CreatePreparedStatement on FlightSql.proto * Remove unused dependencies * fix: change Status use to CallStatus on FlightSqlProducer * Changed from if not null check to Objects requireNonNull on Flight SQL Client * Remove Nullable annotation * Changed from checkNotNull to Objects#requireNotNull with description on Flight SQL Example * Add CallOptions to every RPC call by the client * Fix Maven dependency problems and checkstyle violations * Replace generic Collections with Lists when order matters in an RPC call * Fix Javadoc for FlightSqlClient * Add description to StatusRuntimeExceptions * Add descriptions to Exceptions * Correct update_rule and delete_rule description on FlighSql.proto * Verify wheter Root is empty before sending request to server * Add call options to PreparedStatement * Replace constant checking of whether client is open with #checkOpen * Add CallOptions to #close for PreparedStatement * Refactor PreparedStatement usages of CallOptions * Fix broken tests * Fix FlightSql.proto documentation * Update documentation for format/FlightSql.proto Co-authored-by: kylep-dremio <38920967+kylep-dremio@users.noreply.github.com> * Fix checkstyle violations * Require non null tables for GetExportedKeys and GetImportedKeys * Not storing CallOptions in PreparedStatement * Update documentation comments for protobuf * Replace IntVector for UInt1Vector for delete_rule and update_rule * Fix protobuf for FlightSQL * Fix bug with empty metadata * Update update_rule and delete_rule documentation on proto * Remove explicit dependency on JDBC's DatabaseMetaData on UpdateDeleteRules * Use MessageOptions instead of FieldOptions on proto * Add missing JavaDoc about 'options' parameter * Fix CommandGetSqlInfo documentation * Add @throws to FlightSqlClient#checkOpen JavaDoc Co-authored-by: Juscelino Junior Co-authored-by: Vinicius Fraga Co-authored-by: Rafael Telles Co-authored-by: kylep-dremio <38920967+kylep-dremio@users.noreply.github.com> * Create a module for keeping all Arrow Flight-related submodules * Fix checkstyle violations in Arrow Flight JDBC Driver * Create a module for keeping all Arrow Flight-related submodules * Fix checkstyle violations in Arrow Flight JDBC Driver * Fix Minor POM Issues to allow Maven build (#161) * Fix minor POM Issues to allow Maven Build * Revert Flight SQL POM State * Remove unused imports Co-authored-by: Rafael Telles * Ignore broken tests * Refactor tests due to creation of new column of primaryKey * Create a module for keeping all Arrow Flight-related submodules * Fix checkstyle violations in Arrow Flight JDBC Driver * Create a module for keeping all Arrow Flight-related submodules * Fix checkstyle violations in Arrow Flight JDBC Driver * [FlightRPC] Flight SQL POC Add extensions in the Apache Arrow project’s Arrow Flight modules to provide a standard way for clients and servers to communicate with SQL-like semantics. Do not pull to master. A message to the mailing list will accompany this and another proposal in the coming days for discussion. * Update FlightSqlProducer to conform to new design. Rename files for SQL -> Sql. Correct compilation errors in client code, but design needs to be updated. Tests do not yet compile. * Correct the dense_union type for schema return of SQL info. Correct some additional SQL -> Sql file renames. Reduce the test compilation problems (still more to do). * Additional CR changes. Note - FlightSqlExample is not functional and needs to be updated. * Add support for primary and foreign keys. * Fix broken Maven build * Add Hamcrest as a root-level dependency * Create test for GetCatalogs * Update tests for GetTables * Fix test for GetTables * Enable support for includeSchema in GetTables * Fix checkstyle and dependency management errors * Remove boilerplate code for creating a new Schema by reusing default converter from JdbcToArrowConfig#DEFAULT_JDBC_TO_ARROW_TYPE_CONVERTER * WIP: Working on fixing data consistency issue where catalog is null in some parts and "" in others * Implement FlightSqlExample's GetPrimaryKey command * WIP: Add support for GetCatalogs: GetFlightInfoCatalogs * WIP: Add support for GetCatalogs: GetStreamCatalogs * WIP: Add support for GetTableTypes: getFlightInfoTableTypes * WIP: Add support for GetTableTypes: getStreamTableTypes * Fix rebase conflicts * Minor refactor: apply DRY principle to repeated methods * Ignore broken tests * Fix broken tests for CreatePreparedStatement * Fix Schema generation not setting an unknown column type to nullable * Change FlightSqlProducer from abstract class to interface * Update FlightSql protobuf to allow nullable values as parameters for nullable fields * Start separating commandForeignKey into two new commands * Fix CheckStyle issues * Change empty string to null value * Implement CommandGetImportedKeys * Fix checkstyle violations * Minor refactor: remove unused methods * Implement FlightSqlClient.executeUpdate * Refactor the code to not use string when getting from cache * Nit: fix checkstyle * Fix conflicts between tests for creating a new statement and checking its schema * Minor refactor: remove unused fields @ FlightSqlUtils * Fix wrong StreamListener usages and multiple instances of RootAllocators * Fix checkstyle * Modify execute preparedStatement flow * Fix leaking connections on connection pool * Deal with query with parameter in the preparedStatement * Fix rebase issues with FlightSql.proto * Fix missing code on adapter/jdbc/JdbcToArrowUtils.java due to rebase issue * [WIP] FlightSQL Ratification based on Community Comments (#73) * Move FlightSql examples to their own subpackage * Fix checkstyle issues * fix: change Status use to CallStatus * Remove unnecessary overhead of wrapping nullable objects into Optionals for the sole purpose of null-checking * Replace Guava's Preconditions with the ones provided by Apache * Fix typo in FlightSql.proto * Fix ordering of schema for FlightSql.proto * Explain why reserved range of IDs for GetSqlInfo is not entirely in use * Add comment to CommandGetTables to explain the encoding of table_schema * Remove redundat information on schemas * Fixed Javadoc on some methods, added Thread interrupt to executeUpdate methods, and updated Signal exceptions to CallStatus with description * Replace int32 with uint32 for GetSqlInfo name representation * Replace AssertionError with StatusRuntimeException for whenever attempting to unpack an invalid protobuf message * add comment to FlightSql.proto to update_rule and delete_rule * Replace inconsistent exception handling with CallStatus predetermined exceptions * correct comment to CreatePreparedStatement on FlightSql.proto * Remove unused dependencies * fix: change Status use to CallStatus on FlightSqlProducer * Changed from if not null check to Objects requireNonNull on Flight SQL Client * Remove Nullable annotation * Changed from checkNotNull to Objects#requireNotNull with description on Flight SQL Example * Add CallOptions to every RPC call by the client * Fix Maven dependency problems and checkstyle violations * Replace generic Collections with Lists when order matters in an RPC call * Fix Javadoc for FlightSqlClient * Add description to StatusRuntimeExceptions * Add descriptions to Exceptions * Correct update_rule and delete_rule description on FlighSql.proto * Verify wheter Root is empty before sending request to server * Add call options to PreparedStatement * Replace constant checking of whether client is open with #checkOpen * Add CallOptions to #close for PreparedStatement * Refactor PreparedStatement usages of CallOptions * Fix broken tests * Fix FlightSql.proto documentation * Update documentation for format/FlightSql.proto Co-authored-by: kylep-dremio <38920967+kylep-dremio@users.noreply.github.com> * Fix checkstyle violations * Require non null tables for GetExportedKeys and GetImportedKeys * Not storing CallOptions in PreparedStatement * Update documentation comments for protobuf * Replace IntVector for UInt1Vector for delete_rule and update_rule * Fix protobuf for FlightSQL * Fix bug with empty metadata * Update update_rule and delete_rule documentation on proto * Remove explicit dependency on JDBC's DatabaseMetaData on UpdateDeleteRules * Use MessageOptions instead of FieldOptions on proto * Add missing JavaDoc about 'options' parameter * Fix CommandGetSqlInfo documentation * Add @throws to FlightSqlClient#checkOpen JavaDoc Co-authored-by: Juscelino Junior Co-authored-by: Vinicius Fraga Co-authored-by: Rafael Telles Co-authored-by: kylep-dremio <38920967+kylep-dremio@users.noreply.github.com> * FlightSQL Ratification based on Community Comments (round 2) (#85) * Remove unused client_execution_handler from Protobuf * Update documentation on CommandGetPrimaryKeys * Update documentation on CommandGetImportedKeys and CommandGetExportedKeys * Change exception type on FlightSqlClient#executeUpdate * Add @return to FlightSqlClient#executeUpdate JavaDoc * Switch order of key_name and key_sequence on CommandGetTableKeys documentation * Update JavaDoc for FlIghtSqlClient#clearParameters * Add private constructor to FlightSqlProducer.SqlInfo * Update JavaDoc for FlIghtSqlClient#clearParameters * Fix wrong CommandGetPrimaryKeys documentation on Proto file * Fix order of key_name and key_sequence * Split CommandStatementQuery in 2 messages, one for Command and other for Ticket * Fix leaking Connections on FlightSqlExample * Remove unused variable of cache * Flight SQL Ratification Based On Community Feedback #5 (#91) * Delegate GetSchemaImportedKeys * Remove schema retrieval methods for catalog functions and delegate to constants * Add IPC encapsulation to Schema serialization * Fix checkstyle violations * Update javadoc for FlightSqlClient * Update documentation for FlightSql.proto Co-authored-by: Abner Eduardo Ferreira * Flight SQL Ratification Based On Community Feedback #6 (#94) * Refactored FlightSql Statement Constant names * Defined non-nullable parameters for FlightSql proto * Resolved minimal checkstyle issues * Added further documentation for catalog and schema * Refactored FlightSql proto comments to include more information * Added Field/FieldType notNullable methods * Refactored FlightSqlClient and FlightSqlExample to leverage Field notNullable method * Removed opaque query warning from FlightSql proto * Added the optional tag for the returned schema of getTables to proto * Flight SQL Ratification Based On Community Feedback #7 (#98) * Remove scope from 'hamcrest' dependency on java/pom.xml * Use flight top-level module on parent pom.xml instead of declaring each one * Avoid using getStatement inside StatementContext methods * Make StatementContext.getQuery() return String * Minor fixes on pom.xml * Move 'os-maven-plugin' to parent pom.xml * Update protobuf generation on pom.xml files * Use ClassLoader#getResource to get network.properties on TestFlightSql * Bind to any ephemeral port on TestFlightSql * Move JDBC-Arrow type default conversion from JdbcToArrowConfig to JdbcToArrowUtils * Micro-optimization: initialize ArrayList with the right size * Fix null-check on PreparedStatement#setParameters * Avoid wrapping vector into a ImmutableList and then into an ArrayList on FlightSqlExample#getTablesRoot * Remove null-check on VectorSchemaRoot on FlightSqlClient#setParameters() * Remove the need of separate cache for ResultSets * Add missing 'final' modifiers * Fix missing generated sources on built flight-sql jar (#101) * Bump protobuf version * Flight SQL Ratification Based On Community Feedback #8 (#113) * Change scope of arrow-memory-netty to test for flight-sql * Remove unused dependency arrow-memory-netty * Update common-pool2 and common-dbcp2 dependencies * Remove 'executions' from parent pom.xml for plugin protobuf-maven-plugin * Adjust protobuf-maven-plugin settings on pom.xml files * Move dep.protobuf.version and dep.grpc.version to top pom.xml * Remove from arrow-flight's pom.xml * Fix maven build from different directories (#114) * Add test cases for bitshifting operations required for filtering out some SqlInfo data * Fix Schema serialization and deserialization on Flight SQL methods * [FlightSQL] Add missing method for creating bitmask from GetSqlInfo option enum (#148) * Add util method for creating bitmask from multiple protobuf enums for FlightSql GetSqlInfo enum * Add test cases for utility method for creating bitmask from protobuf options * Make changes regarding to reviews Co-authored-by: Rafael Telles * Create a module for keeping all Arrow Flight-related submodules * Fix checkstyle violations in Arrow Flight JDBC Driver * Create a module for keeping all Arrow Flight-related submodules * Fix checkstyle violations in Arrow Flight JDBC Driver * WIP: Refactor SqlInfoProvider * WIP * WIP * WIP * Fix rebase issues * Restore FlightSql.proto state * Fix checkstyle * Fix rebase colateral * Restore FlightSql.proto Co-authored-by: Jose Almeida Co-authored-by: Abner Eduardo Ferreira Co-authored-by: Juscelino Junior Co-authored-by: Vinicius Fraga Co-authored-by: kylep-dremio <38920967+kylep-dremio@users.noreply.github.com> Co-authored-by: Vinicius Fraga <62815192+vfraga@users.noreply.github.com> Co-authored-by: Ryan Nicholson Co-authored-by: Kyle Porter --- .../driver/jdbc/ArrowDatabaseMetadata.java | 4 +- .../jdbc/ArrowDatabaseMetadataTest.java | 582 ++++-------------- .../test/adhoc/MockFlightSqlProducer.java | 54 +- .../DatabaseMetadataDenseUnionUtils.java | 258 -------- 4 files changed, 137 insertions(+), 761 deletions(-) delete mode 100644 java/flight/flight-jdbc-driver/src/test/java/org/apache/arrow/driver/jdbc/utils/DatabaseMetadataDenseUnionUtils.java diff --git a/java/flight/flight-jdbc-driver/src/main/java/org/apache/arrow/driver/jdbc/ArrowDatabaseMetadata.java b/java/flight/flight-jdbc-driver/src/main/java/org/apache/arrow/driver/jdbc/ArrowDatabaseMetadata.java index 2728e811297d5..fe8dde17dacfa 100644 --- a/java/flight/flight-jdbc-driver/src/main/java/org/apache/arrow/driver/jdbc/ArrowDatabaseMetadata.java +++ b/java/flight/flight-jdbc-driver/src/main/java/org/apache/arrow/driver/jdbc/ArrowDatabaseMetadata.java @@ -764,8 +764,8 @@ public ResultSet getExportedKeys(final String catalog, final String schema, fina } @Override - public ResultSet getCrossReference(String parentCatalog, String parentSchema, String parentTable, - String foreignCatalog, String foreignSchema, String foreignTable) + public ResultSet getCrossReference(final String parentCatalog, final String parentSchema, final String parentTable, + final String foreignCatalog, final String foreignSchema, final String foreignTable) throws SQLException { final ArrowFlightConnection connection = getConnection(); final FlightInfo flightInfoCrossReference = connection.getClientHandler().getCrossReference( diff --git a/java/flight/flight-jdbc-driver/src/test/java/org/apache/arrow/driver/jdbc/ArrowDatabaseMetadataTest.java b/java/flight/flight-jdbc-driver/src/test/java/org/apache/arrow/driver/jdbc/ArrowDatabaseMetadataTest.java index 794e815c4f5d3..783abd7b5dd90 100644 --- a/java/flight/flight-jdbc-driver/src/test/java/org/apache/arrow/driver/jdbc/ArrowDatabaseMetadataTest.java +++ b/java/flight/flight-jdbc-driver/src/test/java/org/apache/arrow/driver/jdbc/ArrowDatabaseMetadataTest.java @@ -27,16 +27,10 @@ import static java.util.stream.Collectors.toList; import static java.util.stream.IntStream.range; import static org.apache.arrow.driver.jdbc.test.adhoc.MockFlightSqlProducer.serializeSchema; -import static org.apache.arrow.driver.jdbc.utils.DatabaseMetadataDenseUnionUtils.setDataForBigIntField; -import static org.apache.arrow.driver.jdbc.utils.DatabaseMetadataDenseUnionUtils.setDataForBooleanField; -import static org.apache.arrow.driver.jdbc.utils.DatabaseMetadataDenseUnionUtils.setDataForIntField; -import static org.apache.arrow.driver.jdbc.utils.DatabaseMetadataDenseUnionUtils.setDataForUtf8Field; -import static org.apache.arrow.driver.jdbc.utils.DatabaseMetadataDenseUnionUtils.setDataVarCharListField; -import static org.apache.arrow.driver.jdbc.utils.DatabaseMetadataDenseUnionUtils.setIntToIntListMapField; import static org.apache.arrow.flight.sql.impl.FlightSql.CommandGetCrossReference; -import static org.apache.arrow.flight.sql.impl.FlightSql.SqlOuterJoinsSupportLevel; -import static org.apache.arrow.flight.sql.impl.FlightSql.SqlSupportedGroupBy; -import static org.apache.arrow.flight.sql.util.SqlInfoOptionsUtils.createBitmaskFromEnums; +import static org.apache.arrow.flight.sql.impl.FlightSql.SqlSupportsConvert.SQL_CONVERT_BIGINT_VALUE; +import static org.apache.arrow.flight.sql.impl.FlightSql.SqlSupportsConvert.SQL_CONVERT_BIT_VALUE; +import static org.apache.arrow.flight.sql.impl.FlightSql.SqlSupportsConvert.SQL_CONVERT_INTEGER_VALUE; import static org.hamcrest.CoreMatchers.is; import java.sql.Connection; @@ -46,19 +40,18 @@ import java.sql.SQLException; import java.util.Arrays; import java.util.Collections; -import java.util.EnumSet; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.function.Consumer; -import java.util.function.ObjIntConsumer; import org.apache.arrow.driver.jdbc.test.FlightServerTestRule; import org.apache.arrow.driver.jdbc.test.adhoc.MockFlightSqlProducer; import org.apache.arrow.driver.jdbc.utils.ResultSetTestUtils; import org.apache.arrow.flight.FlightProducer.ServerStreamListener; import org.apache.arrow.flight.sql.FlightSqlProducer.Schemas; +import org.apache.arrow.flight.sql.impl.FlightSql; import org.apache.arrow.flight.sql.impl.FlightSql.CommandGetCatalogs; import org.apache.arrow.flight.sql.impl.FlightSql.CommandGetExportedKeys; import org.apache.arrow.flight.sql.impl.FlightSql.CommandGetImportedKeys; @@ -66,15 +59,6 @@ import org.apache.arrow.flight.sql.impl.FlightSql.CommandGetSchemas; import org.apache.arrow.flight.sql.impl.FlightSql.CommandGetTableTypes; import org.apache.arrow.flight.sql.impl.FlightSql.CommandGetTables; -import org.apache.arrow.flight.sql.impl.FlightSql.SqlInfo; -import org.apache.arrow.flight.sql.impl.FlightSql.SqlSupportedElementActions; -import org.apache.arrow.flight.sql.impl.FlightSql.SqlSupportedPositionedCommands; -import org.apache.arrow.flight.sql.impl.FlightSql.SqlSupportedResultSetType; -import org.apache.arrow.flight.sql.impl.FlightSql.SqlSupportedUnions; -import org.apache.arrow.flight.sql.impl.FlightSql.SqlSupportsConvert; -import org.apache.arrow.flight.sql.impl.FlightSql.SqlTransactionIsolationLevel; -import org.apache.arrow.flight.sql.impl.FlightSql.SupportedAnsi92SqlGrammarLevel; -import org.apache.arrow.flight.sql.impl.FlightSql.SupportedSqlGrammar; import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.memory.RootAllocator; import org.apache.arrow.util.AutoCloseables; @@ -100,6 +84,7 @@ import org.junit.rules.ErrorCollector; import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; import com.google.protobuf.Message; /** @@ -313,12 +298,15 @@ public class ArrowDatabaseMetadataTest { @BeforeClass public static void setUpBeforeClass() throws SQLException { connection = FLIGHT_SERVER_TEST_RULE.getConnection(); + final Message commandGetCatalogs = CommandGetCatalogs.getDefaultInstance(); final Consumer commandGetCatalogsResultProducer = listener -> { try (final BufferAllocator allocator = new RootAllocator(); - final VectorSchemaRoot root = VectorSchemaRoot.create(Schemas.GET_CATALOGS_SCHEMA, allocator)) { + final VectorSchemaRoot root = VectorSchemaRoot.create(Schemas.GET_CATALOGS_SCHEMA, + allocator)) { final VarCharVector catalogName = (VarCharVector) root.getVector("catalog_name"); - range(0, ROW_COUNT).forEach(i -> catalogName.setSafe(i, new Text(format("catalog #%d", i)))); + range(0, ROW_COUNT).forEach( + i -> catalogName.setSafe(i, new Text(format("catalog #%d", i)))); root.setRowCount(ROW_COUNT); listener.start(root); listener.putNext(); @@ -333,9 +321,11 @@ public static void setUpBeforeClass() throws SQLException { final Message commandGetTableTypes = CommandGetTableTypes.getDefaultInstance(); final Consumer commandGetTableTypesResultProducer = listener -> { try (final BufferAllocator allocator = new RootAllocator(); - final VectorSchemaRoot root = VectorSchemaRoot.create(Schemas.GET_TABLE_TYPES_SCHEMA, allocator)) { + final VectorSchemaRoot root = VectorSchemaRoot.create(Schemas.GET_TABLE_TYPES_SCHEMA, + allocator)) { final VarCharVector tableType = (VarCharVector) root.getVector("table_type"); - range(0, ROW_COUNT).forEach(i -> tableType.setSafe(i, new Text(format("table_type #%d", i)))); + range(0, ROW_COUNT).forEach( + i -> tableType.setSafe(i, new Text(format("table_type #%d", i)))); root.setRowCount(ROW_COUNT); listener.start(root); listener.putNext(); @@ -350,7 +340,8 @@ public static void setUpBeforeClass() throws SQLException { final Message commandGetTables = CommandGetTables.getDefaultInstance(); final Consumer commandGetTablesResultProducer = listener -> { try (final BufferAllocator allocator = new RootAllocator(); - final VectorSchemaRoot root = VectorSchemaRoot.create(Schemas.GET_TABLES_SCHEMA_NO_SCHEMA, allocator)) { + final VectorSchemaRoot root = VectorSchemaRoot.create( + Schemas.GET_TABLES_SCHEMA_NO_SCHEMA, allocator)) { final VarCharVector catalogName = (VarCharVector) root.getVector("catalog_name"); final VarCharVector schemaName = (VarCharVector) root.getVector("schema_name"); final VarCharVector tableName = (VarCharVector) root.getVector("table_name"); @@ -376,7 +367,8 @@ public static void setUpBeforeClass() throws SQLException { .build(); final Consumer commandGetTablesWithSchemaResultProducer = listener -> { try (final BufferAllocator allocator = new RootAllocator(); - final VectorSchemaRoot root = VectorSchemaRoot.create(Schemas.GET_TABLES_SCHEMA, allocator)) { + final VectorSchemaRoot root = VectorSchemaRoot.create(Schemas.GET_TABLES_SCHEMA, + allocator)) { final byte[] filledTableSchemaBytes = copyFrom( serializeSchema(new Schema(Arrays.asList( @@ -505,402 +497,91 @@ public static void setUpBeforeClass() throws SQLException { }; FLIGHT_SQL_PRODUCER.addCatalogQuery(commandGetPrimaryKeys, commandGetPrimaryKeysResultProducer); - final ObjIntConsumer flightSqlServerNameProvider = - (root, index) -> - setDataForUtf8Field(root, index, SqlInfo.FLIGHT_SQL_SERVER_NAME, EXPECTED_DATABASE_PRODUCT_NAME); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.FLIGHT_SQL_SERVER_NAME, flightSqlServerNameProvider); - - final ObjIntConsumer flightSqlServerVersionProvider = - (root, index) -> - setDataForUtf8Field(root, index, SqlInfo.FLIGHT_SQL_SERVER_VERSION, EXPECTED_DATABASE_PRODUCT_VERSION); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.FLIGHT_SQL_SERVER_VERSION, flightSqlServerVersionProvider); - - final ObjIntConsumer flightSqlIdentifierQuoteCharProvider = - (root, index) -> - setDataForUtf8Field(root, index, SqlInfo.SQL_IDENTIFIER_QUOTE_CHAR, EXPECTED_IDENTIFIER_QUOTE_STRING); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_IDENTIFIER_QUOTE_CHAR, flightSqlIdentifierQuoteCharProvider); - - final ObjIntConsumer flightSqlServerReadOnlyProvider = - (root, index) -> - setDataForBooleanField(root, index, SqlInfo.FLIGHT_SQL_SERVER_READ_ONLY, EXPECTED_IS_READ_ONLY); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.FLIGHT_SQL_SERVER_READ_ONLY, flightSqlServerReadOnlyProvider); - - final ObjIntConsumer flightSqlKeywordsProvider = - (root, index) -> setDataVarCharListField(root, index, SqlInfo.SQL_KEYWORDS, - EXPECTED_SQL_KEYWORDS.split("\\s*,\\s*")); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_KEYWORDS, flightSqlKeywordsProvider); - - final ObjIntConsumer flightSqlNumericFunctionsProvider = - (root, index) -> setDataVarCharListField(root, index, SqlInfo.SQL_NUMERIC_FUNCTIONS, - EXPECTED_NUMERIC_FUNCTIONS.split("\\s*,\\s*")); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_NUMERIC_FUNCTIONS, flightSqlNumericFunctionsProvider); - - final ObjIntConsumer flightSqlStringFunctionsProvider = - (root, index) -> setDataVarCharListField(root, index, SqlInfo.SQL_STRING_FUNCTIONS, - EXPECTED_STRING_FUNCTIONS.split("\\s*,\\s*")); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_STRING_FUNCTIONS, flightSqlStringFunctionsProvider); - - final ObjIntConsumer flightSqlSystemFunctionsProvider = - (root, index) -> setDataVarCharListField(root, index, SqlInfo.SQL_SYSTEM_FUNCTIONS, - EXPECTED_SYSTEM_FUNCTIONS.split("\\s*,\\s*")); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_SYSTEM_FUNCTIONS, flightSqlSystemFunctionsProvider); - - final ObjIntConsumer flightSqlTimeDateFunctionsProvider = - (root, index) -> - setDataVarCharListField(root, index, SqlInfo.SQL_DATETIME_FUNCTIONS, - EXPECTED_TIME_DATE_FUNCTIONS.split("\\s*,\\s*")); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_DATETIME_FUNCTIONS, flightSqlTimeDateFunctionsProvider); - - final ObjIntConsumer flightSqlSearchStringEscapeProvider = - (root, index) -> - setDataForUtf8Field(root, index, SqlInfo.SQL_SEARCH_STRING_ESCAPE, EXPECTED_SEARCH_STRING_ESCAPE); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_SEARCH_STRING_ESCAPE, flightSqlSearchStringEscapeProvider); - - final ObjIntConsumer flightSqlExtraNamesCharacterProvider = - (root, index) -> - setDataForUtf8Field(root, index, SqlInfo.SQL_EXTRA_NAME_CHARACTERS, EXPECTED_EXTRA_NAME_CHARACTERS); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_EXTRA_NAME_CHARACTERS, flightSqlExtraNamesCharacterProvider); - - final ObjIntConsumer flightSqlSupportsColumnAliasingProvider = - (root, index) -> setDataForBooleanField(root, index, SqlInfo.SQL_SUPPORTS_COLUMN_ALIASING, - EXPECTED_SUPPORTS_COLUMN_ALIASING); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_SUPPORTS_COLUMN_ALIASING, flightSqlSupportsColumnAliasingProvider); - - final ObjIntConsumer flightSqlNullPlusNullIsNullProvider = - (root, index) -> setDataForBooleanField(root, index, SqlInfo.SQL_NULL_PLUS_NULL_IS_NULL, - EXPECTED_NULL_PLUS_NULL_IS_NULL); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_NULL_PLUS_NULL_IS_NULL, flightSqlNullPlusNullIsNullProvider); - - final ObjIntConsumer flightSqlSupportsConvertProvider = - (root, index) -> setIntToIntListMapField(root, index, SqlInfo.SQL_SUPPORTS_CONVERT, - SqlSupportsConvert.SQL_CONVERT_BIT_VALUE, - new int[] {SqlSupportsConvert.SQL_CONVERT_INTEGER_VALUE, SqlSupportsConvert.SQL_CONVERT_BIGINT_VALUE}); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_SUPPORTS_CONVERT, flightSqlSupportsConvertProvider); - - final ObjIntConsumer flightSqlSupportsTableCorrelationNamesProvider = - (root, index) -> setDataForBooleanField(root, index, SqlInfo.SQL_SUPPORTS_TABLE_CORRELATION_NAMES, - EXPECTED_SUPPORTS_TABLE_CORRELATION_NAMES); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_SUPPORTS_TABLE_CORRELATION_NAMES, - flightSqlSupportsTableCorrelationNamesProvider); - - final ObjIntConsumer flightSqlSupportsDifferentTableCorrelationNamesProvider = - (root, index) -> setDataForBooleanField(root, index, SqlInfo.SQL_SUPPORTS_DIFFERENT_TABLE_CORRELATION_NAMES, - EXPECTED_SUPPORTS_DIFFERENT_TABLE_CORRELATION_NAMES); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_SUPPORTS_DIFFERENT_TABLE_CORRELATION_NAMES, - flightSqlSupportsDifferentTableCorrelationNamesProvider); - - final ObjIntConsumer flightSqlSupportsExpressionsInOrderByProvider = - (root, index) -> setDataForBooleanField(root, index, SqlInfo.SQL_SUPPORTS_EXPRESSIONS_IN_ORDER_BY, - EXPECTED_EXPRESSIONS_IN_ORDER_BY); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_SUPPORTS_EXPRESSIONS_IN_ORDER_BY, - flightSqlSupportsExpressionsInOrderByProvider); - - final ObjIntConsumer flightSqlSupportsExpressionsInOrderByUnrelatedProvider = - (root, index) -> setDataForBooleanField(root, index, SqlInfo.SQL_SUPPORTS_ORDER_BY_UNRELATED, - EXPECTED_SUPPORTS_ORDER_BY_UNRELATED); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_SUPPORTS_ORDER_BY_UNRELATED, - flightSqlSupportsExpressionsInOrderByUnrelatedProvider); - - final ObjIntConsumer flightSqlSupportedGroupByProvider = - (root, index) -> setDataForIntField(root, index, SqlInfo.SQL_SUPPORTED_GROUP_BY, - (int) (createBitmaskFromEnums( - SqlSupportedGroupBy.SQL_GROUP_BY_UNRELATED))); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_SUPPORTED_GROUP_BY, flightSqlSupportedGroupByProvider); - - final ObjIntConsumer flightSqlSupportsLikeEscapeClauseProvider = - (root, index) -> setDataForBooleanField(root, index, SqlInfo.SQL_SUPPORTS_LIKE_ESCAPE_CLAUSE, - EXPECTED_SUPPORTS_LIKE_ESCAPE_CLAUSE); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_SUPPORTS_LIKE_ESCAPE_CLAUSE, flightSqlSupportsLikeEscapeClauseProvider); - - final ObjIntConsumer flightSqlSupportsNonNullableColumnsProvider = - (root, index) -> setDataForBooleanField(root, index, SqlInfo.SQL_SUPPORTS_NON_NULLABLE_COLUMNS, - EXPECTED_NON_NULLABLE_COLUMNS); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_SUPPORTS_NON_NULLABLE_COLUMNS, - flightSqlSupportsNonNullableColumnsProvider); - - final ObjIntConsumer flightSqlSupportedGrammarProvider = - (root, index) -> setDataForIntField(root, index, SqlInfo.SQL_SUPPORTED_GRAMMAR, - (int) (createBitmaskFromEnums(SupportedSqlGrammar.SQL_CORE_GRAMMAR, - SupportedSqlGrammar.SQL_MINIMUM_GRAMMAR))); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_SUPPORTED_GRAMMAR, flightSqlSupportedGrammarProvider); - - final ObjIntConsumer flightSqlANSI92EntryLevelProvider = - (root, index) -> setDataForIntField(root, index, SqlInfo.SQL_ANSI92_SUPPORTED_LEVEL, - (int) (createBitmaskFromEnums(SupportedAnsi92SqlGrammarLevel.ANSI92_ENTRY_SQL, - SupportedAnsi92SqlGrammarLevel.ANSI92_INTERMEDIATE_SQL))); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_ANSI92_SUPPORTED_LEVEL, flightSqlANSI92EntryLevelProvider); - - final ObjIntConsumer flightSqlSupportsIntegrityEnhancementFacilityProvider = - (root, index) -> setDataForBooleanField(root, index, SqlInfo.SQL_SUPPORTS_INTEGRITY_ENHANCEMENT_FACILITY, - EXPECTED_SUPPORTS_INTEGRITY_ENHANCEMENT_FACILITY); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_SUPPORTS_INTEGRITY_ENHANCEMENT_FACILITY, - flightSqlSupportsIntegrityEnhancementFacilityProvider); - - final ObjIntConsumer flightSqlSupportsOuterJoins = - (root, index) -> setDataForIntField(root, index, SqlInfo.SQL_OUTER_JOINS_SUPPORT_LEVEL, - (int) (createBitmaskFromEnums(SqlOuterJoinsSupportLevel.SQL_FULL_OUTER_JOINS))); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_OUTER_JOINS_SUPPORT_LEVEL, flightSqlSupportsOuterJoins); - - final ObjIntConsumer flightSqlSchemaTermProvider = - (root, index) -> setDataForUtf8Field(root, index, SqlInfo.SQL_SCHEMA_TERM, EXPECTED_SCHEMA_TERM); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_SCHEMA_TERM, flightSqlSchemaTermProvider); - - final ObjIntConsumer flightSqlCatalogTermProvider = - (root, index) -> setDataForUtf8Field(root, index, SqlInfo.SQL_CATALOG_TERM, EXPECTED_CATALOG_TERM); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_CATALOG_TERM, flightSqlCatalogTermProvider); - - final ObjIntConsumer flightSqlProcedureTermProvider = - (root, index) -> setDataForUtf8Field(root, index, SqlInfo.SQL_PROCEDURE_TERM, EXPECTED_PROCEDURE_TERM); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_PROCEDURE_TERM, flightSqlProcedureTermProvider); - - final ObjIntConsumer flightSqlCatalogAtStartProvider = - (root, index) -> - setDataForBooleanField(root, index, SqlInfo.SQL_CATALOG_AT_START, EXPECTED_CATALOG_AT_START); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_CATALOG_AT_START, flightSqlCatalogAtStartProvider); - - final ObjIntConsumer flightSqlSchemasSupportedActionsProvider = - (root, index) -> - setDataForIntField(root, index, SqlInfo.SQL_SCHEMAS_SUPPORTED_ACTIONS, - (int) (createBitmaskFromEnums(SqlSupportedElementActions.SQL_ELEMENT_IN_PROCEDURE_CALLS, - SqlSupportedElementActions.SQL_ELEMENT_IN_INDEX_DEFINITIONS))); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_SCHEMAS_SUPPORTED_ACTIONS, flightSqlSchemasSupportedActionsProvider); - - final ObjIntConsumer flightSqlCatalogSupportedActionsProvider = - (root, index) -> - setDataForIntField(root, index, SqlInfo.SQL_CATALOGS_SUPPORTED_ACTIONS, - (int) (createBitmaskFromEnums(SqlSupportedElementActions.SQL_ELEMENT_IN_INDEX_DEFINITIONS))); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_CATALOGS_SUPPORTED_ACTIONS, flightSqlCatalogSupportedActionsProvider); - - final ObjIntConsumer flightSqlSupportedPositionedCommandsProvider = - (root, index) -> - setDataForIntField(root, index, SqlInfo.SQL_SUPPORTED_POSITIONED_COMMANDS, - (int) (createBitmaskFromEnums(SqlSupportedPositionedCommands.SQL_POSITIONED_DELETE))); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_SUPPORTED_POSITIONED_COMMANDS, - flightSqlSupportedPositionedCommandsProvider); - - final ObjIntConsumer flightSqlSelectForUpdateSupportedProvider = - (root, index) -> setDataForBooleanField(root, index, SqlInfo.SQL_SELECT_FOR_UPDATE_SUPPORTED, - EXPECTED_SELECT_FOR_UPDATE_SUPPORTED); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_SELECT_FOR_UPDATE_SUPPORTED, flightSqlSelectForUpdateSupportedProvider); - - final ObjIntConsumer flightSqlStoredProceduresSupportedProvider = - (root, index) -> setDataForBooleanField(root, index, SqlInfo.SQL_STORED_PROCEDURES_SUPPORTED, - EXPECTED_STORED_PROCEDURES_SUPPORTED); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_STORED_PROCEDURES_SUPPORTED, flightSqlStoredProceduresSupportedProvider); - - final ObjIntConsumer flightSqlSupportedSubqueriesProvider = - (root, index) -> setDataForIntField(root, index, SqlInfo.SQL_SUPPORTED_SUBQUERIES, - EXPECTED_SUPPORTED_SUBQUERIES); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_SUPPORTED_SUBQUERIES, flightSqlSupportedSubqueriesProvider); - - final ObjIntConsumer flightSqlSupportsCorrelatedSubqueriesProvider = - (root, index) -> setDataForBooleanField(root, index, SqlInfo.SQL_CORRELATED_SUBQUERIES_SUPPORTED, - EXPECTED_CORRELATED_SUBQUERIES_SUPPORTED); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_CORRELATED_SUBQUERIES_SUPPORTED, - flightSqlSupportsCorrelatedSubqueriesProvider); - - final ObjIntConsumer flightSqlSupportedUnionsLengthProvider = - (root, index) -> setDataForIntField(root, index, SqlInfo.SQL_SUPPORTED_UNIONS, - (int) (createBitmaskFromEnums(SqlSupportedUnions.SQL_UNION_ALL))); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_SUPPORTED_UNIONS, flightSqlSupportedUnionsLengthProvider); - - final ObjIntConsumer flightSqlMaxBinaryLiteralLengthProvider = - (root, index) -> setDataForBigIntField(root, index, SqlInfo.SQL_MAX_BINARY_LITERAL_LENGTH, - EXPECTED_MAX_BINARY_LITERAL_LENGTH); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_MAX_BINARY_LITERAL_LENGTH, flightSqlMaxBinaryLiteralLengthProvider); - - final ObjIntConsumer flightSqlMaxCharLiteralLengthProvider = - (root, index) -> setDataForBigIntField(root, index, SqlInfo.SQL_MAX_CHAR_LITERAL_LENGTH, - EXPECTED_MAX_CHAR_LITERAL_LENGTH); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_MAX_CHAR_LITERAL_LENGTH, flightSqlMaxCharLiteralLengthProvider); - - final ObjIntConsumer flightSqlMaxColumnNameLengthProvider = - (root, index) -> setDataForBigIntField(root, index, SqlInfo.SQL_MAX_COLUMN_NAME_LENGTH, - EXPECTED_MAX_COLUMN_NAME_LENGTH); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_MAX_COLUMN_NAME_LENGTH, flightSqlMaxColumnNameLengthProvider); - - final ObjIntConsumer flightSqlMaxColumnsInGroupByProvider = - (root, index) -> setDataForBigIntField(root, index, SqlInfo.SQL_MAX_COLUMNS_IN_GROUP_BY, - EXPECTED_MAX_COLUMNS_IN_GROUP_BY); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_MAX_COLUMNS_IN_GROUP_BY, flightSqlMaxColumnsInGroupByProvider); - - final ObjIntConsumer flightSqlMaxColumnsInIndexProvider = - (root, index) -> setDataForBigIntField(root, index, SqlInfo.SQL_MAX_COLUMNS_IN_INDEX, - EXPECTED_MAX_COLUMNS_IN_INDEX); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_MAX_COLUMNS_IN_INDEX, flightSqlMaxColumnsInIndexProvider); - - final ObjIntConsumer flightSqlMaxColumnsInOrderByProvider = - (root, index) -> setDataForBigIntField(root, index, SqlInfo.SQL_MAX_COLUMNS_IN_ORDER_BY, - EXPECTED_MAX_COLUMNS_IN_ORDER_BY); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_MAX_COLUMNS_IN_ORDER_BY, flightSqlMaxColumnsInOrderByProvider); - - final ObjIntConsumer flightSqlMaxColumnsInSelectProvider = - (root, index) -> setDataForBigIntField(root, index, SqlInfo.SQL_MAX_COLUMNS_IN_SELECT, - EXPECTED_MAX_COLUMNS_IN_SELECT); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_MAX_COLUMNS_IN_SELECT, flightSqlMaxColumnsInSelectProvider); - - final ObjIntConsumer flightSqlMaxConnectionsProvider = - (root, index) -> setDataForBigIntField(root, index, SqlInfo.SQL_MAX_CONNECTIONS, - EXPECTED_MAX_CONNECTIONS); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_MAX_CONNECTIONS, flightSqlMaxConnectionsProvider); - - final ObjIntConsumer flightSqlMaxCursorNameLengthProvider = - (root, index) -> setDataForBigIntField(root, index, SqlInfo.SQL_MAX_CURSOR_NAME_LENGTH, - EXPECTED_MAX_CURSOR_NAME_LENGTH); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_MAX_CURSOR_NAME_LENGTH, flightSqlMaxCursorNameLengthProvider); - - final ObjIntConsumer flightSqlMaxIndexLengthProvider = - (root, index) -> setDataForBigIntField(root, index, SqlInfo.SQL_MAX_INDEX_LENGTH, - EXPECTED_MAX_INDEX_LENGTH); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_MAX_INDEX_LENGTH, flightSqlMaxIndexLengthProvider); - - final ObjIntConsumer flightSqlMaxSchemaNameLengthProvider = - (root, index) -> setDataForBigIntField(root, index, SqlInfo.SQL_SCHEMA_NAME_LENGTH, - EXPECTED_SCHEMA_NAME_LENGTH); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_SCHEMA_NAME_LENGTH, flightSqlMaxSchemaNameLengthProvider); - - final ObjIntConsumer flightSqlMaxSchemaProcedureLengthProvider = - (root, index) -> setDataForBigIntField(root, index, SqlInfo.SQL_MAX_PROCEDURE_NAME_LENGTH, - EXPECTED_MAX_PROCEDURE_NAME_LENGTH); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_MAX_PROCEDURE_NAME_LENGTH, flightSqlMaxSchemaProcedureLengthProvider); - - final ObjIntConsumer flightSqlMaxCatalogNameLengthProvider = - (root, index) -> setDataForBigIntField(root, index, SqlInfo.SQL_MAX_CATALOG_NAME_LENGTH, - EXPECTED_MAX_CATALOG_NAME_LENGTH); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_MAX_CATALOG_NAME_LENGTH, flightSqlMaxCatalogNameLengthProvider); - - final ObjIntConsumer flightSqlMaxRowSizeProvider = - (root, index) -> setDataForBigIntField(root, index, SqlInfo.SQL_MAX_ROW_SIZE, - EXPECTED_MAX_ROW_SIZE); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_MAX_ROW_SIZE, flightSqlMaxRowSizeProvider); - - final ObjIntConsumer flightSqlMaxRowSizeIncludeBlobsProvider = - (root, index) -> setDataForBooleanField(root, index, SqlInfo.SQL_MAX_ROW_SIZE_INCLUDES_BLOBS, - EXPECTED_MAX_ROW_SIZE_INCLUDES_BLOBS); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_MAX_ROW_SIZE_INCLUDES_BLOBS, flightSqlMaxRowSizeIncludeBlobsProvider); - - final ObjIntConsumer flightSqlMaxStatementLengthProvider = - (root, index) -> setDataForBigIntField(root, index, SqlInfo.SQL_MAX_STATEMENT_LENGTH, - EXPECTED_MAX_STATEMENT_LENGTH); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_MAX_STATEMENT_LENGTH, flightSqlMaxStatementLengthProvider); - - final ObjIntConsumer flightSqlMaxStatementsProvider = - (root, index) -> setDataForBigIntField(root, index, SqlInfo.SQL_MAX_STATEMENTS, - EXPECTED_MAX_STATEMENTS); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_MAX_STATEMENTS, flightSqlMaxStatementsProvider); - - final ObjIntConsumer flightSqlTableNameLengthProvider = - (root, index) -> setDataForBigIntField(root, index, SqlInfo.SQL_MAX_TABLE_NAME_LENGTH, - EXPECTED_MAX_TABLE_NAME_LENGTH); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_MAX_TABLE_NAME_LENGTH, flightSqlTableNameLengthProvider); - - final ObjIntConsumer flightSqlTablesInSelectProvider = - (root, index) -> setDataForBigIntField(root, index, SqlInfo.SQL_MAX_TABLES_IN_SELECT, - EXPECTED_MAX_TABLES_IN_SELECT); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_MAX_TABLES_IN_SELECT, flightSqlTablesInSelectProvider); - - final ObjIntConsumer flightSqlMaxUsernameLengthProvider = - (root, index) -> setDataForBigIntField(root, index, SqlInfo.SQL_MAX_USERNAME_LENGTH, - EXPECTED_MAX_USERNAME_LENGTH); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_MAX_USERNAME_LENGTH, flightSqlMaxUsernameLengthProvider); - - final ObjIntConsumer flightSqlDefaultTransactionIsolationProvider = - (root, index) -> setDataForBigIntField(root, index, SqlInfo.SQL_DEFAULT_TRANSACTION_ISOLATION, - EXPECTED_DEFAULT_TRANSACTION_ISOLATION); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_DEFAULT_TRANSACTION_ISOLATION, - flightSqlDefaultTransactionIsolationProvider); - - final ObjIntConsumer flightSqlTransactionsSupportedProvider = - (root, index) -> - setDataForBooleanField(root, index, SqlInfo.SQL_TRANSACTIONS_SUPPORTED, EXPECTED_TRANSACTIONS_SUPPORTED); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_TRANSACTIONS_SUPPORTED, flightSqlTransactionsSupportedProvider); - - final ObjIntConsumer flightSqlSupportedTransactionsIsolationLevelsProvider = - (root, index) -> - setDataForIntField(root, index, SqlInfo.SQL_SUPPORTED_TRANSACTIONS_ISOLATION_LEVELS, - (int) (createBitmaskFromEnums(SqlTransactionIsolationLevel.SQL_TRANSACTION_SERIALIZABLE, - SqlTransactionIsolationLevel.SQL_TRANSACTION_READ_COMMITTED))); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_SUPPORTED_TRANSACTIONS_ISOLATION_LEVELS, - flightSqlSupportedTransactionsIsolationLevelsProvider); - - final ObjIntConsumer flightSqlDataDefinitionCausesTransactionCommitProvider = - (root, index) -> setDataForBooleanField(root, index, SqlInfo.SQL_DATA_DEFINITION_CAUSES_TRANSACTION_COMMIT, - EXPECTED_DATA_DEFINITION_CAUSES_TRANSACTION_COMMIT); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_DATA_DEFINITION_CAUSES_TRANSACTION_COMMIT, - flightSqlDataDefinitionCausesTransactionCommitProvider); - - final ObjIntConsumer flightSqlDataDefinitionInTransactionsIgnoredProvider = - (root, index) -> setDataForBooleanField(root, index, SqlInfo.SQL_DATA_DEFINITIONS_IN_TRANSACTIONS_IGNORED, - EXPECTED_DATA_DEFINITIONS_IN_TRANSACTIONS_IGNORED); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_DATA_DEFINITIONS_IN_TRANSACTIONS_IGNORED, - flightSqlDataDefinitionInTransactionsIgnoredProvider); - - final ObjIntConsumer flightSqlSupportedResultSetTypesProvider = - (root, index) -> setDataForIntField(root, index, SqlInfo.SQL_SUPPORTED_RESULT_SET_TYPES, - (int) (createBitmaskFromEnums( - SqlSupportedResultSetType.SQL_RESULT_SET_TYPE_FORWARD_ONLY, - SqlSupportedResultSetType.SQL_RESULT_SET_TYPE_SCROLL_INSENSITIVE))); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_SUPPORTED_RESULT_SET_TYPES, flightSqlSupportedResultSetTypesProvider); - - final ObjIntConsumer flightSqlSupportsBatchUpdatesProvider = - (root, index) -> setDataForBooleanField(root, index, SqlInfo.SQL_BATCH_UPDATES_SUPPORTED, - EXPECTED_BATCH_UPDATES_SUPPORTED); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_BATCH_UPDATES_SUPPORTED, flightSqlSupportsBatchUpdatesProvider); - - final ObjIntConsumer flightSqlSavepointsSupportedProvider = - (root, index) -> setDataForBooleanField(root, index, SqlInfo.SQL_SAVEPOINTS_SUPPORTED, - EXPECTED_SAVEPOINTS_SUPPORTED); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_SAVEPOINTS_SUPPORTED, flightSqlSavepointsSupportedProvider); - - final ObjIntConsumer flightSqlNamedParametersSupportedProvider = - (root, index) -> setDataForBooleanField(root, index, SqlInfo.SQL_NAMED_PARAMETERS_SUPPORTED, - EXPECTED_NAMED_PARAMETERS_SUPPORTED); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_NAMED_PARAMETERS_SUPPORTED, flightSqlNamedParametersSupportedProvider); - - final ObjIntConsumer flightSqlLocatorsUpdateCopyProvider = - (root, index) -> setDataForBooleanField(root, index, SqlInfo.SQL_LOCATORS_UPDATE_COPY, - EXPECTED_LOCATORS_UPDATE_COPY); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_LOCATORS_UPDATE_COPY, flightSqlLocatorsUpdateCopyProvider); - - final ObjIntConsumer flightSqlExpectedStoredFunctionsUsingCallSyntaxSupportedProvider = - (root, index) -> setDataForBooleanField(root, index, SqlInfo.SQL_STORED_FUNCTIONS_USING_CALL_SYNTAX_SUPPORTED, + FLIGHT_SQL_PRODUCER.getSqlInfoBuilder() + .withSqlOuterJoinSupportLevel(FlightSql.SqlOuterJoinsSupportLevel.SQL_FULL_OUTER_JOINS) + .withFlightSqlServerName(EXPECTED_DATABASE_PRODUCT_NAME) + .withFlightSqlServerVersion(EXPECTED_DATABASE_PRODUCT_VERSION) + .withSqlIdentifierQuoteChar(EXPECTED_IDENTIFIER_QUOTE_STRING) + .withFlightSqlServerReadOnly(EXPECTED_IS_READ_ONLY) + .withSqlKeywords(EXPECTED_SQL_KEYWORDS.split("\\s*,\\s*")) + .withSqlNumericFunctions(EXPECTED_NUMERIC_FUNCTIONS.split("\\s*,\\s*")) + .withSqlStringFunctions(EXPECTED_STRING_FUNCTIONS.split("\\s*,\\s*")) + .withSqlSystemFunctions(EXPECTED_SYSTEM_FUNCTIONS.split("\\s*,\\s*")) + .withSqlDatetimeFunctions(EXPECTED_TIME_DATE_FUNCTIONS.split("\\s*,\\s*")) + .withSqlSearchStringEscape(EXPECTED_SEARCH_STRING_ESCAPE) + .withSqlExtraNameCharacters(EXPECTED_EXTRA_NAME_CHARACTERS) + .withSqlSupportsColumnAliasing(EXPECTED_SUPPORTS_COLUMN_ALIASING) + .withSqlNullPlusNullIsNull(EXPECTED_NULL_PLUS_NULL_IS_NULL) + .withSqlSupportsConvert(ImmutableMap.of(SQL_CONVERT_BIT_VALUE, + Arrays.asList(SQL_CONVERT_INTEGER_VALUE, SQL_CONVERT_BIGINT_VALUE))) + .withSqlSupportsTableCorrelationNames(EXPECTED_SUPPORTS_TABLE_CORRELATION_NAMES) + .withSqlSupportsDifferentTableCorrelationNames( + EXPECTED_SUPPORTS_DIFFERENT_TABLE_CORRELATION_NAMES) + .withSqlSupportsExpressionsInOrderBy(EXPECTED_EXPRESSIONS_IN_ORDER_BY) + .withSqlSupportsOrderByUnrelated(EXPECTED_SUPPORTS_ORDER_BY_UNRELATED) + .withSqlSupportedGroupBy(FlightSql.SqlSupportedGroupBy.SQL_GROUP_BY_UNRELATED) + .withSqlSupportsLikeEscapeClause(EXPECTED_SUPPORTS_LIKE_ESCAPE_CLAUSE) + .withSqlSupportsNonNullableColumns(EXPECTED_NON_NULLABLE_COLUMNS) + .withSqlSupportedGrammar(FlightSql.SupportedSqlGrammar.SQL_CORE_GRAMMAR, + FlightSql.SupportedSqlGrammar.SQL_MINIMUM_GRAMMAR) + .withSqlAnsi92SupportedLevel(FlightSql.SupportedAnsi92SqlGrammarLevel.ANSI92_ENTRY_SQL, + FlightSql.SupportedAnsi92SqlGrammarLevel.ANSI92_INTERMEDIATE_SQL) + .withSqlSupportsIntegrityEnhancementFacility( + EXPECTED_SUPPORTS_INTEGRITY_ENHANCEMENT_FACILITY) + .withSqlSchemaTerm(EXPECTED_SCHEMA_TERM) + .withSqlCatalogTerm(EXPECTED_CATALOG_TERM) + .withSqlProcedureTerm(EXPECTED_PROCEDURE_TERM) + .withSqlCatalogAtStart(EXPECTED_CATALOG_AT_START) + .withSqlSchemasSupportedActions( + FlightSql.SqlSupportedElementActions.SQL_ELEMENT_IN_PROCEDURE_CALLS, + FlightSql.SqlSupportedElementActions.SQL_ELEMENT_IN_INDEX_DEFINITIONS) + .withSqlCatalogsSupportedActions( + FlightSql.SqlSupportedElementActions.SQL_ELEMENT_IN_INDEX_DEFINITIONS) + .withSqlSupportedPositionedCommands( + FlightSql.SqlSupportedPositionedCommands.SQL_POSITIONED_DELETE) + .withSqlSelectForUpdateSupported(EXPECTED_SELECT_FOR_UPDATE_SUPPORTED) + .withSqlStoredProceduresSupported(EXPECTED_STORED_PROCEDURES_SUPPORTED) + .withSqlSubQueriesSupported(EXPECTED_SUPPORTED_SUBQUERIES) + .withSqlCorrelatedSubqueriesSupported(EXPECTED_CORRELATED_SUBQUERIES_SUPPORTED) + .withSqlSupportedUnions(FlightSql.SqlSupportedUnions.SQL_UNION_ALL) + .withSqlMaxBinaryLiteralLength(EXPECTED_MAX_BINARY_LITERAL_LENGTH) + .withSqlMaxCharLiteralLength(EXPECTED_MAX_CHAR_LITERAL_LENGTH) + .withSqlMaxColumnNameLength(EXPECTED_MAX_COLUMN_NAME_LENGTH) + .withSqlMaxColumnsInGroupBy(EXPECTED_MAX_COLUMNS_IN_GROUP_BY) + .withSqlMaxColumnsInIndex(EXPECTED_MAX_COLUMNS_IN_INDEX) + .withSqlMaxColumnsInOrderBy(EXPECTED_MAX_COLUMNS_IN_ORDER_BY) + .withSqlMaxColumnsInSelect(EXPECTED_MAX_COLUMNS_IN_SELECT) + .withSqlMaxConnections(EXPECTED_MAX_CONNECTIONS) + .withSqlMaxCursorNameLength(EXPECTED_MAX_CURSOR_NAME_LENGTH) + .withSqlMaxIndexLength(EXPECTED_MAX_INDEX_LENGTH) + .withSqlSchemaNameLength(EXPECTED_SCHEMA_NAME_LENGTH) + .withSqlMaxProcedureNameLength(EXPECTED_MAX_PROCEDURE_NAME_LENGTH) + .withSqlMaxCatalogNameLength(EXPECTED_MAX_CATALOG_NAME_LENGTH) + .withSqlMaxRowSize(EXPECTED_MAX_ROW_SIZE) + .withSqlMaxRowSizeIncludesBlobs(EXPECTED_MAX_ROW_SIZE_INCLUDES_BLOBS) + .withSqlMaxStatementLength(EXPECTED_MAX_STATEMENT_LENGTH) + .withSqlMaxStatements(EXPECTED_MAX_STATEMENTS) + .withSqlMaxTableNameLength(EXPECTED_MAX_TABLE_NAME_LENGTH) + .withSqlMaxTablesInSelect(EXPECTED_MAX_TABLES_IN_SELECT) + .withSqlMaxUsernameLength(EXPECTED_MAX_USERNAME_LENGTH) + .withSqlDefaultTransactionIsolation(EXPECTED_DEFAULT_TRANSACTION_ISOLATION) + .withSqlTransactionsSupported(EXPECTED_TRANSACTIONS_SUPPORTED) + .withSqlSupportedTransactionsIsolationLevels( + FlightSql.SqlTransactionIsolationLevel.SQL_TRANSACTION_SERIALIZABLE, + FlightSql.SqlTransactionIsolationLevel.SQL_TRANSACTION_READ_COMMITTED) + .withSqlDataDefinitionCausesTransactionCommit( + EXPECTED_DATA_DEFINITION_CAUSES_TRANSACTION_COMMIT) + .withSqlDataDefinitionsInTransactionsIgnored( + EXPECTED_DATA_DEFINITIONS_IN_TRANSACTIONS_IGNORED) + .withSqlSupportedResultSetTypes( + FlightSql.SqlSupportedResultSetType.SQL_RESULT_SET_TYPE_FORWARD_ONLY, + FlightSql.SqlSupportedResultSetType.SQL_RESULT_SET_TYPE_SCROLL_INSENSITIVE) + .withSqlBatchUpdatesSupported(EXPECTED_BATCH_UPDATES_SUPPORTED) + .withSqlSavepointsSupported(EXPECTED_SAVEPOINTS_SUPPORTED) + .withSqlNamedParametersSupported(EXPECTED_NAMED_PARAMETERS_SUPPORTED) + .withSqlLocatorsUpdateCopy(EXPECTED_LOCATORS_UPDATE_COPY) + .withSqlStoredFunctionsUsingCallSyntaxSupported( EXPECTED_STORED_FUNCTIONS_USING_CALL_SYNTAX_SUPPORTED); - FLIGHT_SQL_PRODUCER.addSqlInfo(SqlInfo.SQL_STORED_FUNCTIONS_USING_CALL_SYNTAX_SUPPORTED, - flightSqlExpectedStoredFunctionsUsingCallSyntaxSupportedProvider); - - FLIGHT_SQL_PRODUCER.addDefaultSqlInfo( - EnumSet.of(SqlInfo.FLIGHT_SQL_SERVER_NAME, SqlInfo.FLIGHT_SQL_SERVER_VERSION, SqlInfo.SQL_IDENTIFIER_QUOTE_CHAR, - SqlInfo.FLIGHT_SQL_SERVER_READ_ONLY, SqlInfo.SQL_KEYWORDS, SqlInfo.SQL_NUMERIC_FUNCTIONS, - SqlInfo.SQL_STRING_FUNCTIONS, SqlInfo.SQL_SYSTEM_FUNCTIONS, SqlInfo.SQL_DATETIME_FUNCTIONS, - SqlInfo.SQL_SEARCH_STRING_ESCAPE, SqlInfo.SQL_EXTRA_NAME_CHARACTERS, SqlInfo.SQL_SUPPORTS_COLUMN_ALIASING, - SqlInfo.SQL_NULL_PLUS_NULL_IS_NULL, SqlInfo.SQL_SUPPORTS_CONVERT, - SqlInfo.SQL_SUPPORTS_TABLE_CORRELATION_NAMES, SqlInfo.SQL_SUPPORTS_DIFFERENT_TABLE_CORRELATION_NAMES, - SqlInfo.SQL_SUPPORTS_EXPRESSIONS_IN_ORDER_BY, SqlInfo.SQL_SUPPORTS_ORDER_BY_UNRELATED, - SqlInfo.SQL_SUPPORTED_GROUP_BY, - SqlInfo.SQL_SUPPORTS_LIKE_ESCAPE_CLAUSE, SqlInfo.SQL_SUPPORTS_NON_NULLABLE_COLUMNS, - SqlInfo.SQL_SUPPORTED_GRAMMAR, SqlInfo.SQL_ANSI92_SUPPORTED_LEVEL, - SqlInfo.SQL_SUPPORTS_INTEGRITY_ENHANCEMENT_FACILITY, SqlInfo.SQL_OUTER_JOINS_SUPPORT_LEVEL, - SqlInfo.SQL_SCHEMA_TERM, SqlInfo.SQL_CATALOG_TERM, - SqlInfo.SQL_PROCEDURE_TERM, SqlInfo.SQL_CATALOG_AT_START, SqlInfo.SQL_SCHEMAS_SUPPORTED_ACTIONS, - SqlInfo.SQL_CATALOGS_SUPPORTED_ACTIONS, SqlInfo.SQL_SUPPORTED_POSITIONED_COMMANDS, - SqlInfo.SQL_SELECT_FOR_UPDATE_SUPPORTED, - SqlInfo.SQL_STORED_PROCEDURES_SUPPORTED, SqlInfo.SQL_SUPPORTED_SUBQUERIES, - SqlInfo.SQL_CORRELATED_SUBQUERIES_SUPPORTED, - SqlInfo.SQL_SUPPORTED_UNIONS, SqlInfo.SQL_MAX_BINARY_LITERAL_LENGTH, SqlInfo.SQL_MAX_CHAR_LITERAL_LENGTH, - SqlInfo.SQL_MAX_COLUMN_NAME_LENGTH, SqlInfo.SQL_MAX_COLUMNS_IN_GROUP_BY, SqlInfo.SQL_MAX_COLUMNS_IN_INDEX, - SqlInfo.SQL_MAX_COLUMNS_IN_ORDER_BY, SqlInfo.SQL_MAX_COLUMNS_IN_SELECT, SqlInfo.SQL_MAX_CONNECTIONS, - SqlInfo.SQL_MAX_CURSOR_NAME_LENGTH, SqlInfo.SQL_MAX_INDEX_LENGTH, SqlInfo.SQL_SCHEMA_NAME_LENGTH, - SqlInfo.SQL_MAX_PROCEDURE_NAME_LENGTH, SqlInfo.SQL_MAX_CATALOG_NAME_LENGTH, - SqlInfo.SQL_MAX_ROW_SIZE, SqlInfo.SQL_MAX_ROW_SIZE_INCLUDES_BLOBS, SqlInfo.SQL_MAX_STATEMENT_LENGTH, - SqlInfo.SQL_MAX_STATEMENTS, SqlInfo.SQL_MAX_TABLE_NAME_LENGTH, SqlInfo.SQL_MAX_TABLES_IN_SELECT, - SqlInfo.SQL_MAX_USERNAME_LENGTH, SqlInfo.SQL_DEFAULT_TRANSACTION_ISOLATION, - SqlInfo.SQL_TRANSACTIONS_SUPPORTED, - SqlInfo.SQL_SUPPORTED_TRANSACTIONS_ISOLATION_LEVELS, SqlInfo.SQL_DATA_DEFINITION_CAUSES_TRANSACTION_COMMIT, - SqlInfo.SQL_DATA_DEFINITIONS_IN_TRANSACTIONS_IGNORED, SqlInfo.SQL_SUPPORTED_RESULT_SET_TYPES, - SqlInfo.SQL_BATCH_UPDATES_SUPPORTED, SqlInfo.SQL_SAVEPOINTS_SUPPORTED, - SqlInfo.SQL_NAMED_PARAMETERS_SUPPORTED, SqlInfo.SQL_LOCATORS_UPDATE_COPY, - SqlInfo.SQL_STORED_FUNCTIONS_USING_CALL_SYNTAX_SUPPORTED)); - connection = FLIGHT_SERVER_TEST_RULE.getConnection(); } @AfterClass @@ -1087,21 +768,11 @@ public void testGetSqlInfo() throws SQLException { collector.checkThat(metaData.getSearchStringEscape(), is(EXPECTED_SEARCH_STRING_ESCAPE)); collector.checkThat(metaData.getExtraNameCharacters(), is(EXPECTED_EXTRA_NAME_CHARACTERS)); collector.checkThat(metaData.supportsConvert(), is(EXPECTED_SQL_SUPPORTS_CONVERT)); - collector.checkThat( - metaData.supportsConvert(BIT, INTEGER), - is(EXPECTED_SQL_SUPPORTS_CONVERT)); - collector.checkThat( - metaData.supportsConvert(BIT, BIGINT), - is(EXPECTED_SQL_SUPPORTS_CONVERT)); - collector.checkThat( - metaData.supportsConvert(BIGINT, INTEGER), - is(EXPECTED_INVALID_SQL_SUPPORTS_CONVERT)); - collector.checkThat( - metaData.supportsConvert(JAVA_OBJECT, INTEGER), - is(EXPECTED_INVALID_SQL_SUPPORTS_CONVERT)); + collector.checkThat(metaData.supportsConvert(BIT, INTEGER), is(EXPECTED_SQL_SUPPORTS_CONVERT)); + collector.checkThat(metaData.supportsConvert(BIT, BIGINT), is(EXPECTED_SQL_SUPPORTS_CONVERT)); + collector.checkThat(metaData.supportsConvert(BIGINT, INTEGER), is(EXPECTED_INVALID_SQL_SUPPORTS_CONVERT)); + collector.checkThat(metaData.supportsConvert(JAVA_OBJECT, INTEGER), is(EXPECTED_INVALID_SQL_SUPPORTS_CONVERT)); collector.checkThat(metaData.supportsTableCorrelationNames(), is(EXPECTED_SUPPORTS_TABLE_CORRELATION_NAMES)); - collector.checkThat(metaData.supportsDifferentTableCorrelationNames(), - is(EXPECTED_SUPPORTS_DIFFERENT_TABLE_CORRELATION_NAMES)); collector.checkThat(metaData.supportsExpressionsInOrderBy(), is(EXPECTED_EXPRESSIONS_IN_ORDER_BY)); collector.checkThat(metaData.supportsOrderByUnrelated(), is(EXPECTED_SUPPORTS_ORDER_BY_UNRELATED)); collector.checkThat(metaData.supportsGroupBy(), is(EXPECTED_SUPPORTS_GROUP_BY)); @@ -1114,8 +785,6 @@ public void testGetSqlInfo() throws SQLException { collector.checkThat(metaData.supportsANSI92EntryLevelSQL(), is(EXPECTED_ANSI92_ENTRY_LEVEL_SQL)); collector.checkThat(metaData.supportsANSI92IntermediateSQL(), is(EXPECTED_ANSI92_INTERMEDIATE_SQL)); collector.checkThat(metaData.supportsANSI92FullSQL(), is(EXPECTED_ANSI92_FULL_SQL)); - collector.checkThat(metaData.supportsIntegrityEnhancementFacility(), - is(EXPECTED_SUPPORTS_INTEGRITY_ENHANCEMENT_FACILITY)); collector.checkThat(metaData.supportsOuterJoins(), is(EXPECTED_SUPPORTS_OUTER_JOINS)); collector.checkThat(metaData.supportsFullOuterJoins(), is(EXPECTED_SUPPORTS_FULL_OUTER_JOINS)); collector.checkThat(metaData.supportsLimitedOuterJoins(), is(EXPECTED_SUPPORTS_LIMITED_JOINS)); @@ -1125,19 +794,10 @@ public void testGetSqlInfo() throws SQLException { collector.checkThat(metaData.isCatalogAtStart(), is(EXPECTED_CATALOG_AT_START)); collector.checkThat(metaData.supportsSchemasInProcedureCalls(), is(EXPECTED_SCHEMAS_IN_PROCEDURE_CALLS)); collector.checkThat(metaData.supportsSchemasInIndexDefinitions(), is(EXPECTED_SCHEMAS_IN_INDEX_DEFINITIONS)); - collector.checkThat(metaData.supportsSchemasInPrivilegeDefinitions(), - is(EXPECTED_SCHEMAS_IN_PRIVILEGE_DEFINITIONS)); collector.checkThat(metaData.supportsCatalogsInIndexDefinitions(), is(EXPECTED_CATALOGS_IN_INDEX_DEFINITIONS)); - collector.checkThat(metaData.supportsCatalogsInPrivilegeDefinitions(), - is(EXPECTED_CATALOGS_IN_PRIVILEGE_DEFINITIONS)); collector.checkThat(metaData.supportsPositionedDelete(), is(EXPECTED_POSITIONED_DELETE)); collector.checkThat(metaData.supportsPositionedUpdate(), is(EXPECTED_POSITIONED_UPDATE)); collector.checkThat(metaData.supportsResultSetType(ResultSet.TYPE_FORWARD_ONLY), is(EXPECTED_TYPE_FORWARD_ONLY)); - collector.checkThat(metaData.supportsResultSetType(ResultSet.TYPE_SCROLL_INSENSITIVE), - is(EXPECTED_TYPE_SCROLL_INSENSITIVE)); - collector.checkThat(metaData.supportsResultSetType(ResultSet.TYPE_SCROLL_SENSITIVE), - is(EXPECTED_TYPE_SCROLL_SENSITIVE)); - collector.checkThrows(SQLException.class, () -> metaData.supportsResultSetType(ResultSet.HOLD_CURSORS_OVER_COMMIT)); collector.checkThat(metaData.supportsSelectForUpdate(), is(EXPECTED_SELECT_FOR_UPDATE_SUPPORTED)); collector.checkThat(metaData.supportsStoredProcedures(), is(EXPECTED_STORED_PROCEDURES_SUPPORTED)); collector.checkThat(metaData.supportsSubqueriesInComparisons(), is(EXPECTED_SUBQUERIES_IN_COMPARISON)); @@ -1167,6 +827,20 @@ public void testGetSqlInfo() throws SQLException { collector.checkThat(metaData.getMaxTablesInSelect(), is(EXPECTED_MAX_TABLES_IN_SELECT)); collector.checkThat(metaData.getMaxUserNameLength(), is(EXPECTED_MAX_USERNAME_LENGTH)); collector.checkThat(metaData.getDefaultTransactionIsolation(), is(EXPECTED_DEFAULT_TRANSACTION_ISOLATION)); + collector.checkThat(metaData.supportsTransactions(), is(EXPECTED_TRANSACTIONS_SUPPORTED)); + collector.checkThat(metaData.supportsBatchUpdates(), is(EXPECTED_BATCH_UPDATES_SUPPORTED)); + collector.checkThat(metaData.supportsSavepoints(), is(EXPECTED_SAVEPOINTS_SUPPORTED)); + collector.checkThat(metaData.supportsNamedParameters(), is(EXPECTED_NAMED_PARAMETERS_SUPPORTED)); + collector.checkThat(metaData.locatorsUpdateCopy(), is(EXPECTED_LOCATORS_UPDATE_COPY)); + + collector.checkThat(metaData.supportsResultSetType(ResultSet.TYPE_SCROLL_INSENSITIVE), + is(EXPECTED_TYPE_SCROLL_INSENSITIVE)); + collector.checkThat(metaData.supportsResultSetType(ResultSet.TYPE_SCROLL_SENSITIVE), + is(EXPECTED_TYPE_SCROLL_SENSITIVE)); + collector.checkThat(metaData.supportsSchemasInPrivilegeDefinitions(), + is(EXPECTED_SCHEMAS_IN_PRIVILEGE_DEFINITIONS)); + collector.checkThat(metaData.supportsCatalogsInPrivilegeDefinitions(), + is(EXPECTED_CATALOGS_IN_PRIVILEGE_DEFINITIONS)); collector.checkThat(metaData.supportsTransactionIsolationLevel(Connection.TRANSACTION_NONE), is(EXPECTED_TRANSACTION_NONE)); collector.checkThat(metaData.supportsTransactionIsolationLevel(Connection.TRANSACTION_READ_COMMITTED), @@ -1177,20 +851,20 @@ public void testGetSqlInfo() throws SQLException { is(EXPECTED_TRANSACTION_REPEATABLE_READ)); collector.checkThat(metaData.supportsTransactionIsolationLevel(Connection.TRANSACTION_SERIALIZABLE), is(EXPECTED_TRANSACTION_SERIALIZABLE)); - collector.checkThrows(SQLException.class, - () -> metaData.supportsTransactionIsolationLevel(Connection.TRANSACTION_SERIALIZABLE + 1)); - collector.checkThat(metaData.supportsTransactions(), is(EXPECTED_TRANSACTIONS_SUPPORTED)); - collector.checkThat(metaData.supportsSubqueriesInComparisons(), is(EXPECTED_SUBQUERIES_IN_COMPARISON)); collector.checkThat(metaData.dataDefinitionCausesTransactionCommit(), is(EXPECTED_DATA_DEFINITION_CAUSES_TRANSACTION_COMMIT)); collector.checkThat(metaData.dataDefinitionIgnoredInTransactions(), is(EXPECTED_DATA_DEFINITIONS_IN_TRANSACTIONS_IGNORED)); - collector.checkThat(metaData.supportsBatchUpdates(), is(EXPECTED_BATCH_UPDATES_SUPPORTED)); - collector.checkThat(metaData.supportsSavepoints(), is(EXPECTED_SAVEPOINTS_SUPPORTED)); - collector.checkThat(metaData.supportsNamedParameters(), is(EXPECTED_NAMED_PARAMETERS_SUPPORTED)); - collector.checkThat(metaData.locatorsUpdateCopy(), is(EXPECTED_LOCATORS_UPDATE_COPY)); collector.checkThat(metaData.supportsStoredFunctionsUsingCallSyntax(), is(EXPECTED_STORED_FUNCTIONS_USING_CALL_SYNTAX_SUPPORTED)); + collector.checkThat(metaData.supportsIntegrityEnhancementFacility(), + is(EXPECTED_SUPPORTS_INTEGRITY_ENHANCEMENT_FACILITY)); + collector.checkThat(metaData.supportsDifferentTableCorrelationNames(), + is(EXPECTED_SUPPORTS_DIFFERENT_TABLE_CORRELATION_NAMES)); + + collector.checkThrows(SQLException.class, + () -> metaData.supportsTransactionIsolationLevel(Connection.TRANSACTION_SERIALIZABLE + 1)); + collector.checkThrows(SQLException.class, () -> metaData.supportsResultSetType(ResultSet.HOLD_CURSORS_OVER_COMMIT)); } @Test diff --git a/java/flight/flight-jdbc-driver/src/test/java/org/apache/arrow/driver/jdbc/test/adhoc/MockFlightSqlProducer.java b/java/flight/flight-jdbc-driver/src/test/java/org/apache/arrow/driver/jdbc/test/adhoc/MockFlightSqlProducer.java index 6b92ed5f463c2..6dbb2ff08df74 100644 --- a/java/flight/flight-jdbc-driver/src/test/java/org/apache/arrow/driver/jdbc/test/adhoc/MockFlightSqlProducer.java +++ b/java/flight/flight-jdbc-driver/src/test/java/org/apache/arrow/driver/jdbc/test/adhoc/MockFlightSqlProducer.java @@ -29,19 +29,14 @@ import java.nio.channels.Channels; import java.nio.charset.StandardCharsets; import java.util.AbstractMap.SimpleImmutableEntry; -import java.util.Collection; import java.util.Collections; -import java.util.EnumMap; -import java.util.EnumSet; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import java.util.Set; import java.util.UUID; import java.util.function.BiConsumer; import java.util.function.Consumer; -import java.util.function.ObjIntConsumer; import java.util.stream.IntStream; import org.apache.arrow.flight.CallStatus; @@ -55,6 +50,7 @@ import org.apache.arrow.flight.SchemaResult; import org.apache.arrow.flight.Ticket; import org.apache.arrow.flight.sql.FlightSqlProducer; +import org.apache.arrow.flight.sql.SqlInfoBuilder; import org.apache.arrow.flight.sql.impl.FlightSql.ActionClosePreparedStatementRequest; import org.apache.arrow.flight.sql.impl.FlightSql.ActionCreatePreparedStatementRequest; import org.apache.arrow.flight.sql.impl.FlightSql.ActionCreatePreparedStatementResult; @@ -72,13 +68,11 @@ import org.apache.arrow.flight.sql.impl.FlightSql.CommandStatementQuery; import org.apache.arrow.flight.sql.impl.FlightSql.CommandStatementUpdate; import org.apache.arrow.flight.sql.impl.FlightSql.DoPutUpdateResult; -import org.apache.arrow.flight.sql.impl.FlightSql.SqlInfo; import org.apache.arrow.flight.sql.impl.FlightSql.TicketStatementQuery; import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.memory.RootAllocator; import org.apache.arrow.util.Preconditions; -import org.apache.arrow.vector.VectorSchemaRoot; import org.apache.arrow.vector.ipc.WriteChannel; import org.apache.arrow.vector.ipc.message.MessageSerializer; import org.apache.arrow.vector.types.pojo.Schema; @@ -99,9 +93,7 @@ public final class MockFlightSqlProducer implements FlightSqlProducer { private final Map> catalogQueriesResults = new HashMap<>(); private final Map>> updateResultProviders = new HashMap<>(); - private final Set defaultInfo = EnumSet.noneOf(SqlInfo.class); - private final Map> sqlInfoResultProviders = - new EnumMap<>(SqlInfo.class); + private SqlInfoBuilder sqlInfoBuilder = new SqlInfoBuilder(); private static FlightInfo getFightInfoExportedAndImportedKeys(final Message message, final FlightDescriptor descriptor) { @@ -128,15 +120,6 @@ public static ByteBuffer serializeSchema(final Schema schema) { } } - /** - * Registers the provided {@link SqlInfo}s as the default for when no info is required. - * - * @param infos the infos to set as default when none is specified {@link #getStreamSqlInfo}. - */ - public void addDefaultSqlInfo(final Collection infos) { - defaultInfo.addAll(infos); - } - /** * Registers a new {@link StatementType#SELECT} SQL query. * @@ -201,16 +184,6 @@ void addUpdateQuery(final String sqlCommand, format("Attempted to overwrite pre-existing query: <%s>.", sqlCommand)); } - /** - * Registers a new {@link StatementType#SELECT} query for metadata-related queries. - * - * @param info the {@link SqlInfo} to use. - * @param resultsProvider the results provider. - */ - public void addSqlInfo(final SqlInfo info, final ObjIntConsumer resultsProvider) { - sqlInfoResultProviders.put(info, resultsProvider); - } - @Override public void createPreparedStatement(final ActionCreatePreparedStatementRequest request, final CallContext callContext, final StreamListener listener) { @@ -363,24 +336,7 @@ public FlightInfo getFlightInfoSqlInfo(final CommandGetSqlInfo commandGetSqlInfo @Override public void getStreamSqlInfo(final CommandGetSqlInfo commandGetSqlInfo, final CallContext callContext, final ServerStreamListener serverStreamListener) { - try (final BufferAllocator allocator = new RootAllocator(); - final VectorSchemaRoot root = VectorSchemaRoot.create(Schemas.GET_SQL_INFO_SCHEMA, allocator)) { - final List infos = - commandGetSqlInfo.getInfoCount() == 0 ? - defaultInfo.stream().map(SqlInfo::getNumber).collect(toList()) : - commandGetSqlInfo.getInfoList(); - final int rows = infos.size(); - for (int i = 0; i < rows; i++) { - sqlInfoResultProviders.get(SqlInfo.forNumber(infos.get(i))).accept(root, i); - } - root.setRowCount(rows); - serverStreamListener.start(root); - serverStreamListener.putNext(); - } catch (final Throwable throwable) { - serverStreamListener.error(throwable); - } finally { - serverStreamListener.completed(); - } + sqlInfoBuilder.send(commandGetSqlInfo.getInfoList(), serverStreamListener); } @Override @@ -505,6 +461,10 @@ private void getStreamCatalogFunctions(final Message ticket, final ServerStreamL .accept(serverStreamListener); } + public SqlInfoBuilder getSqlInfoBuilder() { + return sqlInfoBuilder; + } + private static final class TicketConversionUtils { private TicketConversionUtils() { // Prevent instantiation. diff --git a/java/flight/flight-jdbc-driver/src/test/java/org/apache/arrow/driver/jdbc/utils/DatabaseMetadataDenseUnionUtils.java b/java/flight/flight-jdbc-driver/src/test/java/org/apache/arrow/driver/jdbc/utils/DatabaseMetadataDenseUnionUtils.java deleted file mode 100644 index d9273236696ad..0000000000000 --- a/java/flight/flight-jdbc-driver/src/test/java/org/apache/arrow/driver/jdbc/utils/DatabaseMetadataDenseUnionUtils.java +++ /dev/null @@ -1,258 +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.arrow.driver.jdbc.utils; - -import static java.nio.charset.StandardCharsets.UTF_8; -import static java.util.stream.IntStream.range; - -import java.nio.charset.StandardCharsets; -import java.util.function.Consumer; - -import org.apache.arrow.driver.jdbc.ArrowDatabaseMetadata; -import org.apache.arrow.flight.sql.impl.FlightSql.SqlInfo; -import org.apache.arrow.memory.ArrowBuf; -import org.apache.arrow.memory.BufferAllocator; -import org.apache.arrow.memory.RootAllocator; -import org.apache.arrow.vector.UInt4Vector; -import org.apache.arrow.vector.VectorSchemaRoot; -import org.apache.arrow.vector.complex.DenseUnionVector; -import org.apache.arrow.vector.complex.ListVector; -import org.apache.arrow.vector.complex.MapVector; -import org.apache.arrow.vector.complex.impl.UnionListWriter; -import org.apache.arrow.vector.complex.impl.UnionMapWriter; -import org.apache.arrow.vector.complex.writer.BaseWriter; -import org.apache.arrow.vector.holders.NullableBigIntHolder; -import org.apache.arrow.vector.holders.NullableBitHolder; -import org.apache.arrow.vector.holders.NullableIntHolder; -import org.apache.arrow.vector.holders.NullableVarCharHolder; - -/** - * Utility class for testing {@link ArrowDatabaseMetadata} as well as its interactions with - * {@link SqlInfo} and {@link DenseUnionVector} instances. - */ -public final class DatabaseMetadataDenseUnionUtils { - - private DatabaseMetadataDenseUnionUtils() { - // Prevent instantiation. - } - - /** - * Sets the "info_name" field of the provided {@code root} as described in the FlightSQL specification. - * - * @param root the {@link VectorSchemaRoot} from which to fetch the {@link UInt4Vector}. - * @param index the index to {@link UInt4Vector#setSafe}. - * @param info the {@link SqlInfo} from which to get the {@link SqlInfo#getNumber}. - */ - public static void setInfoName(final VectorSchemaRoot root, final int index, final SqlInfo info) { - final UInt4Vector infoName = (UInt4Vector) root.getVector("info_name"); - infoName.setSafe(index, info.getNumber()); - } - - /** - * Sets the "value" field of the provide {@code root} as described in the FlightSQL specification. - * - * @param root the {@link VectorSchemaRoot} from which to fetch the {@link DenseUnionVector}. - * @param index the index to {@link DenseUnionVector#setSafe}. - * @param typeId the {@link DenseUnionVector#registerNewTypeId} output for the given type to be registered. - * @param dataSetter the {@link Consumer}<{@link DenseUnionVector}> that should decide - * which {@link DenseUnionVector#setSafe} to use. - */ - public static void setValues(final VectorSchemaRoot root, final int index, final byte typeId, - final Consumer dataSetter) { - final DenseUnionVector values = (DenseUnionVector) root.getVector("value"); - values.setTypeId(index, typeId); - dataSetter.accept(values); - } - - /** - * Gets a {@link NullableVarCharHolder} from the provided {@code string} using the provided {@code buf}. - * - * @param string the {@link StandardCharsets#UTF_8}-encoded text input to store onto the holder. - * @param buf the {@link ArrowBuf} from which to create the new holder. - * @return a new {@link NullableVarCharHolder} with the provided input data {@code string}. - */ - public static NullableVarCharHolder getHolderForUtf8(final String string, final ArrowBuf buf) { - final byte[] bytes = string.getBytes(UTF_8); - buf.setBytes(0, bytes); - final NullableVarCharHolder holder = new NullableVarCharHolder(); - holder.buffer = buf; - holder.end = bytes.length; - holder.isSet = 1; - return holder; - } - - /** - * Executes the given action on an ad-hoc, newly created instance of {@link ArrowBuf}. - * - * @param executor the action to take. - */ - public static void onCreateArrowBuf(final Consumer executor) { - try (final BufferAllocator allocator = new RootAllocator(); - final ArrowBuf buf = allocator.buffer(1024)) { - executor.accept(buf); - } - } - - /** - * Sets the data {@code value} for a {@link StandardCharsets#UTF_8}-encoded field. - * - * @param root the {@link VectorSchemaRoot} from which to fetch the {@link DenseUnionVector}. - * @param index the index to use for {@link DenseUnionVector#setSafe} - * @param sqlInfo the {@link SqlInfo} to use. - * @param value the input value. - */ - public static void setDataForUtf8Field(final VectorSchemaRoot root, final int index, - final SqlInfo sqlInfo, final String value) { - setInfoName(root, index, sqlInfo); - onCreateArrowBuf(buf -> { - final Consumer producer = - values -> values.setSafe(index, getHolderForUtf8(value, buf)); - setValues(root, index, (byte) 0, producer); - }); - } - - /** - * Sets the data {@code value} for a {@code Int} field. - * - * @param root the {@link VectorSchemaRoot} from which to fetch the {@link DenseUnionVector}. - * @param index the index to use for {@link DenseUnionVector#setSafe} - * @param sqlInfo the {@link SqlInfo} to use. - * @param value the input value. - */ - public static void setDataForIntField(final VectorSchemaRoot root, final int index, - final SqlInfo sqlInfo, final int value) { - setInfoName(root, index, sqlInfo); - final NullableIntHolder dataHolder = new NullableIntHolder(); - dataHolder.isSet = 1; - dataHolder.value = value; - setValues(root, index, (byte) 3, values -> values.setSafe(index, dataHolder)); - } - - /** - * Sets the data {@code value} for a {@code BigInt} field. - * - * @param root the {@link VectorSchemaRoot} from which to fetch the {@link DenseUnionVector}. - * @param index the index to use for {@link DenseUnionVector#setSafe} - * @param sqlInfo the {@link SqlInfo} to use. - * @param value the input value. - */ - public static void setDataForBigIntField(final VectorSchemaRoot root, final int index, - final SqlInfo sqlInfo, final long value) { - setInfoName(root, index, sqlInfo); - final NullableBigIntHolder dataHolder = new NullableBigIntHolder(); - dataHolder.isSet = 1; - dataHolder.value = value; - setValues(root, index, (byte) 2, values -> values.setSafe(index, dataHolder)); - } - - /** - * Sets the data {@code value} for a {@code Boolean} field. - * - * @param root the {@link VectorSchemaRoot} from which to fetch the {@link DenseUnionVector}. - * @param index the index to use for {@link DenseUnionVector#setSafe} - * @param sqlInfo the {@link SqlInfo} to use. - * @param value the input value. - */ - public static void setDataForBooleanField(final VectorSchemaRoot root, final int index, - final SqlInfo sqlInfo, final boolean value) { - setInfoName(root, index, sqlInfo); - final NullableBitHolder dataHolder = new NullableBitHolder(); - dataHolder.isSet = 1; - dataHolder.value = value ? 1 : 0; - setValues(root, index, (byte) 1, values -> values.setSafe(index, dataHolder)); - } - - /** - * Sets the data {@code values} for a {@code List} field. - * - * @param root the {@link VectorSchemaRoot} from which to fetch the {@link DenseUnionVector}. - * @param index the index to use for {@link DenseUnionVector#setSafe} - * @param sqlInfo the {@link SqlInfo} to use. - * @param values the input value. - */ - public static void setDataVarCharListField(final VectorSchemaRoot root, final int index, - final SqlInfo sqlInfo, final String[] values) { - final DenseUnionVector denseUnion = (DenseUnionVector) root.getVector("value"); - final ListVector listVector = denseUnion.getList((byte) 4); - final int listIndex = listVector.getValueCount(); - final int denseUnionValueCount = index + 1; - final int listVectorValueCount = listIndex + 1; - denseUnion.setValueCount(denseUnionValueCount); - listVector.setValueCount(listVectorValueCount); - - final UnionListWriter writer = listVector.getWriter(); - writer.setPosition(listIndex); - writer.startList(); - final int length = values.length; - range(0, length) - .forEach(i -> { - onCreateArrowBuf(buf -> { - final byte[] bytes = values[i].getBytes(UTF_8); - buf.setBytes(0, bytes); - writer.writeVarChar(0, bytes.length, buf); - }); - }); - writer.endList(); - writer.setValueCount(listVectorValueCount); - - denseUnion.setTypeId(index, (byte) 4); - denseUnion.getOffsetBuffer().setInt(index * 4L, listIndex); - setInfoName(root, index, sqlInfo); - } - - /** - * Sets the data {@code values} for a {@code Map} field. - * - * @param root the {@link VectorSchemaRoot} from which to fetch the {@link DenseUnionVector}. - * @param index the index to use for {@link DenseUnionVector#setSafe} - * @param sqlInfo the {@link SqlInfo} to use. - * @param values the input value. - */ - public static void setIntToIntListMapField(final VectorSchemaRoot root, final int index, - final SqlInfo sqlInfo, final int key, int[] values) { - final DenseUnionVector denseUnion = (DenseUnionVector) root.getVector("value"); - final MapVector mapVector = denseUnion.getMap((byte) 5); - final int mapIndex = mapVector.getValueCount(); - final int denseUnionValueCount = index + 1; - final int mapVectorValueCount = mapIndex + 1; - denseUnion.setValueCount(denseUnionValueCount); - mapVector.setValueCount(mapVectorValueCount); - - final UnionMapWriter mapWriter = mapVector.getWriter(); - mapWriter.setPosition(mapIndex); - mapWriter.startMap(); - mapWriter.startEntry(); - mapWriter.key().integer().writeInt(key); - final BaseWriter.ListWriter listWriter = mapWriter.value().list(); - listWriter.setPosition(0); - listWriter.startList(); - final int length = values.length; - range(0, length) - .forEach(i -> { - listWriter.integer().writeInt(values[i]); - }); - listWriter.endList(); - mapWriter.endEntry(); - mapWriter.endMap(); - mapWriter.setValueCount(mapVectorValueCount); - - denseUnion.setTypeId(index, (byte) 5); - denseUnion.getOffsetBuffer().setInt(index * 4L, mapIndex); - setInfoName(root, index, sqlInfo); - } -}