cty123 commented on code in PR #52947:
URL: https://github.com/apache/spark/pull/52947#discussion_r2508667111
##########
sql/connect/client/jdbc/src/main/scala/org/apache/spark/sql/connect/client/jdbc/SparkConnectResultSet.scala:
##########
@@ -257,11 +257,17 @@ class SparkConnectResultSet(
override def getCharacterStream(columnLabel: String): Reader =
throw new SQLFeatureNotSupportedException
- override def getBigDecimal(columnIndex: Int): java.math.BigDecimal =
- throw new SQLFeatureNotSupportedException
+ override def getBigDecimal(columnIndex: Int): java.math.BigDecimal = {
+ if (currentRow.isNullAt(columnIndex - 1)) {
Review Comment:
1. I am experimenting this with other JDBC driver implementations.
2. Currently if it's out of the bound, it would throw out of bound exception,
```
[info] - get decimal type *** FAILED *** (78 milliseconds)
[info] java.lang.ArrayIndexOutOfBoundsException: Index 998 out of bounds
for length 1
[info] at
org.apache.spark.sql.catalyst.expressions.GenericRow.get(rows.scala:37)
[info] at org.apache.spark.sql.Row.isNullAt(Row.scala:216)
[info] at org.apache.spark.sql.Row.isNullAt$(Row.scala:216)
[info] at
org.apache.spark.sql.catalyst.expressions.GenericRow.isNullAt(rows.scala:28)
```
Do we still need to check it? Or should we capture it and wrap it under
another exception?
And yes, I think we can have a separate PR to address the 2 issues. And for
2, if we check the bound ourselves, I would do it inside `isNullAt` function,
instead of calling another checker function inside each getter function.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]