Skip to content

Commit

Permalink
[SPARK-48808][SQL] Fix NPE when connecting thriftserver through Hive …
Browse files Browse the repository at this point in the history
…1.2.1 and the result schema is empty

### What changes were proposed in this pull request?

Lower Hive JDBC/Thrift Client doesn't test whether columns are null or not before handling it. In this PR, we set an empty list to it if the result schema is empty

### Why are the changes needed?

bugfix for lower hive clients

### Does this PR introduce _any_ user-facing change?

no

### How was this patch tested?

tested offline by wangyum

### Was this patch authored or co-authored using generative AI tooling?

no

Closes apache#47213 from yaooqinn/SPARK-48808.

Lead-authored-by: Kent Yao <yao@apache.org>
Co-authored-by: Yuming Wang <yumwang@ebay.com>
Signed-off-by: Kent Yao <yao@apache.org>
  • Loading branch information
yaooqinn and wangyum committed Jul 4, 2024
1 parent 54b7558 commit c73c412
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,12 @@ object RowSetUtils {
val tRowSet = new TRowSet(startRowOffSet, new java.util.ArrayList[TRow](rowSize))
var i = 0
val columnSize = schema.length
val columns = new java.util.ArrayList[TColumn](columnSize)
while (i < columnSize) {
val tColumn = toTColumn(rows, i, schema(i), timeFormatters, binaryFormatter)
tRowSet.addToColumns(tColumn)
columns.add(i, toTColumn(rows, i, schema(i), timeFormatters, binaryFormatter))
i += 1
}
tRowSet.setColumns(columns)
tRowSet
}

Expand Down

0 comments on commit c73c412

Please sign in to comment.