Fix Java client time column access throwing ArrayIndexOutOfBoundsException for non-long typed getters
- Langage dominant
- Java
- Étoiles
- 6.4k
- Forks
- 1.2k
- Merge moyen
- 1 j 23 h
- PR mergées (30 j)
- 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!
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez dans IoTDBRpcDataSet.java et examinez les six méthodes getter ByTsBlockColumnIndex concernées avec getLongByTsBlockColumnIndex et getStringByTsBlockColumnIndex. Vérifiez le chemin de la colonne temporelle du modèle arborescent, puis exécutez les tests pertinents du client Java s’ils sont disponibles ; le travail est terminé lorsque tous les getters non-long listés signalent une StatementExecutionException explicite au lieu d’accéder à la colonne -1.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- java
- Domaine
- databases
- Type d'issue
- Bug
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Activité
- Calme
- Clarté
- Clairement spécifiée
- Accessibilité débutants
- 72/100