[Bug] IndexOutOfBoundsException when lookup join sql
- 主要语言
- Java
- 星标
- 3.4k
- 派生
- 1.4k
- 平均合并
- 1 天 11 小时
- 30 天内合并 PR
- 396
描述
### Search before asking
- [x] I searched in the [issues](https://github.com/apache/paimon/issues) and found nothing similar.
### Paimon version
paimon 1.1.1 +flink 1.18
Basically, all the trigger conditions are met:
1. DEBUG logging was enabled for org.apache.paimon.flink.lookup.FileStoreLookupFunction in the production environment.
2. A lookup join is being used, and the table created is a SecondaryIndexLookupTable.
3. The join key is contract_no, which is not the complete primary key. The logs show _KEY_contract_no and _KEY_reg_valid, indicating that the full key also involves reg_valid.
4. There is a mismatch in the field order among the lookup projection, Paimon's internal read schema, and the original table schema.
5. The DEBUG branch attempts to print the matched rows, which leads to the execution of logRow().
LookupJoin[8] switched from RUNNING to FAILED
java.lang.RuntimeException: java.lang.IndexOutOfBoundsException
at org.apache.paimon.flink.lookup.FileStoreLookupFunction.lookup
...
Caused by: java.lang.IndexOutOfBoundsException
at org.apache.paimon.memory.MemorySegment.get
at org.apache.paimon.memory.MemorySegmentUtils.copyToBytes
at org.apache.paimon.data.BinaryString.toString
at org.apache.paimon.flink.lookup.FileStoreLookupFunction.logRow
at org.apache.paimon.flink.lookup.FileStoreLookupFunction.lambda$lookupInternal$4
### Compute Engine
flink 1.18
### Minimal reproduce step
1. DEBUG logging was enabled for org.apache.paimon.flink.lookup.FileStoreLookupFunction in the production environment.
2. A lookup join is being used, and the table created is a SecondaryIndexLookupTable.
3. The join key is contract_no, which is not the complete primary key. The logs show _KEY_contract_no and _KEY_reg_valid, indicating that the full key also involves reg_valid.
4. There is a mismatch in the field order among the lookup projection, Paimon's internal read schema, and the original table schema.
5. The DEBUG branch attempts to print the matched rows, which leads to the execution of logRow().
### What doesn't meet your expectations?
none
### Anything else?
_No response_
### Are you willing to submit a PR?
- [x] I'm willing to submit a PR!
贡献指南
这个仓库没有索引到贡献指南
调研方向
从 FileStoreLookupFunction.lookup 开始,跟踪 lookupInternal 进入调用 logRow() 的 DEBUG 日志路径。使用 Flink 1.18 在 SecondaryIndexLookupTable 上执行 lookup join,提供部分 contract_no 键并启用 DEBUG 日志,以重现该问题。当 lookup 在记录匹配行时不再因 IndexOutOfBoundsException 失败时,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- java
- 领域
- data-engineering, databases
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 活跃
- 描述清晰度
- 基本清楚
- 新手友好度
- 55/100