You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ps...@apache.org on 2019/02/12 13:17:12 UTC
[hbase-connectors] branch master updated: HBASE-21841 Allow
inserting null values throw DataSource API
This is an automated email from the ASF dual-hosted git repository.
psomogyi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase-connectors.git
The following commit(s) were added to refs/heads/master by this push:
new b320e68 HBASE-21841 Allow inserting null values throw DataSource API
b320e68 is described below
commit b320e68377e3997dd139f2de9dd73829bc8768e2
Author: Balazs Meszaros <ba...@cloudera.com>
AuthorDate: Mon Feb 4 15:14:52 2019 +0100
HBASE-21841 Allow inserting null values throw DataSource API
---
.../main/scala/org/apache/hadoop/hbase/spark/DefaultSource.scala | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/spark/hbase-spark/src/main/scala/org/apache/hadoop/hbase/spark/DefaultSource.scala b/spark/hbase-spark/src/main/scala/org/apache/hadoop/hbase/spark/DefaultSource.scala
index 4e05695..d9d5a66 100644
--- a/spark/hbase-spark/src/main/scala/org/apache/hadoop/hbase/spark/DefaultSource.scala
+++ b/spark/hbase-spark/src/main/scala/org/apache/hadoop/hbase/spark/DefaultSource.scala
@@ -222,8 +222,11 @@ case class HBaseRelation (
val put = timestamp.fold(new Put(rBytes))(new Put(rBytes, _))
colsIdxedFields.foreach { case (x, y) =>
- val b = Utils.toBytes(row(x), y)
- put.addColumn(Bytes.toBytes(y.cf), Bytes.toBytes(y.col), b)
+ val r = row(x)
+ if (r != null) {
+ val b = Utils.toBytes(r, y)
+ put.addColumn(Bytes.toBytes(y.cf), Bytes.toBytes(y.col), b)
+ }
}
count += 1
(new ImmutableBytesWritable, put)