这是我的Cassandra架构,使用Datastax企业版
CREATE KEYSPACE applications
WITH replication = {'class': 'SimpleStrategy', 'replication_factor' : 1};
USE applications;
CREATE TABLE events(
bucket text,
id timeuuid,
app_id uuid,
event text,
PRIMARY KEY(bucket, id)
);
我希望在PIG中通过app_id
(TimeUUID)和id
(UUID)来进行筛选,以下是我的Pig脚本。
events = LOAD 'cql://applications/events'
USING CqlStorage()
AS (bucket: chararray, id: chararray, app_id: chararray, event: chararray);
result = FOREACH events GENERATE bucket, id, app_id;
DESCRIBE result;
DUMP result;
这是结果。
result: {bucket: chararray,id: chararray,app_id: chararray}
(2014-02-28-04,?O]??4??p??M?,;??F? (|?Mb) \n
(2014-02-28-04,?O??4??p??M?,?h^@?E????)
(2014-02-28-04,?V???4??p??M?,;??F? (|?Mb)
(2014-02-28-04,?W?0?4??p??M?,?h^@?E????)
(2014-02-28-04,?X^p?4??p??M?,?h^@?E????)
注意,
app_id
和id
字段是二进制的,我需要通过一些UUID进行过滤,有什么建议吗?