尝试使用 hive 通过 DSE 3.1.3 将数据导入 Cassandra。似乎不支持通过 hive 插入 NULL 值。这支持吗?
人为的例子:
cqlsh:
create table foo(id text, name text, primary key(id));
create table fooo(id text, name text, primary key(id));
insert into foo(id,name) values('a',null);
hive: (use keyspace where foo and fooo were created)
insert into table fooo select id,null from foo;
Stack from jobtracker...
java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runtime Error while processing row {"id":"a","name":""}
at org.apache.hadoop.hive.ql.exec.ExecMapper.map(ExecMapper.java:161)
at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:50)
at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:436)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:372)
at org.apache.hadoop.mapred.Child$4.run(Child.java:266)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:396)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1121)
at org.apache.hadoop.mapred.Child.main(Child.java:260)
Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runtime Error while processing row {"id":"a","name":""}
at org.apache.hadoop.hive.ql.exec.MapOperator.process(MapOperator.java:548)
at org.apache.hadoop.hive.ql.exec.ExecMapper.map(ExecMapper.java:143)
... 8 more
Caused by: java.lang.NullPointerException
at org.apache.hadoop.hive.serde2.lazy.LazyUtils.writePrimitiveUTF8(LazyUtils.java:220)
at org.apache.hadoop.hive.cassandra.serde.AbstractTableMapping.serialize(AbstractTableMapping.java:149)
at org.apache.hadoop.hive.cassandra.serde.AbstractTableMapping.serializeToBytes(AbstractTableMapping.java:118)
at org.apache.hadoop.hive.cassandra.cql3.serde.CqlTableMapping.getWritable(CqlTableMapping.java:53)
at org.apache.hadoop.hive.cassandra.serde.AbstractColumnSerDe.serialize(AbstractColumnSerDe.java:150)