You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@phoenix.apache.org by 曾柏棠 <ze...@qq.com> on 2017/07/14 07:29:29 UTC
Can set default value for column in phoenix ?
hi all,
Can set default value for column in phoenix ?
for example :
CREATE TABLE api.hahah(
subscribe_time bigint not null ,
hahha varchar default 'aaa',
CONSTRAINT pk PRIMARY KEY (subscribe_time)
)
Thanks !
Re: Can set default value for column in phoenix ?
Posted by James Taylor <ja...@apache.org>.
Only constant expressions are allowed for default value currently (as
mentioned by Juvenn). PHOENIX-3425 is for supporting expressions such as
CURRENT_DATE and NEXT VALUE FOR.
On Fri, Jul 14, 2017 at 7:22 AM Ankit Singhal <an...@gmail.com>
wrote:
> Phoenix 4.9 onwards you can specify any expression for default column.
> (I'm not sure if there is any limitation called out).
> For syntax:-
> https://phoenix.apache.org/language/index.html#column_def
>
> For examples-
>
> https://github.com/apache/phoenix/blob/2d40241b5c5c0287dca3dd2e2476db328bb7e7de/phoenix-core/src/it/java/org/apache/phoenix/end2end/DefaultColumnValueIT.java
>
> On Fri, Jul 14, 2017 at 1:38 PM, 曾柏棠 <ze...@qq.com> wrote:
>
>> Oh ,thanks!
>>
>>
>> ------------------ 原始邮件 ------------------
>> *发件人:* "Juvenn Woo";<ma...@gmail.com>;
>> *发送时间:* 2017年7月14日(星期五) 下午3:39
>> *收件人:* "user"<us...@phoenix.apache.org>;
>> *主题:* Re: Can set default value for column in phoenix ?
>>
>> Hi Baitang,
>>
>> Yes, you can, but only constant value at the moment. So literal value
>> such as ‘string’, 0, 0.0 would work well, but CURRENT_TIME will not. (As
>> far as I know.)
>>
>> Best,
>> --
>> Juvenn Woo
>> Sent with Sparrow <http://www.sparrowmailapp.com/?sig>
>>
>> On Friday, 14 July 2017 at 3:29 PM, 曾柏棠 wrote:
>>
>> hi all,
>> Can set default value for column in phoenix ?
>> for example :
>>
>> CREATE TABLE api.hahah(
>> subscribe_time bigint not null ,
>> *hahha varchar default 'aaa',*
>> CONSTRAINT pk PRIMARY KEY (subscribe_time)
>> )
>>
>> Thanks !
>>
>>
>>
>
Re: Can set default value for column in phoenix ?
Posted by Ankit Singhal <an...@gmail.com>.
Phoenix 4.9 onwards you can specify any expression for default column. (I'm
not sure if there is any limitation called out).
For syntax:-
https://phoenix.apache.org/language/index.html#column_def
For examples-
https://github.com/apache/phoenix/blob/2d40241b5c5c0287dca3dd2e2476db328bb7e7de/phoenix-core/src/it/java/org/apache/phoenix/end2end/DefaultColumnValueIT.java
On Fri, Jul 14, 2017 at 1:38 PM, 曾柏棠 <ze...@qq.com> wrote:
> Oh ,thanks!
>
>
> ------------------ 原始邮件 ------------------
> *发件人:* "Juvenn Woo";<ma...@gmail.com>;
> *发送时间:* 2017年7月14日(星期五) 下午3:39
> *收件人:* "user"<us...@phoenix.apache.org>;
> *主题:* Re: Can set default value for column in phoenix ?
>
> Hi Baitang,
>
> Yes, you can, but only constant value at the moment. So literal value such
> as ‘string’, 0, 0.0 would work well, but CURRENT_TIME will not. (As far as
> I know.)
>
> Best,
> --
> Juvenn Woo
> Sent with Sparrow <http://www.sparrowmailapp.com/?sig>
>
> On Friday, 14 July 2017 at 3:29 PM, 曾柏棠 wrote:
>
> hi all,
> Can set default value for column in phoenix ?
> for example :
>
> CREATE TABLE api.hahah(
> subscribe_time bigint not null ,
> *hahha varchar default 'aaa',*
> CONSTRAINT pk PRIMARY KEY (subscribe_time)
> )
>
> Thanks !
>
>
>
回复: Can set default value for column in phoenix ?
Posted by 曾柏棠 <ze...@qq.com>.
Oh ,thanks!
------------------ 原始邮件 ------------------
发件人: "Juvenn Woo";<ma...@gmail.com>;
发送时间: 2017年7月14日(星期五) 下午3:39
收件人: "user"<us...@phoenix.apache.org>;
主题: Re: Can set default value for column in phoenix ?
Hi Baitang,
Yes, you can, but only constant value at the moment. So literal value such as ‘string’, 0, 0.0 would work well, but CURRENT_TIME will not. (As far as I know.)
Best,
--
Juvenn Woo
Sent with Sparrow
On Friday, 14 July 2017 at 3:29 PM, 曾柏棠 wrote:
hi all,
Can set default value for column in phoenix ?
for example :
CREATE TABLE api.hahah(
subscribe_time bigint not null ,
hahha varchar default 'aaa',
CONSTRAINT pk PRIMARY KEY (subscribe_time)
)
Thanks !
Re: Can set default value for column in phoenix ?
Posted by Juvenn Woo <ma...@gmail.com>.
Hi Baitang,
Yes, you can, but only constant value at the moment. So literal value such as ‘string’, 0, 0.0 would work well, but CURRENT_TIME will not. (As far as I know.)
Best,
--
Juvenn Woo
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)
On Friday, 14 July 2017 at 3:29 PM, 曾柏棠 wrote:
> hi all,
> Can set default value for column in phoenix ?
> for example :
>
> CREATE TABLE api.hahah(
> subscribe_time bigint not null ,
> hahha varchar default 'aaa',
> CONSTRAINT pk PRIMARY KEY (subscribe_time)
> )
>
>
> Thanks !
>