Re: How can I implement 'LIKE operation in SQL' on values while querying a column family in Cassandra
Sorry for the confusion Tamar. Any ways thanks dear. Regards, Abhijit On Tue, May 15, 2012 at 9:36 PM, Tamar Fraenkel wrote: > Actually woman ;-) > > *Tamar Fraenkel * > Senior Software Engineer, TOK Media > > [image: Inline image 1] > > ta...@tok-media.com > Tel: +972 2 6409736 > Mob: +972 54 8356490 > Fax: +972 2 5612956 > > > > > > On Tue, May 15, 2012 at 3:45 PM, Abhijit Chanda > wrote: > >> Thanks so much Guys, specially Tamar, thank you so much man. >> >> Regards, >> Abhijit >> >> >> On Tue, May 15, 2012 at 4:26 PM, Tamar Fraenkel wrote: >> >>> Do you still need the sample code? I use Hector, well here is an example: >>> *This is the Column Family definition:* >>> (I have a composite, but if you like you can have only the UTF8Type). >>> >>> CREATE COLUMN FAMILY title_indx >>> with comparator = 'CompositeType(UTF8Type,UUIDType)' >>> and default_validation_class = 'UTF8Type' >>> and key_validation_class = 'LongType'; >>> >>> *The Query:* >>> SliceQuery query = >>> HFactory.createSliceQuery(CassandraHectorConn.getKeyspace(), >>> LongSerializer.get(), >>> CompositeSerializer.get(), >>> StringSerializer.get()); >>> query.setColumnFamily("title_indx"); >>> query.setKey(...) >>> >>> Composite start = new Composite(); >>> start.add(prefix); >>> char c = lowerCasePrefix.charAt(lastCharIndex); >>> String prefixEnd = prefix.substring(0, lastCharIndex) + ++c; >>> Composite end = new Composite(); >>> end.add(prefixEnd); >>> >>> ColumnSliceIterator iterator = >>> new ColumnSliceIterator( >>>query, start, end, false) >>> while (iterator.hasNext()) { >>> ... >>>} >>> >>> Cheers, >>> >>> *Tamar Fraenkel * >>> Senior Software Engineer, TOK Media >>> >>> [image: Inline image 1] >>> >>> ta...@tok-media.com >>> Tel: +972 2 6409736 >>> Mob: +972 54 8356490 >>> Fax: +972 2 5612956 >>> >>> >>> >>> >>> >>> On Tue, May 15, 2012 at 1:19 PM, samal wrote: >>> You cannot extract via relative column value. It can only extract via value if it has secondary index but exact column value need to match. as tamar suggested you can put value as column "name" , UTF8 comparator. { 'name_abhijit'=>'abhijit' 'name_abhishek'=>'abhiskek' 'name_atul'=>'atul' } here you can do slice query on column name and get desired result. /samal On Tue, May 15, 2012 at 3:29 PM, selam wrote: > Mapreduce jobs may solve your problem for batch processing > > > On Tue, May 15, 2012 at 12:49 PM, Abhijit Chanda < > abhijit.chan...@gmail.com> wrote: > >> Tamar, >> >> Can you please illustrate little bit with some sample code. It highly >> appreciable. >> >> Thanks, >> >> >> On Tue, May 15, 2012 at 10:48 AM, Tamar Fraenkel > > wrote: >> >>> I don't think this is possible, the best you can do is prefix, if >>> your order is alphabetical. For example I have a CF with >>> comparator UTF8Type, and then I can do slice query and bring all columns >>> that start with the prefix, and end with the prefix where you replace >>> the >>> last char with the next one in order (i.e. "aaa"-"aab"). >>> >>> Hope that helps. >>> >>> *Tamar Fraenkel * >>> Senior Software Engineer, TOK Media >>> >>> [image: Inline image 1] >>> >>> ta...@tok-media.com >>> Tel: +972 2 6409736 >>> Mob: +972 54 8356490 >>> Fax: +972 2 5612956 >>> >>> >>> >>> >>> >>> On Tue, May 15, 2012 at 7:56 AM, Abhijit Chanda < >>> abhijit.chan...@gmail.com> wrote: >>> I don't know the exact value on a column, but I want to do a partial matching to know all available values that matches. I want to do similar kind of operation that LIKE operator in SQL do. Any help is highly appreciated. -- Abhijit Chanda Software Developer VeHere Interactive Pvt. Ltd. +91-974395 >>> >> >> >> -- >> Abhijit Chanda >> Software Developer >> VeHere Interactive Pvt. Ltd. >> +91-974395 >> >> > > > -- > Saygılar && İyi Çalışmalar > Timu EREN ( a.k.a selam ) > >>> >> >> >> -- >> Abhijit Chanda >> Software Developer >> VeHere Interactive Pvt. Ltd. >> +91-974395 >> >> > -- Abhijit Chanda Software Developer VeHere Interactive Pvt. Ltd. +91-974395 <>
Re: How can I implement 'LIKE operation in SQL' on values while querying a column family in Cassandra
Actually woman ;-) *Tamar Fraenkel * Senior Software Engineer, TOK Media [image: Inline image 1] ta...@tok-media.com Tel: +972 2 6409736 Mob: +972 54 8356490 Fax: +972 2 5612956 On Tue, May 15, 2012 at 3:45 PM, Abhijit Chanda wrote: > Thanks so much Guys, specially Tamar, thank you so much man. > > Regards, > Abhijit > > > On Tue, May 15, 2012 at 4:26 PM, Tamar Fraenkel wrote: > >> Do you still need the sample code? I use Hector, well here is an example: >> *This is the Column Family definition:* >> (I have a composite, but if you like you can have only the UTF8Type). >> >> CREATE COLUMN FAMILY title_indx >> with comparator = 'CompositeType(UTF8Type,UUIDType)' >> and default_validation_class = 'UTF8Type' >> and key_validation_class = 'LongType'; >> >> *The Query:* >> SliceQuery query = >> HFactory.createSliceQuery(CassandraHectorConn.getKeyspace(), >> LongSerializer.get(), >> CompositeSerializer.get(), >> StringSerializer.get()); >> query.setColumnFamily("title_indx"); >> query.setKey(...) >> >> Composite start = new Composite(); >> start.add(prefix); >> char c = lowerCasePrefix.charAt(lastCharIndex); >> String prefixEnd = prefix.substring(0, lastCharIndex) + ++c; >> Composite end = new Composite(); >> end.add(prefixEnd); >> >> ColumnSliceIterator iterator = >> new ColumnSliceIterator( >>query, start, end, false) >> while (iterator.hasNext()) { >> ... >>} >> >> Cheers, >> >> *Tamar Fraenkel * >> Senior Software Engineer, TOK Media >> >> [image: Inline image 1] >> >> ta...@tok-media.com >> Tel: +972 2 6409736 >> Mob: +972 54 8356490 >> Fax: +972 2 5612956 >> >> >> >> >> >> On Tue, May 15, 2012 at 1:19 PM, samal wrote: >> >>> You cannot extract via relative column value. >>> It can only extract via value if it has secondary index but exact column >>> value need to match. >>> >>> as tamar suggested you can put value as column "name" , UTF8 comparator. >>> >>> { >>> 'name_abhijit'=>'abhijit' >>> 'name_abhishek'=>'abhiskek' >>> 'name_atul'=>'atul' >>> } >>> >>> here you can do slice query on column name and get desired result. >>> >>> /samal >>> >>> On Tue, May 15, 2012 at 3:29 PM, selam wrote: >>> Mapreduce jobs may solve your problem for batch processing On Tue, May 15, 2012 at 12:49 PM, Abhijit Chanda < abhijit.chan...@gmail.com> wrote: > Tamar, > > Can you please illustrate little bit with some sample code. It highly > appreciable. > > Thanks, > > > On Tue, May 15, 2012 at 10:48 AM, Tamar Fraenkel > wrote: > >> I don't think this is possible, the best you can do is prefix, if >> your order is alphabetical. For example I have a CF with >> comparator UTF8Type, and then I can do slice query and bring all columns >> that start with the prefix, and end with the prefix where you replace the >> last char with the next one in order (i.e. "aaa"-"aab"). >> >> Hope that helps. >> >> *Tamar Fraenkel * >> Senior Software Engineer, TOK Media >> >> [image: Inline image 1] >> >> ta...@tok-media.com >> Tel: +972 2 6409736 >> Mob: +972 54 8356490 >> Fax: +972 2 5612956 >> >> >> >> >> >> On Tue, May 15, 2012 at 7:56 AM, Abhijit Chanda < >> abhijit.chan...@gmail.com> wrote: >> >>> I don't know the exact value on a column, but I want to do a partial >>> matching to know all available values that matches. >>> I want to do similar kind of operation that LIKE operator in SQL do. >>> Any help is highly appreciated. >>> >>> -- >>> Abhijit Chanda >>> Software Developer >>> VeHere Interactive Pvt. Ltd. >>> +91-974395 >>> >>> >> > > > -- > Abhijit Chanda > Software Developer > VeHere Interactive Pvt. Ltd. > +91-974395 > > -- Saygılar && İyi Çalışmalar Timu EREN ( a.k.a selam ) >>> >>> >> > > > -- > Abhijit Chanda > Software Developer > VeHere Interactive Pvt. Ltd. > +91-974395 > > <><>
Re: How can I implement 'LIKE operation in SQL' on values while querying a column family in Cassandra
Thanks so much Guys, specially Tamar, thank you so much man. Regards, Abhijit On Tue, May 15, 2012 at 4:26 PM, Tamar Fraenkel wrote: > Do you still need the sample code? I use Hector, well here is an example: > *This is the Column Family definition:* > (I have a composite, but if you like you can have only the UTF8Type). > > CREATE COLUMN FAMILY title_indx > with comparator = 'CompositeType(UTF8Type,UUIDType)' > and default_validation_class = 'UTF8Type' > and key_validation_class = 'LongType'; > > *The Query:* > SliceQuery query = > HFactory.createSliceQuery(CassandraHectorConn.getKeyspace(), > LongSerializer.get(), > CompositeSerializer.get(), > StringSerializer.get()); > query.setColumnFamily("title_indx"); > query.setKey(...) > > Composite start = new Composite(); > start.add(prefix); > char c = lowerCasePrefix.charAt(lastCharIndex); > String prefixEnd = prefix.substring(0, lastCharIndex) + ++c; > Composite end = new Composite(); > end.add(prefixEnd); > > ColumnSliceIterator iterator = > new ColumnSliceIterator( >query, start, end, false) > while (iterator.hasNext()) { > ... >} > > Cheers, > > *Tamar Fraenkel * > Senior Software Engineer, TOK Media > > [image: Inline image 1] > > ta...@tok-media.com > Tel: +972 2 6409736 > Mob: +972 54 8356490 > Fax: +972 2 5612956 > > > > > > On Tue, May 15, 2012 at 1:19 PM, samal wrote: > >> You cannot extract via relative column value. >> It can only extract via value if it has secondary index but exact column >> value need to match. >> >> as tamar suggested you can put value as column "name" , UTF8 comparator. >> >> { >> 'name_abhijit'=>'abhijit' >> 'name_abhishek'=>'abhiskek' >> 'name_atul'=>'atul' >> } >> >> here you can do slice query on column name and get desired result. >> >> /samal >> >> On Tue, May 15, 2012 at 3:29 PM, selam wrote: >> >>> Mapreduce jobs may solve your problem for batch processing >>> >>> >>> On Tue, May 15, 2012 at 12:49 PM, Abhijit Chanda < >>> abhijit.chan...@gmail.com> wrote: >>> Tamar, Can you please illustrate little bit with some sample code. It highly appreciable. Thanks, On Tue, May 15, 2012 at 10:48 AM, Tamar Fraenkel wrote: > I don't think this is possible, the best you can do is prefix, if your > order is alphabetical. For example I have a CF with comparator UTF8Type, > and then I can do slice query and bring all columns that start with the > prefix, and end with the prefix where you replace the last char with > the next one in order (i.e. "aaa"-"aab"). > > Hope that helps. > > *Tamar Fraenkel * > Senior Software Engineer, TOK Media > > [image: Inline image 1] > > ta...@tok-media.com > Tel: +972 2 6409736 > Mob: +972 54 8356490 > Fax: +972 2 5612956 > > > > > > On Tue, May 15, 2012 at 7:56 AM, Abhijit Chanda < > abhijit.chan...@gmail.com> wrote: > >> I don't know the exact value on a column, but I want to do a partial >> matching to know all available values that matches. >> I want to do similar kind of operation that LIKE operator in SQL do. >> Any help is highly appreciated. >> >> -- >> Abhijit Chanda >> Software Developer >> VeHere Interactive Pvt. Ltd. >> +91-974395 >> >> > -- Abhijit Chanda Software Developer VeHere Interactive Pvt. Ltd. +91-974395 >>> >>> >>> -- >>> Saygılar && İyi Çalışmalar >>> Timu EREN ( a.k.a selam ) >>> >> >> > -- Abhijit Chanda Software Developer VeHere Interactive Pvt. Ltd. +91-974395 <>
Re: How can I implement 'LIKE operation in SQL' on values while querying a column family in Cassandra
Do you still need the sample code? I use Hector, well here is an example: *This is the Column Family definition:* (I have a composite, but if you like you can have only the UTF8Type). CREATE COLUMN FAMILY title_indx with comparator = 'CompositeType(UTF8Type,UUIDType)' and default_validation_class = 'UTF8Type' and key_validation_class = 'LongType'; *The Query:* SliceQuery query = HFactory.createSliceQuery(CassandraHectorConn.getKeyspace(), LongSerializer.get(), CompositeSerializer.get(), StringSerializer.get()); query.setColumnFamily("title_indx"); query.setKey(...) Composite start = new Composite(); start.add(prefix); char c = lowerCasePrefix.charAt(lastCharIndex); String prefixEnd = prefix.substring(0, lastCharIndex) + ++c; Composite end = new Composite(); end.add(prefixEnd); ColumnSliceIterator iterator = new ColumnSliceIterator( query, start, end, false) while (iterator.hasNext()) { ... } Cheers, *Tamar Fraenkel * Senior Software Engineer, TOK Media [image: Inline image 1] ta...@tok-media.com Tel: +972 2 6409736 Mob: +972 54 8356490 Fax: +972 2 5612956 On Tue, May 15, 2012 at 1:19 PM, samal wrote: > You cannot extract via relative column value. > It can only extract via value if it has secondary index but exact column > value need to match. > > as tamar suggested you can put value as column "name" , UTF8 comparator. > > { > 'name_abhijit'=>'abhijit' > 'name_abhishek'=>'abhiskek' > 'name_atul'=>'atul' > } > > here you can do slice query on column name and get desired result. > > /samal > > On Tue, May 15, 2012 at 3:29 PM, selam wrote: > >> Mapreduce jobs may solve your problem for batch processing >> >> >> On Tue, May 15, 2012 at 12:49 PM, Abhijit Chanda < >> abhijit.chan...@gmail.com> wrote: >> >>> Tamar, >>> >>> Can you please illustrate little bit with some sample code. It highly >>> appreciable. >>> >>> Thanks, >>> >>> >>> On Tue, May 15, 2012 at 10:48 AM, Tamar Fraenkel wrote: >>> I don't think this is possible, the best you can do is prefix, if your order is alphabetical. For example I have a CF with comparator UTF8Type, and then I can do slice query and bring all columns that start with the prefix, and end with the prefix where you replace the last char with the next one in order (i.e. "aaa"-"aab"). Hope that helps. *Tamar Fraenkel * Senior Software Engineer, TOK Media [image: Inline image 1] ta...@tok-media.com Tel: +972 2 6409736 Mob: +972 54 8356490 Fax: +972 2 5612956 On Tue, May 15, 2012 at 7:56 AM, Abhijit Chanda < abhijit.chan...@gmail.com> wrote: > I don't know the exact value on a column, but I want to do a partial > matching to know all available values that matches. > I want to do similar kind of operation that LIKE operator in SQL do. > Any help is highly appreciated. > > -- > Abhijit Chanda > Software Developer > VeHere Interactive Pvt. Ltd. > +91-974395 > > >>> >>> >>> -- >>> Abhijit Chanda >>> Software Developer >>> VeHere Interactive Pvt. Ltd. >>> +91-974395 >>> >>> >> >> >> -- >> Saygılar && İyi Çalışmalar >> Timu EREN ( a.k.a selam ) >> > > <><>
Re: How can I implement 'LIKE operation in SQL' on values while querying a column family in Cassandra
You cannot extract via relative column value. It can only extract via value if it has secondary index but exact column value need to match. as tamar suggested you can put value as column "name" , UTF8 comparator. { 'name_abhijit'=>'abhijit' 'name_abhishek'=>'abhiskek' 'name_atul'=>'atul' } here you can do slice query on column name and get desired result. /samal On Tue, May 15, 2012 at 3:29 PM, selam wrote: > Mapreduce jobs may solve your problem for batch processing > > > On Tue, May 15, 2012 at 12:49 PM, Abhijit Chanda < > abhijit.chan...@gmail.com> wrote: > >> Tamar, >> >> Can you please illustrate little bit with some sample code. It highly >> appreciable. >> >> Thanks, >> >> >> On Tue, May 15, 2012 at 10:48 AM, Tamar Fraenkel wrote: >> >>> I don't think this is possible, the best you can do is prefix, if your >>> order is alphabetical. For example I have a CF with comparator UTF8Type, >>> and then I can do slice query and bring all columns that start with the >>> prefix, and end with the prefix where you replace the last char with >>> the next one in order (i.e. "aaa"-"aab"). >>> >>> Hope that helps. >>> >>> *Tamar Fraenkel * >>> Senior Software Engineer, TOK Media >>> >>> [image: Inline image 1] >>> >>> ta...@tok-media.com >>> Tel: +972 2 6409736 >>> Mob: +972 54 8356490 >>> Fax: +972 2 5612956 >>> >>> >>> >>> >>> >>> On Tue, May 15, 2012 at 7:56 AM, Abhijit Chanda < >>> abhijit.chan...@gmail.com> wrote: >>> I don't know the exact value on a column, but I want to do a partial matching to know all available values that matches. I want to do similar kind of operation that LIKE operator in SQL do. Any help is highly appreciated. -- Abhijit Chanda Software Developer VeHere Interactive Pvt. Ltd. +91-974395 >>> >> >> >> -- >> Abhijit Chanda >> Software Developer >> VeHere Interactive Pvt. Ltd. >> +91-974395 >> >> > > > -- > Saygılar && İyi Çalışmalar > Timu EREN ( a.k.a selam ) > <>
Re: How can I implement 'LIKE operation in SQL' on values while querying a column family in Cassandra
Mapreduce jobs may solve your problem for batch processing On Tue, May 15, 2012 at 12:49 PM, Abhijit Chanda wrote: > Tamar, > > Can you please illustrate little bit with some sample code. It highly > appreciable. > > Thanks, > > > On Tue, May 15, 2012 at 10:48 AM, Tamar Fraenkel wrote: > >> I don't think this is possible, the best you can do is prefix, if your >> order is alphabetical. For example I have a CF with comparator UTF8Type, >> and then I can do slice query and bring all columns that start with the >> prefix, and end with the prefix where you replace the last char with the >> next one in order (i.e. "aaa"-"aab"). >> >> Hope that helps. >> >> *Tamar Fraenkel * >> Senior Software Engineer, TOK Media >> >> [image: Inline image 1] >> >> ta...@tok-media.com >> Tel: +972 2 6409736 >> Mob: +972 54 8356490 >> Fax: +972 2 5612956 >> >> >> >> >> >> On Tue, May 15, 2012 at 7:56 AM, Abhijit Chanda < >> abhijit.chan...@gmail.com> wrote: >> >>> I don't know the exact value on a column, but I want to do a partial >>> matching to know all available values that matches. >>> I want to do similar kind of operation that LIKE operator in SQL do. >>> Any help is highly appreciated. >>> >>> -- >>> Abhijit Chanda >>> Software Developer >>> VeHere Interactive Pvt. Ltd. >>> +91-974395 >>> >>> >> > > > -- > Abhijit Chanda > Software Developer > VeHere Interactive Pvt. Ltd. > +91-974395 > > -- Saygılar && İyi Çalışmalar Timu EREN ( a.k.a selam ) <>
Re: How can I implement 'LIKE operation in SQL' on values while querying a column family in Cassandra
Tamar, Can you please illustrate little bit with some sample code. It highly appreciable. Thanks, On Tue, May 15, 2012 at 10:48 AM, Tamar Fraenkel wrote: > I don't think this is possible, the best you can do is prefix, if your > order is alphabetical. For example I have a CF with comparator UTF8Type, > and then I can do slice query and bring all columns that start with the > prefix, and end with the prefix where you replace the last char with the > next one in order (i.e. "aaa"-"aab"). > > Hope that helps. > > *Tamar Fraenkel * > Senior Software Engineer, TOK Media > > [image: Inline image 1] > > ta...@tok-media.com > Tel: +972 2 6409736 > Mob: +972 54 8356490 > Fax: +972 2 5612956 > > > > > > On Tue, May 15, 2012 at 7:56 AM, Abhijit Chanda > wrote: > >> I don't know the exact value on a column, but I want to do a partial >> matching to know all available values that matches. >> I want to do similar kind of operation that LIKE operator in SQL do. >> Any help is highly appreciated. >> >> -- >> Abhijit Chanda >> Software Developer >> VeHere Interactive Pvt. Ltd. >> +91-974395 >> >> > -- Abhijit Chanda Software Developer VeHere Interactive Pvt. Ltd. +91-974395 <>
Re: How can I implement 'LIKE operation in SQL' on values while querying a column family in Cassandra
I don't think this is possible, the best you can do is prefix, if your order is alphabetical. For example I have a CF with comparator UTF8Type, and then I can do slice query and bring all columns that start with the prefix, and end with the prefix where you replace the last char with the next one in order (i.e. "aaa"-"aab"). Hope that helps. *Tamar Fraenkel * Senior Software Engineer, TOK Media [image: Inline image 1] ta...@tok-media.com Tel: +972 2 6409736 Mob: +972 54 8356490 Fax: +972 2 5612956 On Tue, May 15, 2012 at 7:56 AM, Abhijit Chanda wrote: > I don't know the exact value on a column, but I want to do a partial > matching to know all available values that matches. > I want to do similar kind of operation that LIKE operator in SQL do. > Any help is highly appreciated. > > -- > Abhijit Chanda > Software Developer > VeHere Interactive Pvt. Ltd. > +91-974395 > > <>