Need help in adding keywords to Babel parser
Hi, I am writing a SQL statement (ANSI SQL or HiveQL) analyzer which will parse a given SQL statement into equivalent AST and I am using Babel for this use case. But when I try to parse statements such as “lateral view explode”, which is a valid HiveQL syntax, Babel is throwing ParseException. Adding these as keywords to the default list of keywords for Babel also did not help. Can someone point me to an example where something similar has been done. Thanks, Devjyoti
Re: SQL Query Set Analyzer
Hi Zheng, At Qubole, we are building something very similar to what you are looking for. And from experience, I can tell you that it is a lot easy to build it than what one may think. We use Calcite parser to parse the SQL into Sqlnode and then use different tree visitors to extract query attributes like tables, filter columns, joins, subqueries etc., Our approach is very similar to Uber's QueryParser project ( https://github.com/uber/queryparser ), but we go deeper in our analysis of finding queries that are semantically similar to some canonicalized form. If you intend to begin from scratch, I can give you some pointers to get started. Thanks, Devjyoti On Thu, Jul 26, 2018 at 9:37 AM, Zheng Shao wrote: > Hi, > > We are thinking about starting a project to analyze huge number of SQL > queries (think millions) to identify common patterns: > * Common sub queries > * Common filtering conditions (columns) for a table > * Common join keys for table pairs > > Are there any existing projects on that direction using Calcite? Would > love to leverage instead of building from scratch. > > Zheng >
Issue with extending SqlAbstractConformance
Hi, I am trying to build the parser config using the Configbuilder class SqlParser.configBuilder() .setUnquotedCasing(Casing.UNCHANGED) .setConformance(SqlConformanceEnum.DEFAULT) .build(); But this throws an error during compile rime [*ERROR*] * symbol: method setConformance(org.apache.calcite.sql.validate.SqlConformanceEnum)* This is in Calcite 1.15.0. I wanted to extend SqlSbatractConformance class to override some settings for Presto. What is the right way to override the conformance or how can I prevent this compilation error? Thanks, Devjyoti
Re: Issue with extending SqlAbstractConformance
Hi Michael, Following is the message from the compilation error *ERROR*] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile *(default-compile)* on project parse: *Compilation failure* [*ERROR*] */Users/devjyotip/AvaticaPrestoParser.java:[46,17] cannot find symbol* [*ERROR*] * symbol: method setConformance(org.apache.calcite.sql.validate.SqlConformanceEnum)* [*ERROR*] * location: class org.apache.calcite.sql.parser.SqlParser.ConfigBuilder* [*ERROR*] [*ERROR*] -> *[Help 1]* *org.apache.maven.lifecycle.LifecycleExecutionException*: *Failed to execute goal **org.apache.maven.plugins:maven-compiler-plugin:3.1:compile* *(default-compile)* on project parse: *Compilation failure* And following is the stacktrace from Maven *at* org.apache.maven.lifecycle.internal.MojoExecutor.execute ( *MojoExecutor.java:213*) *at* org.apache.maven.lifecycle.internal.MojoExecutor.execute ( *MojoExecutor.java:154*) *at* org.apache.maven.lifecycle.internal.MojoExecutor.execute ( *MojoExecutor.java:146*) *at* org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject ( *LifecycleModuleBuilder.java:117*) *at* org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject ( *LifecycleModuleBuilder.java:81*) *at* org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (*SingleThreadedBuilder.java:56*) *at* org.apache.maven.lifecycle.internal.LifecycleStarter.execute ( *LifecycleStarter.java:128*) *at* org.apache.maven.DefaultMaven.doExecute (*DefaultMaven.java:305*) *at* org.apache.maven.DefaultMaven.doExecute (*DefaultMaven.java:192*) *at* org.apache.maven.DefaultMaven.execute (*DefaultMaven.java:105*) *at* org.apache.maven.cli.MavenCli.execute (*MavenCli.java:956*) *at* org.apache.maven.cli.MavenCli.doMain (*MavenCli.java:290*) *at* org.apache.maven.cli.MavenCli.main (*MavenCli.java:194*) *at* sun.reflect.NativeMethodAccessorImpl.invoke0 (*Native Method*) *at* sun.reflect.NativeMethodAccessorImpl.invoke ( *NativeMethodAccessorImpl.java:62*) *at* sun.reflect.DelegatingMethodAccessorImpl.invoke ( *DelegatingMethodAccessorImpl.java:43*) *at* java.lang.reflect.Method.invoke (*Method.java:498*) *at* org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced ( *Launcher.java:289*) *at* org.codehaus.plexus.classworlds.launcher.Launcher.launch ( *Launcher.java:229*) *at* org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (*Launcher.java:415*) *at* org.codehaus.plexus.classworlds.launcher.Launcher.main ( *Launcher.java:356*) *Caused by*: org.apache.maven.plugin.compiler.CompilationFailureException: *Compilation failure* On Mon, Nov 26, 2018 at 8:25 PM Michael Mior wrote: > You seem to only be showing the first line of the error. There should be a > longer message below that would probably be helpful for debugging. > > -- > Michael Mior > mm...@apache.org > > > Le lun. 26 nov. 2018 à 06:54, Devjyoti Patra a > écrit : > > > Hi, I am trying to build the parser config using the Configbuilder class > > > > SqlParser.configBuilder() > > .setUnquotedCasing(Casing.UNCHANGED) > > .setConformance(SqlConformanceEnum.DEFAULT) > > .build(); > > > > But this throws an error during compile rime > > > > [*ERROR*] * symbol: method > > setConformance(org.apache.calcite.sql.validate.SqlConformanceEnum)* > > > > This is in Calcite 1.15.0. > > > > I wanted to extend SqlSbatractConformance class to override some settings > > for Presto. What is the right way to override the conformance or how can > I > > prevent this compilation error? > > > > Thanks, > > Devjyoti > > >