与亚利桑那凤凰的列家族 [英] Column family with Apache Phoenix

查看:116
本文介绍了与亚利桑那凤凰的列家族的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了下面的表:

  CREATE TABLE IF NOT EXISTSevents(
product。 nameVARCHAR(32),
event.nameVARCHAR(32),
event.uuidVARCHAR(32),
CONSTRAINT pk PRIMARY KEY(event.uuid)

插入一个事件:

 插入events(event.uuid,event.name,product.name)值('1','click','api') 

从HBase shell获取数据:

  HBase的(主):020:0> scan'events'
ROW COLUMN + CELL
1 column = 0:_0,timestamp = 1449417795078,value =
1 column = 0:event.name,timestamp = 1449417795078,value = click
1 column = 0:product.name,timestamp = 1449417795078,value = api
1行(0.0200秒)

No column familty; - (

从HBase外壳尝试插入数据:

  hbase(main):021:0> put'events','2','event:name','buy'

ERROR :未知的列族!有效的列名称:0:*

为什么?

解决方案

双引号标识符区分大小写,所以如果您希望列系列和列名区分大小写,则需要将他们每个 separate 用双引号括起来:

  CREATE TABLE IF NOT EXISTSevents(
product。nameVARCHAR(32),
event。nameVARCHAR(32),
event。uuidVARCHAR(32),
CONSTRAINT pk PRIMARY KEY(event。uuid)

然后像这样插入:

  UPSERT INTOevents(event。uuid,event。name,product 。name)
VALUES('1','click','api')



<除非列名不明确,否则在UPSERT语句中不需要使用列名称来限定列名称。如果你不需要匹配现有数据的格式,另一种选择是不要双引号。否则,例如,请参阅常见问题。



FWIW,提问的最佳位置在我们的开发人员或用户邮件列表上。 。


I have create the following table:

CREATE TABLE IF NOT EXISTS "events" (
"product.name" VARCHAR(32),
"event.name" VARCHAR(32),
"event.uuid" VARCHAR(32),
CONSTRAINT pk PRIMARY KEY ("event.uuid")
)

Inserting an event:

upsert into "events" ("event.uuid", "event.name", "product.name") values('1', 'click', 'api')

Getting data from HBase shell:

hbase(main):020:0> scan 'events'
ROW                                                  COLUMN+CELL
 1                                                   column=0:_0, timestamp=1449417795078, value=
 1                                                   column=0:event.name, timestamp=1449417795078, value=click
 1                                                   column=0:product.name, timestamp=1449417795078, value=api
1 row(s) in 0.0200 seconds

No column familty ;-(

From HBase shell, trying to insert data:

hbase(main):021:0> put 'events', '2', 'event:name','buy'

ERROR: Unknown column family! Valid column names: 0:*

Why?

解决方案

A double quoted identifier makes it case sensitive, so if you want both the column family and the column name to be case sensitive, you'll need to surround them each separately in double quotes like this:

CREATE TABLE IF NOT EXISTS "events" (
    "product"."name" VARCHAR(32),
    "event"."name" VARCHAR(32),
    "event"."uuid" VARCHAR(32),
    CONSTRAINT pk PRIMARY KEY ("event"."uuid")
)

and then upsert like this:

UPSERT INTO "events" ("event"."uuid", "event"."name", "product"."name")
    VALUES ('1', 'click', 'api')

Qualifying the column name with the column family name is not required in the UPSERT statement unless the column name is ambiguous. If you don't need to match the format of existing data, another alternative is to just not double quote anything. Otherwise, for an example, see this FAQ.

FWIW, best place to ask question is on our dev or user mailing lists.

这篇关于与亚利桑那凤凰的列家族的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆