Skip to content

Commit

Permalink
[LIVY-637][THRIFTSERVER] Fix NullPointerException when create databas…
Browse files Browse the repository at this point in the history
…e using thriftserver

## What changes were proposed in this pull request?

Spark beeline use old hive-jdbc-client doesn’t do null point ref check. So  when new TRowSet, setColumes make sure column set not null.

## How was this patch tested?

Connect to livy's thriftserver using spark beeline. And create/use/drop database will no longer have nullpointerexceptions after execution.

![image](https://user-images.githubusercontent.com/13825159/63147414-b0484400-c030-11e9-8d14-b22238306194.png)

Author: micahzhao <[email protected]>

Closes apache#200 from captainzmc/livy-637.
  • Loading branch information
captainzmc authored and jerryshao committed Aug 22, 2019
1 parent ae96170 commit 9a4d0f1
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ class ColumnOrientedResultSet(
}

override def toTRowSet: TRowSet = {
// Spark beeline use old hive-jdbc-client doesn’t do null point ref check. When we new TRowSet,
// setColumes make sure column set not null.
val tRowSet = new TRowSet(rowOffset, new util.ArrayList[TRow])
tRowSet.setColumns(new util.ArrayList[TColumn]())
columns.foreach { c =>
tRowSet.addToColumns(ThriftResultSet.toTColumn(c))
}
Expand Down

0 comments on commit 9a4d0f1

Please sign in to comment.