Fix Java client time column access throwing ArrayIndexOutOfBoundsException for non-long typed getters
- Lingua principale
- Java
- Stelle
- 6.4k
- Fork
- 1.2k
- Merge medio
- 1g 23h
- PR unite (30g)
- 115
Descrizione
### 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!
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia da IoTDBRpcDataSet.java e ispeziona i sei metodi getter ByTsBlockColumnIndex interessati insieme a getLongByTsBlockColumnIndex e getStringByTsBlockColumnIndex. Verifica il percorso della colonna temporale del modello ad albero, quindi esegui i test pertinenti del client Java, se disponibili; il lavoro è completato quando tutti i getter non-long elencati segnalano una StatementExecutionException chiara invece di accedere alla colonna -1.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java
- Ambito
- databases
- Tipo di issue
- Bug
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Tranquilla
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 72/100