[Bug]: Beam SQL Parquet tables fail on TIME columns: Unhandled logical type beam:logical_type:time:v1
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start with AvroUtils.getFieldSchema and genericFromBeamField, where the issue identifies the missing TIME identifier handling, and compare them with the DATE conversion paths. Read the Beam SQL TIME mapping in CalciteUtils and inspect the Avro time-millis/time-micros conversions. Add a JUnit regression test under sdks/java/extensions/sql using the DirectRunner repro; done means TIME values can be written to and read back from a Parquet table. The Avro time unit choice needs maintainer guidance.
由索引模型根据 Issue 内容生成。
描述
What happened?
A Beam SQL Parquet table (CREATE EXTERNAL TABLE ... TYPE parquet) with a TIME column can't be written. On master (b0c68c4a4f7), the INSERT fails with:
java.lang.RuntimeException: Unhandled logical type beam:logical_type:time:v1
Minimal repro, run as a JUnit test in sdks/java/extensions/sql with the DirectRunner (p is a TestPipeline):
BeamSqlEnv env = BeamSqlEnv.inMemory(new ParquetTableProvider());
env.executeDdl("CREATE EXTERNAL TABLE t (c TIME) TYPE parquet LOCATION '/tmp/time-table/'");
BeamSqlRelUtils.toPCollection(p, env.parseQuery("INSERT INTO t VALUES (TIME '12:34:56')"));
p.run().waitUntilFinish(); // RuntimeException: Unhandled logical type beam:logical_type:time:v1
Calling AvroUtils.toAvroSchema on the table's schema, which is what ParquetTable does (L60, L69, L111), throws the same exception.
Cause. The two sides use different identifiers for TIME:
- Beam SQL maps
TIMEtoFieldType.logicalType(SqlTypes.TIME), whose identifier isbeam:logical_type:time:v1(CalciteUtils L114). AvroUtils.getFieldSchemaonly recognizes the legacy"TIME"identifier (L1224). Every other identifier falls through to theUnhandled logical typeexception (L1242).genericFromBeamFieldhas the same gap (L1389, L1406).
DATE does handle both identifiers: "DATE".equals(identifier) || SqlTypes.DATE.getIdentifier().equals(identifier) (L1220). That's why DATE columns work and TIME columns don't.
Expected: TIME columns can be written and read back. The CREATE EXTERNAL TABLE docs list DATE, TIME, TIMESTAMP as supported Parquet types.
A fix probably needs a design call. Should SqlTypes.TIME (a java.time.LocalTime) map to Avro time-micros (long) or time-millis (int)? Reading the column back also has to convert to LocalTime, and the time-millis/time-micros branches of the Avro-to-Beam conversion currently return the raw int/long. I'm happy to send a fix once a maintainer confirms which mapping they'd like.
For reference, here is what AvroUtils.toAvroSchema produces today for each type, from a temporary test that runs CREATE EXTERNAL TABLE ... TYPE parquet for each column type:
| Beam SQL type | Beam field type | Avro type |
|---|---|---|
| TINYINT, SMALLINT, INTEGER | BYTE, INT16, INT32 | int |
| BIGINT | INT64 | long |
| FLOAT | FLOAT | float |
| DOUBLE | DOUBLE | double |
| DECIMAL | DECIMAL | bytes (decimal) |
| BOOLEAN | BOOLEAN | boolean |
| DATE | SqlTypes.DATE | int (date) |
| TIME | SqlTypes.TIME | exception |
| TIMESTAMP | DATETIME | long (timestamp-millis) |
| CHAR, VARCHAR | STRING | string |
| BINARY, VARBINARY | BYTES | bytes |
Several rows of the docs' Parquet type table don't match this: the int types, FLOAT, DATE and TIME. I'll file that docs correction separately.
Issue Priority
Priority: 2 (default / most bugs should be filed as P2)
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
- Component: Website
- Component: Infrastructure
- Component: Spark Runner
- Component: Flink Runner
- Component: Prism Runner
- Component: Hazelcast Jet Runner
- Component: Google Cloud Dataflow Runner
- 主要语言
- Java
- 星标
- 8.7k
- 派生
- 4.8k
- 平均合并
- 2 天 12 小时
- 30 天内合并 PR
- 371
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
apache/beam 的其他 Issue
-
awaiting triage bug P3
难度 1/5 1 小时以内 新手友好度 67/100
维护者通常 1 天内回复
-
[Bug]: [Python] WriteToJson silently rounds floats to 10 decimal places可能已有人在做 @Abhi2939 于 1 天前认领。 未关闭io P2 python yaml
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
apache/beam#39624 · 2 个 reaction ·
维护者通常 1 天内回复
-
[Bug]: PubsubIO used in batch incorrect batch cutoff size可能已有人在做 @1fanwang 于 78 天前认领。 未关闭bug io P3 pinned pubsub
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
build P3 sub-task
难度 1/5 1 小时以内 新手友好度 68/100
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 66/100
SasanLabs/VulnerableApp#912 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
desktop edt not responding
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 2/5 1-3 小时 新手友好度 78/100
datafusion-contrib/StreamFusion#653 ·
维护者通常 1 天内回复
-
[Bug] Absolute row/column index 0 is ignored for images, hyperlinks and comments可能已有人在做 @fanOfSunny 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复