jonathansudhakar1 opened a new issue, #41018:
URL: https://github.com/apache/beam/issues/41018

   ### What happened?
   
   The Parquet **Schema** table on the [Beam SQL CREATE EXTERNAL TABLE 
page](https://beam.apache.org/documentation/dsls/sql/extensions/create-external-table/#parquet)
 ([source, 
L532-L589](https://github.com/apache/beam/blob/74ab567d2e389b61dec063839325bf88bab4484e/website/www/site/content/en/documentation/dsls/sql/extensions/create-external-table.md?plain=1#L532-L589))
 says which Avro type each Beam SQL type becomes. Several rows don't match what 
`ParquetTable` actually does. It converts the table schema with 
`AvroUtils.toAvroSchema` ([`getFieldSchema`, 
L1141-L1272](https://github.com/apache/beam/blob/74ab567d2e389b61dec063839325bf88bab4484e/sdks/java/extensions/avro/src/main/java/org/apache/beam/sdk/extensions/avro/schemas/utils/AvroUtils.java#L1141-L1272)).
   
   | Beam SQL type | Docs say | Actual Avro type |
   |---|---|---|
   | TINYINT, SMALLINT, INTEGER | long | **int** |
   | BIGINT | long | long |
   | FLOAT | double | **float** |
   | DOUBLE | double | double |
   | DATE | long (with logical type) | **int** (`date`) |
   | TIME | long (with logical type) | **not supported**: fails with `Unhandled 
logical type beam:logical_type:time:v1` (#40994) |
   | TIMESTAMP | long (with logical type) | long (`timestamp-millis`) |
   | BINARY, VARBINARY | *(missing)* | bytes |
   | MAP | *(missing)* | map (VARCHAR keys only; other key types fail with 
`Avro only supports maps with string keys`) |
   
   DECIMAL (bytes, `decimal`), BOOLEAN, CHAR/VARCHAR (string), ARRAY (array) 
and ROW (record) are correct.
   
   I checked this on master (74ab567d2e3) with a temporary JUnit test in 
`sdks/java/extensions/sql`. For each type, it runs `CREATE EXTERNAL TABLE t (c 
<type>) TYPE parquet ...` and prints `AvroUtils.toAvroSchema` of the table 
schema. Every column comes out as a `["null", <type>]` union, because DDL 
columns are nullable by default. A second test writes a row with `INSERT` and 
reads it back with `SELECT *`. That round trip succeeds for every type above 
except TIME (#40994), DATE (#41017) and ROW (#18883).
   
   **Expected:** the table lists the types `ParquetTable` actually writes, and 
it marks TIME as unsupported for now.
   
   I'm planning to submit a docs fix for this.
   
   ### Issue Priority
   
   Priority: 3 (minor)
   
   ### Issue Components
   
   - [ ] Component: Python SDK
   - [ ] Component: Java SDK
   - [ ] Component: Go SDK
   - [ ] Component: Typescript SDK
   - [ ] Component: IO connector
   - [ ] Component: Beam YAML
   - [ ] Component: Beam examples
   - [ ] Component: Beam playground
   - [ ] Component: Beam katas
   - [x] Component: Website
   - [ ] Component: Infrastructure
   - [ ] Component: Spark Runner
   - [ ] Component: Flink Runner
   - [ ] Component: Prism Runner
   - [ ] Component: Hazelcast Jet Runner
   - [ ] Component: Google Cloud Dataflow Runner
   


-- 
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