You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@livy.apache.org by js...@apache.org on 2019/08/22 06:03:50 UTC

[incubator-livy] branch master updated: [LIVY-637][THRIFTSERVER] Fix NullPointerException when create database using thriftserver

This is an automated email from the ASF dual-hosted git repository.

jshao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-livy.git


The following commit(s) were added to refs/heads/master by this push:
     new 9a4d0f1  [LIVY-637][THRIFTSERVER] Fix NullPointerException when create database using thriftserver
9a4d0f1 is described below

commit 9a4d0f1139de7ffa1f456f42eb05fd93d23616bc
Author: micahzhao <mi...@tencent.com>
AuthorDate: Thu Aug 22 14:03:27 2019 +0800

    [LIVY-637][THRIFTSERVER] Fix NullPointerException when create database 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 <mi...@tencent.com>
    
    Closes #200 from captainzmc/livy-637.
---
 .../scala/org/apache/livy/thriftserver/serde/ThriftResultSet.scala     | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/thriftserver/server/src/main/scala/org/apache/livy/thriftserver/serde/ThriftResultSet.scala b/thriftserver/server/src/main/scala/org/apache/livy/thriftserver/serde/ThriftResultSet.scala
index e555b34..2a58c4a 100644
--- a/thriftserver/server/src/main/scala/org/apache/livy/thriftserver/serde/ThriftResultSet.scala
+++ b/thriftserver/server/src/main/scala/org/apache/livy/thriftserver/serde/ThriftResultSet.scala
@@ -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))
     }