Re: calcite multi-threading problem

2022-02-25 Thread xiaobo
Hi Gavin and Julian, Thanks for your help, we know that upgrading janino and common compiler to 3.1.6 will fix the "operand stack underflow" error, but we have also have problem with 3.1.6 of janino as mentioned before: -- we checked the janino release note page http://janino

Re: I would like to fix "CALCITE-4739: json_object pushdown JDBC". Looking through the codebase, not obvious where to start, hints greatly appreciated

2022-02-25 Thread Gavin Ray
Damn, I feel like I am so close I now have Postgres working for "plain" JSON_OBJECT() https://github.com/apache/calcite/pull/2733 But it seems to fail when trying to return/serialize the results of queries that have sub-queries using both JSON_ARRAYAGG and JSON_OBJECT Would anyone be willing to g

Re: I would like to fix "CALCITE-4739: json_object pushdown JDBC". Looking through the codebase, not obvious where to start, hints greatly appreciated

2022-02-25 Thread Gavin Ray
Okay, I have a basic test passing: @Test void testJsonObjectPostgres() { String query = "select json_object(\"product_name\": \"product_id\") from \"product\""; final String expected = "SELECT " + "JSON_BUILD_OBJECT('product_name', \"product_id\")\n"

Re: I would like to fix "CALCITE-4739: json_object pushdown JDBC". Looking through the codebase, not obvious where to start, hints greatly appreciated

2022-02-25 Thread Gavin Ray
It looks like this can be done through: "SqlDialect#unparseCall(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec)" Hopefully I am on the right track here :sweat_smile:

Re: calcite multi-threading problem

2022-02-25 Thread Julian Hyde
Should a jira case be logged for this issue? Or is there an existing case? If the latter, should we add a stack trace to help people tie it to this problem? A jira URL in this thread will help other people who run into this problem in future. Right now it is just a rambling email thread with an

Re: calcite multi-threading problem

2022-02-25 Thread Gavin Ray
Also I just checked and this is updated on master so it should be solved in next release FWIW: https://github.com/apache/calcite/blob/cbbe5701b7f61d7f8df12d314ba5aabf898c1cae/gradle.properties#L116 On Fri, Feb 25, 2022 at 10:16 AM Gavin Ray wrote: > The fix for this is just to add janino and co

Re: calcite multi-threading problem

2022-02-25 Thread Gavin Ray
The fix for this is just to add janino and commons-compiler as exclusions in the calcite/avatica dependencies And then add the updated version so that it overwrites them I tested this on your code and it worked Also, please listen to Stamatis/Julian advice org.apache.calcite calcite-core 1.29.

Re: calcite multi-threading problem

2022-02-25 Thread xiaobo
I have put the testing code at github https://github.com/guxiaobo/gxb-testing/blob/main/calcite-testing/src/test/java/com/xsmartware/testing/calcite/Test1.java -- Original -- From: "xiaobo ";; Send time: Friday, Feb 25, 2022 9:05 PM To: "dev"; Subject: Re:

Re: [DISCUSS] INTERVAL HOUR default data type range

2022-02-25 Thread Yanjing Wang
Hello, I have logged a CALCITE-5024 and submitted a pr-2732 , welcome suggestions and review. Yanjing Wang 于2022年2月25日周五 18:16写道: > When I override the RelDataTypeSystemImpl#getDefaultPrecision met

Re: calcite multi-threading problem

2022-02-25 Thread xiaobo
Hi, Now we come to the problem similar as the one at https://github.com/apache/calcite/pull/2433#issuecomment-860024076, a simple sql "select max(id) from s.t1" caused the following exception, users report upgrading janino to 3.1.6 can fix this problem, but as we discussed before janino 3.1.6

[jira] [Created] (CALCITE-5024) Big INTERVAL_HOUR precision can't be converted to row expression

2022-02-25 Thread yanjing.wang (Jira)
yanjing.wang created CALCITE-5024: - Summary: Big INTERVAL_HOUR precision can't be converted to row expression Key: CALCITE-5024 URL: https://issues.apache.org/jira/browse/CALCITE-5024 Project: Calcite

Re: [DISCUSS] INTERVAL HOUR default data type range

2022-02-25 Thread Yanjing Wang
When I override the RelDataTypeSystemImpl#getDefaultPrecision method to force INTERVAL_HOUR type having precision 10, the validation passes, but converting to rel fails. The problem is SqlLiteral.getValueAs(Long.class) will invoke intervalToMillis and which invokes intervalQualifier.evaluateInterv

[DISCUSS] INTERVAL HOUR default data type range

2022-02-25 Thread Yanjing Wang
Hello, I found the calcite INTERVAL HOUR default type is HOUR(2), and the range is 0-99. for example: @Test void testIntervalHourRange() { String expr = "interval '100' hour"; expr(expr).ok(); } This test will throw CalciteContextException: From line 1, column 1 to line 1, column 19: Int

Re: [Discuss] Converting SELECT Fields to STAR may cause duplicate column exception when executing ctas

2022-02-25 Thread Yanjing Wang
It seems that *RelToSqlConverter#visit(Project e) *method's code piece *if (!isStar(e.getProjects(), e.getInput().getRowType(), e.getRowType()))* has caused this problem. I have logged a jira CALCITE-5023 for this problem and a pr-2731