Re: How to Parse raw CQL text?

2018-02-26 Thread Jon Haddad
Yes ideally. I’ve been spending a bit of time in the parser the last week. There’s a lot of internals which are still using old terminology and are pretty damn confusing. I’m doing a little investigation into exposing some of the information while also modernizing it. > On Feb 26, 2018, a

Re: How to Parse raw CQL text?

2018-02-26 Thread Hannu Kröger
If this is needed functionality, shouldn’t that be available as a public method or something? Maybe write a patch etc. ? > Ariel Weisberg kirjoitti 26.2.2018 kello 18.47: > > Hi, > > I took a similar approach and it worked fine. I was able to build a tool that > parsed production query logs.

Re: How to Parse raw CQL text?

2018-02-26 Thread Kant Kodali
wouldn't it make sense to expose the parser at some point? On Mon, Feb 26, 2018 at 9:47 AM, Ariel Weisberg wrote: > Hi, > > I took a similar approach and it worked fine. I was able to build a tool > that parsed production query logs. > > I used a helper method that would just grab a private fiel

Re: How to Parse raw CQL text?

2018-02-26 Thread Ariel Weisberg
Hi, I took a similar approach and it worked fine. I was able to build a tool that parsed production query logs. I used a helper method that would just grab a private field out of an object by name using reflection. Ariel On Sun, Feb 25, 2018, at 11:58 PM, Jonathan Haddad wrote: > I had to do some

Re: How to Parse raw CQL text?

2018-02-25 Thread Jonathan Haddad
I had to do something similar recently. Take a look at org.apache.cassandra.cql3.QueryProcessor.parseStatement(). I've got some sample code here [1] as well as a blog post [2] that explains how to access the private variables, since there's no access provided. It wasn't really designed to be use

Re: How to Parse raw CQL text?

2018-02-05 Thread Kant Kodali
I just did some trial and error. Looks like this would work public class Test { public static void main(String[] args) throws Exception { String stmt = "create table if not exists test_keyspace.my_table (field1 text, field2 int, field3 set, field4 map, primary key (field1) );";

Re: How to Parse raw CQL text?

2018-02-05 Thread Kant Kodali
Hi Anant, I just have CQL create table statement as a string I want to extract all the parts like, tableName, KeySpaceName, regular Columns, partitionKey, ClusteringKey, Clustering Order and so on. Thats really it! Thanks! On Mon, Feb 5, 2018 at 1:50 PM, Rahul Singh wrote: > I think I unders

Re: How to Parse raw CQL text?

2018-02-05 Thread Rahul Singh
I think I understand what you are trying to do … but what is your goal? What do you mean “use it for different” queries… Maybe you want to do an event and have an event processor? Seems like you are trying to basically by pass that pattern and parse a query and split it into several actions? Di

How to Parse raw CQL text?

2018-02-05 Thread Kant Kodali
Hi All, I have a need where I get a raw CQL create table statement as a String and I need to parse the keyspace, tablename, columns and so on..so I can use it for various queries and send it to C*. I used the example below from this link . I get the