sgrebnov opened a new issue, #7637:
URL: https://github.com/apache/arrow-rs/issues/7637

   **Describe the bug**
   
   The FlightSQL schema definition for `CommandGetDbSchemas` and 
`CommandGetTables` responses does not fully correspond to the protocol due to 
missing nullability information
   
   _CommandGetDbSchemas_
   
   `catalog_name` is expected to be nullable:
   
   
https://github.com/apache/arrow-rs/blob/721150286b00bece40ffcc6f5ac14ebb5d64785b/arrow-flight/src/sql/arrow.flight.protocol.sql.rs#L130-L137
   
   Current definition
   
   ```rust
   /// The schema for GetDbSchemas
   static GET_DB_SCHEMAS_SCHEMA: Lazy<SchemaRef> = Lazy::new(|| {
       Arc::new(Schema::new(vec![
           Field::new("catalog_name", DataType::Utf8, false),
           Field::new("db_schema_name", DataType::Utf8, false),
       ]))
   });
   ```
   
   _CommandGetTables_
   
   `catalog_name` and `db_schema_name` are expected to be nullable:
   
   
https://github.com/apache/arrow-rs/blob/721150286b00bece40ffcc6f5ac14ebb5d64785b/arrow-flight/src/sql/arrow.flight.protocol.sql.rs#L159-L165
   
   Current definition
   
   ```rust
   /// The schema for GetTables without `table_schema` column
   static GET_TABLES_SCHEMA_WITHOUT_TABLE_SCHEMA: Lazy<SchemaRef> = 
Lazy::new(|| {
       Arc::new(Schema::new(vec![
           Field::new("catalog_name", DataType::Utf8, false),
           Field::new("db_schema_name", DataType::Utf8, false),
           Field::new("table_name", DataType::Utf8, false),
           Field::new("table_type", DataType::Utf8, false),
       ]))
   });
   ```
   
   **To Reproduce**
   
   1. Schemas definition could be manually compared to other FlightSQL servers 
implementations, for example Cpp or Go.
   
   
https://github.com/apache/arrow/blob/0e5249b0e8f060f8ee5136579bfeed8c92d0d1ab/cpp/src/arrow/flight/sql/server.cc#L1282-L1286
   
   3. Run [arrow-adbc](https://github.com/apache/arrow-adbc) tests pointing to 
FlightSQL-based server (see _Additional context_)
   **Expected behavior**
   
   Fields nullability of schemas above is adjusted to to fully correspond the 
protocol.
   
   
   **Additional context**
   
   Discovered when testing FlightSQL based  server 
[spiceai](https://github.com/spiceai/spiceai) compatibility with 
[arrow-adbc](https://github.com/apache/arrow-adbc). There are tests failing due 
to schema mismatch, for example
   
   >Exception has occurred: 
CLR/Apache.Arrow.Adbc.C.CAdbcDriverImporter.ImportedAdbcException An exception 
of type 'Apache.Arrow.Adbc.C.CAdbcDriverImporter.ImportedAdbcException' 
occurred in Apache.Arrow.Adbc.dll but was not handled in user code: 
'[FlightSQL] Invalid schema returned for: expected schema: fields: 2 - 
catalog_name: type=utf8, nullable - db_schema_name: type=utf8, got schema: 
fields: 2 - catalog_name: type=utf8 - db_schema_name: type=utf8'


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to