无法使用pig从cassandra加载简单表

ulydmbyx  于 2021-06-21  发布在  Pig
关注(0)|答案(1)|浏览(213)

我试图加载在cassandra sing cql命令中创建的简单表。但当我尝试转储时加载失败。我的pig脚本如下所示。

A = LOAD 'cql://pigtest/myusers' USING CqlStorage()
        AS (user_id:int,fname:chararray,lname:chararray);
    describe A;
    DUMP A;

我的用户表架构看起来像

CREATE TABLE users (
  user_id int ( primary key), 
  fnam text, 
  lname text
)

我遇到了以下异常(我尝试了cassandra2.0.9和2.1.0,以及pig0.13)。请帮助我们找到根本原因/

ERROR 1002: Unable to store alias A

    Caused by: InvalidRequestException(why:Expected 8 or 0 byte long (7))
        at org.apache.cassandra.thrift.Cassandra$execute_prepared_cql3_query_result$execute_prepared_cql3_query_resultStandardScheme.read(Cassandra.java:54918)
        at org.apache.cassandra.thrift.Cassandra$execute_prepared_cql3_query_result$execute_prepared_cql3_query_resultStandardScheme.read(Cassandra.java:54895)
        at org.apache.cassandra.thrift.Cassandra$execute_prepared_cql3_query_result.read(Cassandra.java:54810)
        at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:78)
        at org.apache.cassandra.thrift.Cassandra$Client.recv_execute_prepared_cql3_query(Cassandra.java:1861)
        at org.apache.cassandra.thrift.Cassandra$Client.execute_prepared_cql3_query(Cassandra.java:1846)
        at org.apache.cassandra.hadoop.cql3.CqlPagingRecordReader$RowIterator.executeQuery(CqlPagingRecordReader.java:635)
        ... 28 more
f4t66c6m

f4t66c6m1#

验证服务器和客户端上的分区程序是否相同。杂音分割器vs随机分割器

> cqlsh -e "describe cluster" | head

Cluster: Test Cluster
Partitioner: Murmur3Partitioner

-Pig手稿

set cassandra.input.partitioner.class org.apache.cassandra.dht.Murmur3Partitioner;
set cassandra.output.partitioner.class org.apache.cassandra.dht.Murmur3Partitioner;

相关问题