Fix Java client time column access throwing ArrayIndexOutOfBoundsException for non-long typed getters
- Vorherrschende Sprache
- Java
- Sterne
- 6.4k
- Forks
- 1.2k
- Ø Merge
- 1 T. 23 Std.
- Gemergte PRs (30 T.)
- 115
Beschreibung
### 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!
Beitragsleitfaden
Rechercherichtung
Beginne in IoTDBRpcDataSet.java und untersuche die sechs betroffenen ByTsBlockColumnIndex-Getter-Methoden zusammen mit getLongByTsBlockColumnIndex und getStringByTsBlockColumnIndex. Überprüfe den Pfad der Zeitspalte im Tree-Modell und führe anschließend die relevanten Java-Client-Tests aus, falls verfügbar; abgeschlossen ist die Aufgabe, wenn alle aufgeführten Nicht-Long-Getter eine eindeutige StatementExecutionException melden, statt auf Spalte -1 zuzugreifen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- java
- Bereich
- databases
- Issue-Typ
- Bug
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Ruhig
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 72/100