mardi 29 avril 2014

ruche cassandra insérer nulle exception - Stack Overflow


Trying to use hive to import data into Cassandra via DSE 3.1.3. It appears that inserting a NULL value is not supported via hive. Is this supported?


Contrived example:


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)



We will fix this issue. It can't serialize null into Hive




I just tried this out in the latest DSE release, 3.1.4, it works correctly now.


http://www.datastax.com/docs/datastax_enterprise3.1/dse_release_notes#datastax-enterprise-3-1-4-release-notes



Trying to use hive to import data into Cassandra via DSE 3.1.3. It appears that inserting a NULL value is not supported via hive. Is this supported?


Contrived example:


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)


We will fix this issue. It can't serialize null into Hive



I just tried this out in the latest DSE release, 3.1.4, it works correctly now.


http://www.datastax.com/docs/datastax_enterprise3.1/dse_release_notes#datastax-enterprise-3-1-4-release-notes


0 commentaires:

Enregistrer un commentaire