{column_name: dob, validation_class: DateType}
的列族有列現在我要插入一個日期到通過CLI列。
當我嘗試插入它提供了以下錯誤的值:
"unable to coerce '1988-1-1'T'01:45:12:112' to a formatted date (long)"
我想如果有人能指出我在哪裏,我錯了會非常感激。
{column_name: dob, validation_class: DateType}
的列族有列現在我要插入一個日期到通過CLI列。
當我嘗試插入它提供了以下錯誤的值:
"unable to coerce '1988-1-1'T'01:45:12:112' to a formatted date (long)"
我想如果有人能指出我在哪裏,我錯了會非常感激。
你必須在unix時代的時間戳中轉換你的日期。
毫秒自Unix紀元時間戳的日期數量(1988年1月1日01:45:12.112 GMT + 0000(GMT)我在這裏假設GMT,沒有時區指定)爲567999912112.
假設你的CF模式定義是這樣的:
create column family test with column_type='Standard'
and key_validation_class = 'UTF8Type'
and comparator='UTF8Type'
and default_validation_class = 'UTF8Type'
and column_metadata = [
{column_name : 'dob', validation_class : DateType}
];
以下卡桑德拉CLI命令正確地插入你的約會:
set test['userID']['dob']=567999912112;
爲了測試它,嘗試:
get test['userID'];