apache / apache/arrow

[Java][FlightSQL] Inconsistent GET_PRIMARY_KEYS_SCHEMA

Open
#45,233 3 comments 0 reactions 0 assignees View on GitHub
Component: Documentation Component: Format
Dominant language
C++
Stars
17.1k
Forks
4.3k
Avg merge
3d 13h
Merged PRs (30d)
88

Description

### Describe the bug, including details regarding any error messages, version, and platform.

The protobuf documentation [^1] for the returned schema of FlightSQL CommandGetPrimaryKeys is

```protobuf
* catalog_name: utf8,
* db_schema_name: utf8,
* table_name: utf8 not null,
* column_name: utf8 not null,
* key_name: utf8,
* key_sequence: int32 not null
```

`org.apache.arrow.flight.sql.FlightSqlProducer.Schemas#GET_PRIMARY_KEYS_SCHEMA` [^2] is defined as

```java
public static final Schema GET_PRIMARY_KEYS_SCHEMA =
new Schema(asList(
Field.nullable("catalog_name", VARCHAR.getType()),
Field.nullable("db_schema_name", VARCHAR.getType()),
Field.notNullable("table_name", VARCHAR.getType()),
Field.notNullable("column_name", VARCHAR.getType()),
Field.notNullable("key_sequence", INT.getType()),
Field.nullable("key_name", VARCHAR.getType())));
```

Note the reordering of `key_name` and `key_sequence`.

Should this be considered a bug in the implementation or the documentation? Or, is field order "unimportant" in this context?

[^1]: https://github.com/apache/arrow/blob/apache-arrow-17.0.0/format/FlightSql.proto#L1280-L1285
[^2]: https://github.com/apache/arrow/blob/apache-arrow-17.0.0/java/flight/flight-sql/src/main/java/org/apache/arrow/flight/sql/FlightSqlProducer.java#L1164-L1172

### Component(s)

Java

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.