cty123 commented on code in PR #52988:
URL: https://github.com/apache/spark/pull/52988#discussion_r2512679401


##########
sql/connect/client/jdbc/src/main/scala/org/apache/spark/sql/connect/client/jdbc/SparkConnectResultSet.scala:
##########
@@ -76,6 +76,23 @@ class SparkConnectResultSet(
     }
   }
 
+  private[jdbc] def getField[T](columnIndex: Int)(get: Int => T): Option[T] = {
+    checkOpen()
+    if (columnIndex < 0 || columnIndex >= currentRow.length) {
+      throw new SQLException(s"The column index is out of range: $columnIndex, 
" +
+        s"number of columns: ${currentRow.length}.")
+    }
+
+    Option(currentRow.get(columnIndex)) match {

Review Comment:
   Yeah, I agree, I had something different in mind while I was implementing 
this. `currentRow.get(columnIndex)` was called twice for all get* 
functions(once in `isNullAt`, and once in the 
`currentRow.get[Decimal|String|...]` function), so I was trying to see if I can 
reduce it. But it's likely premature optimization. We can circle back when we 
have all the getter functions implemented.



-- 
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]

Reply via email to