[Bug] findColumn throws NullPointerException instead of SQLException for an unknown column name
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
Línea de trabajo
Comienza en IoTDBRpcDataSet.findColumn y compáralo con la comprobación guard existente de findColumnNameByIndex; después, sigue el límite de JDBC a través de IoTDBJDBCResultSet.findColumn y SessionDataSet.DataIterator.findColumn. Comprueba también IoTDBJDBCDataSet.findColumn; se considera terminado cuando una columna desconocida produce una SQLException que incluye el nombre de la columna que falta, en lugar de una NullPointerException.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Search before asking
- I searched in the issues and found nothing similar.
Version
master (2.0.x). The affected code is also present in released 2.0.x versions.
Describe the bug and provide the minimal reproduce step
IoTDBRpcDataSet.findColumn(String) returns columnOrdinalMap.get(columnName) directly. When the column name is not present, Map<String, Integer>.get returns null, which auto-unboxes to int and throws a NullPointerException. The JDBC contract (ResultSet.findColumn) requires a SQLException when the column is not found, and the sibling findColumnNameByIndex already guards its input and throws — the guard was simply omitted for findColumn.
This surfaces at the JDBC boundary (IoTDBJDBCResultSet.findColumn) and through SessionDataSet.DataIterator.findColumn, both of which delegate to the method above. The same missing guard also exists in IoTDBJDBCDataSet.findColumn.
Minimal reproduce step:
- Execute any query over JDBC and obtain the
ResultSet. - Call
resultSet.findColumn("a_column_name_that_is_not_in_the_result"). - A raw
NullPointerExceptionis thrown instead of aSQLException.
What did you expect to see?
findColumn throws a SQLException (at the JDBC boundary) that names the missing column, per the ResultSet.findColumn contract.
What did you see instead?
A NullPointerException, from unboxing the null returned by the column-ordinal map lookup.
Anything else?
The fix mirrors the existing findColumnNameByIndex guard: throw a checked StatementExecutionException at the rpc layer (reusing the existing UNKNOWN_COLUMN_NAME message), converted to SQLException at the JDBC boundary. I'd like to work on this and will open a PR (which also fixes the identical, currently-unused-but-public IoTDBJDBCDataSet.findColumn).
Are you willing to submit a PR?
- I'm willing to submit a PR!
- Lenguaje dominante
- Java
- Estrellas
- 6.4k
- Forks
- 1.2k
- Merge medio
- 1 d 8 h
- PR fusionados (30 d)
- 129
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de apache/iotdb
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
IoTDB Edge: stop-edge.sh does not stop its own process when IOTDB_HOME is set, and reports success Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
[Bug] 执行start-all.sh后无法启动集群问题 Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Todos los issues de apache/iotdb
Issues similares
-
bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
apache/cloudstack#14222 ·
-
[BUG]茶杯方块在取茶时会引发崩溃 Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
-
Cannot differ own consent and managed consents in My Consents view and detailed consent view. Abierto1.0.0-alpha2 Type/Improvement
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
wso2/dpdp-accelerator#272 ·
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
apache/rocketmq-dashboard#4860 · 1 comentario ·
-
agent-audit bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Vault-Web/cloud-page#144 ·