Re: dynamic reflective schema

2022-02-23 Thread Julian Hyde
SQL’s FLOAT type (aka DOUBLE) corresponds to Java’s double. SQL’s REAL type corresponds to Java’s float. JDBC method names (e.g. getFloat, getDouble) refer to the Java types. Julian > On Feb 23, 2022, at 10:33 PM, xiaobo wrote: > > When trying to map Java Float Objects to SQL Float, we

Re: dynamic reflective schema

2022-02-23 Thread xiaobo
When trying to map Java Float Objects to SQL Float, we faild with the following , it seems calcite is trying to convert Float objects to Double even when we expect it to be a float ( we fetch it through getFloat method of resultset ). java.lang.ClassCastException: class java.lang.Float cannot

[jira] [Created] (CALCITE-5020) ResultSetMetaData.getColumnLabel should return columnName when not use column alias

2022-02-23 Thread Zhengqiang Duan (Jira)
Zhengqiang Duan created CALCITE-5020: Summary: ResultSetMetaData.getColumnLabel should return columnName when not use column alias Key: CALCITE-5020 URL: https://issues.apache.org/jira/browse/CALCITE-5020

Re: Why are nested aggregations illegal? Best alternatives?

2022-02-23 Thread Gavin Ray
Well actually, there is one exception -- there's a small bug with the output being improperly escaped but that bug is already on JIRA and seems much easier to approach. https://issues.apache.org/jira/browse/CALCITE-4989 On Wed, Feb 23, 2022 at 6:46 PM Gavin Ray wrote: > Oh wow, that fixed it!

Re: Why are nested aggregations illegal? Best alternatives?

2022-02-23 Thread Gavin Ray
Oh wow, that fixed it! I changed that line in the parser to be Expression(ExprContext.ACCEPT_ALL) And now my nested JSON queries work! The minimal reproduction is: SELECT JSON_OBJECT( KEY 'id' VALUE (SELECT 1) ) +--+ | EXPR$0 | +--+ | {"id":1} | +--+ 1 row

Re: Why are nested aggregations illegal? Best alternatives?

2022-02-23 Thread Gavin Ray
Okay, I think maybe I have an idea what is going on The parser grammar for "JsonNameAndValue": https://github.com/apache/calcite/blob/82dd78a14f6aef2eeec2f9c94978d04b4acc5359/core/src/main/codegen/templates/Parser.jj#L6267-L6296 Has: e = Expression(ExprContext.ACCEPT_NON_QUERY) This enum value

Re: Why are nested aggregations illegal? Best alternatives?

2022-02-23 Thread Gavin Ray
Sorry, I realized this might be a time investment to try to debug/reproduce So I found a website that let me create the schema, rows, and query on various DB's Here is an example on Oracle and MySQL that you can view/modify in your browser: ORACLE:

Re: Why are nested aggregations illegal? Best alternatives?

2022-02-23 Thread Gavin Ray
I think this actually is a bug in Calcite's parser or it's interpretation I tested on H2, Oracle, and MySQL, the below is valid on those DB's but fails on Calcite's parser: = H2/Oracle = SELECT "houses"."id" AS "id", "houses"."address" AS "address", (

Re: Why are nested aggregations illegal? Best alternatives?

2022-02-23 Thread Gavin Ray
That's a valid point, let me see check what some common dialects will accept for this sort of thing On Wed, Feb 23, 2022 at 12:36 PM Julian Hyde wrote: > It’s a parser error. That usually means that the user has made a mistake. > > Try your SQL on another DB with JSON support before you declare

Re: Why are nested aggregations illegal? Best alternatives?

2022-02-23 Thread Julian Hyde
It’s a parser error. That usually means that the user has made a mistake. Try your SQL on another DB with JSON support before you declare this a Calcite bug. Julian > On Feb 23, 2022, at 09:22, Gavin Ray wrote: > > No dice still unfortunately =/ > > If it's any easier, I put a

Re: Why are nested aggregations illegal? Best alternatives?

2022-02-23 Thread Gavin Ray
No dice still unfortunately =/ If it's any easier, I put a self-contained single class reproduction on Github: https://github.com/GavinRay97/calcite-nested-json-subquery-bug/blob/main/src/test/java/com/example/AppTest.java Is it worth filing a JIRA ticket over you think? On Wed, Feb 23, 2022

Re: dynamic reflective schema

2022-02-23 Thread Gavin Ray
Xiabo, Your code seems to work for me, I ran the test case and it passes, see the image below: https://i.imgur.com/D0ajyQH.png On Wed, Feb 23, 2022 at 2:33 AM xiaobo wrote: > we have put the test coding on github > > >

Re: Calcite CSV Adapter => SQL Client

2022-02-23 Thread Stamatis Zampetakis
Hi Oualid, It's not completely clear what your request is but keep in mind that Sqlline [1] (which you probably used in the tutorial) is an SQL client like Dbeaver/Squirrel etc. The tutorial also provides some examples with the jdbcurl, username, password. Keep in mind that whatever SQL client

[jira] [Created] (CALCITE-5019) Avoid multiple scans when table is ProjectableFilterableTable

2022-02-23 Thread ChenKai (Jira)
ChenKai created CALCITE-5019: Summary: Avoid multiple scans when table is ProjectableFilterableTable Key: CALCITE-5019 URL: https://issues.apache.org/jira/browse/CALCITE-5019 Project: Calcite

Re: Re: DDL support issues in Calcite

2022-02-23 Thread wang...@mchz.com.cn
Hi Julian, It works! Thank you very much! From: Julian Hyde Date: 2022-02-23 10:01 To: dev Subject: Re: DDL support issues in Calcite Looks like you need to be using ServerDdlExecutor rather than DdlExecutor.USELESS. Therefore try using

Re: RE: DDL support issues in Calcite

2022-02-23 Thread wang...@mchz.com.cn
Hi Xu, sorry for late response. I read the code in org.apache.calcite.test.ServerTest, along with help from Julian, now the problem has been solved. According to Julian, I replaced the value of parserFactory "org.apache.calcite.sql.parser.ddl.SqlDdlParserImpl#FACTORY" with

Re: Why are nested aggregations illegal? Best alternatives?

2022-02-23 Thread Julian Hyde
Try ‘value ((‘ in place of ‘value (‘. Julian > On Feb 21, 2022, at 9:33 AM, Gavin Ray wrote: > > I hadn't thought about the fact that ORM's probably have to solve this > problem as well > That is a great suggestion, I will try to investigate some of the popular > ORM codebases and see if