You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Artem Ervits (JIRA)" <ji...@apache.org> on 2018/11/20 19:51:00 UTC

[jira] [Assigned] (HBASE-21304) HBaseBulkGetExample throws NullPointerException

     [ https://issues.apache.org/jira/browse/HBASE-21304?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Artem Ervits reassigned HBASE-21304:
------------------------------------

    Assignee: Artem Ervits

> HBaseBulkGetExample throws NullPointerException
> -----------------------------------------------
>
>                 Key: HBASE-21304
>                 URL: https://issues.apache.org/jira/browse/HBASE-21304
>             Project: HBase
>          Issue Type: Bug
>          Components: spark
>    Affects Versions: 3.0.0
>            Reporter: Carlos A. Morillo
>            Assignee: Artem Ervits
>            Priority: Minor
>              Labels: beginner
>
> Running the HBaseContext Examples available at [https://github.com/apache/hbase/tree/master/hbase-spark/src/main/scala/org/apache/hadoop/hbase/spark/example/hbasecontext]
>  
> If you run them in sequence, let's say you run first HBaseBulkPutExample [https://github.com/apache/hbase/blob/master/hbase-spark/src/main/scala/org/apache/hadoop/hbase/spark/example/rdd/HBaseBulkPutExample.scala]
> and immediately after you run HBaseBulkGetExample [https://github.com/apache/hbase/blob/master/hbase-spark/src/main/scala/org/apache/hadoop/hbase/spark/example/rdd/HBaseBulkGetExample.scala]
> You get a NullPointerException.
> In the API [https://github.com/apache/hbase/blob/master/hbase-spark/src/main/scala/org/apache/hadoop/hbase/spark/example/hbasecontext/HBaseBulkGetExample.scala] we have:
> h4. defhbaseBulkGet(hc: [HBaseContext|http://hbase.apache.org/hbase-spark/scaladocs/org/apache/hadoop/hbase/spark/HBaseContext.html], tableName: TableName, batchSize: Int, f: (T) ⇒ Get): RDD[(ImmutableBytesWritable, Result)]
> Implicit method that gives easy access to HBaseContext's bulk get. This will return a new RDD. Think about it as a RDD map function. In that every RDD value will get a new value out of HBase. That new value will populate the newly generated RDD.
> hc
> The hbaseContext object to identify which HBase cluster connection to use
> tableName
> The tableName that the put will be sent to
> batchSize
> How many gets to execute in a single batch
> f
> The function that will turn the RDD values in HBase Get objects
> returns
> A resulting RDD with type R objects
> So it seems the function f passed to should be modified as an Scala partial function to handle the case when the Result is null.
> One possible fix would be {color:#000000}to call in an{color}{color:#000000} if {{[Result.isEmpty()|https://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/Result.html#isEmpty--] to make sure it isn't empty.}}{color}
> {color:#000000}{{The API for Result.listCells expressly says it can return null if there are no results.}}{color}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)