Fix Java client time column access throwing ArrayIndexOutOfBoundsException for non-long typed getters
- Dominant language
- Java
- Stars
- 6.4k
- Forks
- 1.2k
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 115
Description
### 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!
Contributor guide
Research direction
Start in IoTDBRpcDataSet.java and inspect the six affected ByTsBlockColumnIndex getter methods alongside getLongByTsBlockColumnIndex and getStringByTsBlockColumnIndex. Verify the tree-model time-column path, then run the relevant Java client tests if available; done means all listed non-long getters report a clear StatementExecutionException instead of accessing column -1.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100