apache / apache/iotdb

Fix Java client time column access throwing ArrayIndexOutOfBoundsException for non-long typed getters

未关闭 适合新手
#17,407 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Java
星标
6.4k
派生
1.2k
平均合并
1 天 23 小时
30 天内合并 PR
115

描述

### Search before asking

- [x] I searched in the [issues](https://github.com/apache/iotdb/issues) and found nothing similar.

### Version

Master

### Describe the bug and provide the minimal reproduce step

In `IoTDBRpcDataSet.java`, several `ByTsBlockColumnIndex` getter methods do not handle the `tsBlockColumnIndex < 0` case (time pseudo-column in tree model). Only `getLongByTsBlockColumnIndex` and `getStringByTsBlockColumnIndex` correctly handle this case.

When tree model is used, column index 1 maps to `tsBlockColumnIndex = -1` (time column). Accessing it through typed getters other than `getLong` or `getString` causes `ArrayIndexOutOfBoundsException` from `TsBlock.getColumn(-1)`.

Affected methods:
- `getBooleanByTsBlockColumnIndex`
- `getIntByTsBlockColumnIndex`
- `getFloatByTsBlockColumnIndex`
- `getDoubleByTsBlockColumnIndex`
- `getBinaryByTsBlockColumnIndex`
- `getObjectByTsBlockColumnIndex`

This is the Java equivalent of the C++ client bug fixed in #17400.

### What did you expect to see?

A clear `StatementExecutionException` with message like "Cannot read boolean from time column" instead of an opaque `ArrayIndexOutOfBoundsException`.

### What did you see instead?

`ArrayIndexOutOfBoundsException` with index -1.

### Anything else?

_No response_

### Are you willing to submit a PR?

- [x] I'm willing to submit a PR!

贡献指南

打开贡献指南

调研方向

从 IoTDBRpcDataSet.java 开始,检查受影响的六个 ByTsBlockColumnIndex getter 方法,以及 getLongByTsBlockColumnIndex 和 getStringByTsBlockColumnIndex。验证树模型的时间列路径,然后在可用时运行相关的 Java 客户端测试;完成的标准是,所有列出的非 long getter 都报告明确的 StatementExecutionException,而不是访问列 -1。

由索引模型根据 Issue 内容生成。

评估

技术栈
java
领域
databases
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
冷清
描述清晰度
描述清楚
新手友好度
72/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。