> the error "can not parse FUNCTION_CALL as hex bytes" is thrown in CLI, no log > printed on server. Is the conversion function > not allowed in "update column family" statement? Looks like functions are not supported in column meta data. You can raise a ticket if you want to https://issues.apache.org/jira/browse/CASSANDRA
Cheers ----------------- Aaron Morton Freelance Cassandra Consultant New Zealand @aaronmorton http://www.thelastpickle.com On 25/03/2013, at 2:03 PM, Xu Renjie <xrjxrjxrj...@gmail.com> wrote: > > > > On Mon, Mar 25, 2013 at 1:35 AM, aaron morton <aa...@thelastpickle.com> wrote: >> I tried to wrap 'name' to bytes('name'), but it would throw "can not parse >> FUNCTION_CALL as hex bytes", seems this does not work. > What was the statement you used and what was the error. > > OK, I have tried using ascii code 6e616d65(name) like below, it's OK now. > update column family User with column_metadata=[{column_name:6e616d65, > validation_class:BytesType, index_type:0}]; > > However, I tried using utf8('name') like below: > update column family User with column_metadata=[{column_name:utf8('name'), > validation_class:BytesType, index_type:0}]; > the error "can not parse FUNCTION_CALL as hex bytes" is thrown in CLI, no log > printed on server. Is the conversion function > not allowed in "update column family" statement? >> So the stored bytes are the same, right? > > Yes. > > ----------------- > Aaron Morton > Freelance Cassandra Consultant > New Zealand > > @aaronmorton > http://www.thelastpickle.com > > On 24/03/2013, at 11:53 PM, Xu Renjie <xrjxrjxrj...@gmail.com> wrote: > >> >> >> >> On Sun, Mar 24, 2013 at 1:45 AM, aaron morton <aa...@thelastpickle.com> >> wrote: >>> But a error is thrown saying "can not parse name as hex bytes". >> If the comparator is Bytes then the column names need to be a hex string. >> >> The easiest thing to do is create a CF where the comparator is UTF8Type so >> you can use string column names. >> >> And currently our column families are all of Bytes, since Cassandra cannot >> update the comparator, it's not easy to change to UTF8Type. >> I tried to wrap 'name' to bytes('name'), but it would throw "can not parse >> FUNCTION_CALL as hex bytes", seems this does not work. >>> just that the UTF8Type needs to be validated before storing the data into >>> database and BytesType need not to? >> >> It takes *very* little additional effort. >> >> Cheers >> >> >> ----------------- >> Aaron Morton >> Freelance Cassandra Consultant >> New Zealand >> >> @aaronmorton >> http://www.thelastpickle.com >> >> On 23/03/2013, at 12:10 AM, Xu Renjie <xrjxrjxrj...@gmail.com> wrote: >> >>> Sorry, continued: >>> I have created a column family User with no parameters specified, just >>> create column family User. >>> Then I checked that the default comparator is BytesType. >>> >>> Then I want to create secondary index on one column like below: >>> update column family User with column_metadata=[{column_name:name, >>> validation_class:BytesType, index_type:0}]; >>> But a error is thrown saying "can not parse name as hex bytes". >>> >>> So I wonder under this situation, is it possible to create index using >>> cassandra-cli, if possible, how? >>> >>> Furthermore, I wonder what's the difference of type BytesType and UTF8Type >>> and other types underlying. >>> If I store string 'name' into database, do they have the same internal >>> bytes stored in Cassandra, >>> just that the UTF8Type needs to be validated before storing the data into >>> database and BytesType need not to? >>> >>> >>> On Fri, Mar 22, 2013 at 7:00 PM, Xu Renjie <xrjxrjxrj...@gmail.com> wrote: >>> Hello, guys: >>> I am new to Cassandra. I am currently using cassandra-cli(version >>> 1.1.6). >>> >> >> > >