diff --git a/format/FlightSql.proto b/format/FlightSql.proto index 1bfc64788fd30..193a2b607169c 100644 --- a/format/FlightSql.proto +++ b/format/FlightSql.proto @@ -1115,15 +1115,15 @@ message CommandGetDbSchemas { * it is serialized as an IPC message.) * > * Fields on table_schema may contain the following metadata: - * - CATALOG_NAME - Table's catalog name - * - SCHEMA_NAME - Table's schema name - * - TABLE_NAME - Table name - * - PRECISION - Column precision/size - * - SCALE - Column scale/decimal digits - * - IS_AUTO_INCREMENT - "1" if column is auto incremented, "0" otherwise. - * - IS_CASE_SENSITIVE - "1" if column is case sensitive, "0" otherwise. - * - IS_READ_ONLY - "1" if column is read only, "0" otherwise. - * - IS_SEARCHABLE - "1" if column is searchable, "0" otherwise. + * - ARROW:FLIGHT:SQL:CATALOG_NAME - Table's catalog name + * - ARROW:FLIGHT:SQL:DB_SCHEMA_NAME - Database schema name + * - ARROW:FLIGHT:SQL:TABLE_NAME - Table name + * - ARROW:FLIGHT:SQL:PRECISION - Column precision/size + * - ARROW:FLIGHT:SQL:SCALE - Column scale/decimal digits if applicable + * - ARROW:FLIGHT:SQL:IS_AUTO_INCREMENT - "1" indicates if the column is auto incremented, "0" otherwise. + * - ARROW:FLIGHT:SQL:IS_CASE_SENSITIVE - "1" indicates if the column is case sensitive, "0" otherwise. + * - ARROW:FLIGHT:SQL:IS_READ_ONLY - "1" indicates if the column is read only, "0" otherwise. + * - ARROW:FLIGHT:SQL:IS_SEARCHABLE - "1" indicates if the column is searchable via WHERE clause, "0" otherwise. * The returned data should be ordered by catalog_name, db_schema_name, table_name, then table_type, followed by table_schema if requested. */ message CommandGetTables { @@ -1454,15 +1454,15 @@ message ActionClosePreparedStatementRequest { * for the following RPC calls: * - GetSchema: return the Arrow schema of the query. * Fields on this schema may contain the following metadata: - * - CATALOG_NAME - Table's catalog name - * - SCHEMA_NAME - Table's schema name - * - TABLE_NAME - Table name - * - PRECISION - Column precision/size - * - SCALE - Column scale/decimal digits - * - IS_AUTO_INCREMENT - "1" if column is auto incremented, "0" otherwise. - * - IS_CASE_SENSITIVE - "1" if column is case sensitive, "0" otherwise. - * - IS_READ_ONLY - "1" if column is read only, "0" otherwise. - * - IS_SEARCHABLE - "1" if column is searchable, "0" otherwise. + * - ARROW:FLIGHT:SQL:CATALOG_NAME - Table's catalog name + * - ARROW:FLIGHT:SQL:DB_SCHEMA_NAME - Database schema name + * - ARROW:FLIGHT:SQL:TABLE_NAME - Table name + * - ARROW:FLIGHT:SQL:PRECISION - Column precision/size + * - ARROW:FLIGHT:SQL:SCALE - Column scale/decimal digits if applicable + * - ARROW:FLIGHT:SQL:IS_AUTO_INCREMENT - "1" indicates if the column is auto incremented, "0" otherwise. + * - ARROW:FLIGHT:SQL:IS_CASE_SENSITIVE - "1" indicates if the column is case sensitive, "0" otherwise. + * - ARROW:FLIGHT:SQL:IS_READ_ONLY - "1" indicates if the column is read only, "0" otherwise. + * - ARROW:FLIGHT:SQL:IS_SEARCHABLE - "1" indicates if the column is searchable via WHERE clause, "0" otherwise. * - GetFlightInfo: execute the query. */ message CommandStatementQuery { @@ -1488,15 +1488,15 @@ message TicketStatementQuery { * the following RPC calls: * - GetSchema: return the Arrow schema of the query. * Fields on this schema may contain the following metadata: - * - CATALOG_NAME - Table's catalog name - * - SCHEMA_NAME - Table's schema name - * - TABLE_NAME - Table name - * - PRECISION - Column precision/size - * - SCALE - Column scale/decimal digits - * - IS_AUTO_INCREMENT - "1" if column is auto incremented, "0" otherwise. - * - IS_CASE_SENSITIVE - "1" if column is case sensitive, "0" otherwise. - * - IS_READ_ONLY - "1" if column is read only, "0" otherwise. - * - IS_SEARCHABLE - "1" if column is searchable, "0" otherwise. + * - ARROW:FLIGHT:SQL:CATALOG_NAME - Table's catalog name + * - ARROW:FLIGHT:SQL:DB_SCHEMA_NAME - Database schema name + * - ARROW:FLIGHT:SQL:TABLE_NAME - Table name + * - ARROW:FLIGHT:SQL:PRECISION - Column precision/size + * - ARROW:FLIGHT:SQL:SCALE - Column scale/decimal digits if applicable + * - ARROW:FLIGHT:SQL:IS_AUTO_INCREMENT - "1" indicates if the column is auto incremented, "0" otherwise. + * - ARROW:FLIGHT:SQL:IS_CASE_SENSITIVE - "1" indicates if the column is case sensitive, "0" otherwise. + * - ARROW:FLIGHT:SQL:IS_READ_ONLY - "1" indicates if the column is read only, "0" otherwise. + * - ARROW:FLIGHT:SQL:IS_SEARCHABLE - "1" indicates if the column is searchable via WHERE clause, "0" otherwise. * - DoPut: bind parameter values. All of the bound parameter sets will be executed as a single atomic execution. * - GetFlightInfo: execute the prepared statement instance. */ diff --git a/java/flight/flight-grpc/pom.xml b/java/flight/flight-grpc/pom.xml index 335558cc2612a..15ede7e6b858f 100644 --- a/java/flight/flight-grpc/pom.xml +++ b/java/flight/flight-grpc/pom.xml @@ -13,7 +13,7 @@ arrow-flight org.apache.arrow - 7.0.0-SNAPSHOT + 8.0.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/java/flight/flight-sql/src/main/java/org/apache/arrow/flight/sql/FlightSqlColumnMetadata.java b/java/flight/flight-sql/src/main/java/org/apache/arrow/flight/sql/FlightSqlColumnMetadata.java index d5db2fb43491c..f085e7db4ed8e 100644 --- a/java/flight/flight-sql/src/main/java/org/apache/arrow/flight/sql/FlightSqlColumnMetadata.java +++ b/java/flight/flight-sql/src/main/java/org/apache/arrow/flight/sql/FlightSqlColumnMetadata.java @@ -17,6 +17,7 @@ package org.apache.arrow.flight.sql; +import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -41,15 +42,15 @@ */ public class FlightSqlColumnMetadata { - private static final String CATALOG_NAME = "CATALOG_NAME"; - private static final String SCHEMA_NAME = "SCHEMA_NAME"; - private static final String TABLE_NAME = "TABLE_NAME"; - private static final String PRECISION = "PRECISION"; - private static final String SCALE = "SCALE"; - private static final String IS_AUTO_INCREMENT = "IS_AUTO_INCREMENT"; - private static final String IS_CASE_SENSITIVE = "IS_CASE_SENSITIVE"; - private static final String IS_READ_ONLY = "IS_READ_ONLY"; - private static final String IS_SEARCHABLE = "IS_SEARCHABLE"; + private static final String CATALOG_NAME = "ARROW:FLIGHT:SQL:CATALOG_NAME"; + private static final String SCHEMA_NAME = "ARROW:FLIGHT:SQL:SCHEMA_NAME"; + private static final String TABLE_NAME = "ARROW:FLIGHT:SQL:TABLE_NAME"; + private static final String PRECISION = "ARROW:FLIGHT:SQL:PRECISION"; + private static final String SCALE = "ARROW:FLIGHT:SQL:SCALE"; + private static final String IS_AUTO_INCREMENT = "ARROW:FLIGHT:SQL:IS_AUTO_INCREMENT"; + private static final String IS_CASE_SENSITIVE = "ARROW:FLIGHT:SQL:IS_CASE_SENSITIVE"; + private static final String IS_READ_ONLY = "ARROW:FLIGHT:SQL:IS_READ_ONLY"; + private static final String IS_SEARCHABLE = "ARROW:FLIGHT:SQL:IS_SEARCHABLE"; private static final String BOOLEAN_TRUE_STR = "1"; private static final String BOOLEAN_FALSE_STR = "0"; @@ -60,7 +61,7 @@ public class FlightSqlColumnMetadata { * Creates a new instance of FlightSqlColumnMetadata. */ public FlightSqlColumnMetadata(Map metadataMap) { - this.metadataMap = metadataMap; + this.metadataMap = new HashMap<>(metadataMap); } /** @@ -68,7 +69,7 @@ public FlightSqlColumnMetadata(Map metadataMap) { * @return The metadata map. */ public Map getMetadataMap() { - return metadataMap; + return Collections.unmodifiableMap(metadataMap); } /** @@ -285,8 +286,8 @@ public FlightSqlColumnMetadata build() { } } - private static String booleanToString(boolean isSearchable) { - return isSearchable ? BOOLEAN_TRUE_STR : BOOLEAN_FALSE_STR; + private static String booleanToString(boolean boolValue) { + return boolValue ? BOOLEAN_TRUE_STR : BOOLEAN_FALSE_STR; } private static boolean stringToBoolean(String value) { diff --git a/java/flight/flight-sql/src/test/java/org/apache/arrow/flight/TestFlightSql.java b/java/flight/flight-sql/src/test/java/org/apache/arrow/flight/TestFlightSql.java index 0bd7e0070d6c9..8001cf2c1e549 100644 --- a/java/flight/flight-sql/src/test/java/org/apache/arrow/flight/TestFlightSql.java +++ b/java/flight/flight-sql/src/test/java/org/apache/arrow/flight/TestFlightSql.java @@ -785,7 +785,8 @@ List> getResults(FlightStream stream) { } } else if (fieldVector instanceof IntVector) { for (int rowIndex = 0; rowIndex < rowCount; rowIndex++) { - results.get(rowIndex).add(String.valueOf(((IntVector) fieldVector).get(rowIndex))); + Object data = fieldVector.getObject(rowIndex); + results.get(rowIndex).add(isNull(data) ? null : Objects.toString(data)); } } else if (fieldVector instanceof VarBinaryVector) { final VarBinaryVector varbinaryVector = (VarBinaryVector) fieldVector; diff --git a/java/flight/pom.xml b/java/flight/pom.xml index 3fcb331298e41..99c41bef086ad 100644 --- a/java/flight/pom.xml +++ b/java/flight/pom.xml @@ -25,8 +25,9 @@ pom - 1.41.0 - 3.17.3 + 1.44.1 + 2.0.46.Final + 3.19.4 @@ -34,7 +35,6 @@ flight-grpc flight-sql flight-integration-tests - flight-jdbc-driver