Re: 回复:cannot be cast to class org.apache.calcite.runtime.FlatLists$ComparableList error

2022-02-12 Thread Ruben Q L
Hello, per ReflectiveSchema javadoc [1]: "Implementation of {@link org.apache.calcite.schema.Schema} that exposes the public fields and methods in a Java object." [1] https://github.com/apache/calcite/blob/812e3e98eae518cf85cd1b6b7f055fb96784a423/core/src/main/java/org/apache/calcite/adapter/java

Re: calcite multi-threading problem

2022-02-12 Thread xiaobo
we checked the janino release note page http://janino-compiler.github.io/janino/changelog.html Fixed issue #141: Unable to find org.codehaus.commons.compiler.properties in java 11: ICompilerFactories were loaded through the current thread's "context class loader", which is a bad choice in some e

Re: calcite multi-threading problem

2022-02-12 Thread xiaobo
but strange enough, the same code works in a single thread. -- Original -- From: "xiaobo ";; Send time: Saturday, Feb 12, 2022 8:02 PM To: "dev"; Subject: Re: calcite multi-threading problem we checked the janino release note page http://janino-compile

Re: calcite multi-threading problem

2022-02-12 Thread xiaobo
3.1.4 of janino and commons-compiler works now. -- Original -- From: "xiaobo ";; Send time: Saturday, Feb 12, 2022 8:04 PM To: "dev"; Subject: Re: calcite multi-threading problem but strange enough, the same code works in a single thread.

Re: can we set a default schema for calcite connection to avoid writing schema names in sql

2022-02-12 Thread Gavin Ray
Hey Xiabo, You can do this, however it is easiest to do from the "FrameworkConfig" object, like this: import org.apache.calcite.tools.FrameworkConfig // Need to set case-sensitive to false, or else it tries to // look up capitalized table names and fails // // IE: "EMPS" instead of "emps" val fra

Re: Why are nested aggregations illegal? Best alternatives?

2022-02-12 Thread Gavin Ray
Apologies for the delay in replying This makes things clear and seems obvious now that you point it out. Thank you, Justin and Julian =) Let me ask another question (if I may) that I am struggling to phrase easily. So with GraphQL, you might have a query like: - "Get houses" - "For each house ge

Re: Why are nested aggregations illegal? Best alternatives?

2022-02-12 Thread Julian Hyde
Correlated ARRAY sub-query? > On Feb 12, 2022, at 10:40 AM, Gavin Ray wrote: > > Apologies for the delay in replying > > This makes things clear and seems obvious now that you point it out. > Thank you, Justin and Julian =) > > Let me ask another question (if I may) that I am struggling to phr

Re: Why are nested aggregations illegal? Best alternatives?

2022-02-12 Thread Gavin Ray
Forgive my ignorance/lack of experience I am somewhat familiar with the ARRAY() function, but not sure I know the term "correlated" Searching the Calcite codebase for uses of "correlated" + "query", I found: https://github.com/apache/calcite/blob/1d4f1b394bfdba03c5538017e12ab2431b137ca9/core/src/

Re: Why are nested aggregations illegal? Best alternatives?

2022-02-12 Thread Gavin Ray
Nevermind, this is a standard term not something Calcite-specific it seems! https://en.wikipedia.org/wiki/Correlated_subquery On Sat, Feb 12, 2022 at 3:46 PM Gavin Ray wrote: > Forgive my ignorance/lack of experience > > I am somewhat familiar with the ARRAY() function, but not sure I know the

Re: can we set a default schema for calcite connection to avoid writing schema names in sql

2022-02-12 Thread xiaobo
Hi Gavin, Thanks for your help, the defaultSchema(SchemaPlus defaultSchema) method need a SchemaPlus which only can be get after a connection is opened, but we want to set a target subschema such as RelfectiveShcema to be the default one, and we guess the default schema setting operation shoul

Re: can we set a default schema for calcite connection to avoid writing schema names in sql

2022-02-12 Thread Gavin Ray
You can create an empty root schema, add a ReflectiveSchema, and then set this as the default schema: val rootSchema: SchemaPlus = Frameworks.createRootSchema(true) val hrReflectiveSchema = ReflectiveSchema(HrSchema()) rootSchema.add("hr", hrReflectiveSchema) Frameworks.newConfigBuilder() .de

Re: Why are nested aggregations illegal? Best alternatives?

2022-02-12 Thread Gavin Ray
After ~5 hours, I think I may have made some progress =) I have this, which currently works. The problem is that the nested columns don't have names on them. Since I need to return a nested "Map", I have to figure out how to convert this query into a form that gives column names. But this is stil

Re: Why are nested aggregations illegal? Best alternatives?

2022-02-12 Thread Gavin Ray
Ah wait nevermind, got excited and spoke too soon. Looking at it more closely, that data isn't correct. At least it's in somewhat the right shape, ha! On Sat, Feb 12, 2022 at 9:57 PM Gavin Ray wrote: > After ~5 hours, I think I may have made some progress =) > > I have this, which currently work