Re: How to get the used columns (categorized by tables) from a SQL

2020-04-16 Thread XING JIN
You can use SqlValidator.getFieldOrigins for a SqlNode, or use RelMetadataQuery.getColumnOrigins for a RelNode. - Jin Julian Hyde 于2020年4月17日周五 上午7:29写道: > At the RelNode level, you can use RelMetadataQuery.getColumnOrigins. > > But I’m sure that there’s something available at the SqlNode

Generating SQL with non-ASCII characters in string literals

2020-04-16 Thread Julian Hyde
Someone just logged https://issues.apache.org/jira/browse/CALCITE-3933 "Incorrect SQL Emitted for Unicode for Several Dialects”. Consider the literal ‘schön’ (German for ‘beautiful’). It seems that we generate SQL standard syntax,

[jira] [Created] (CALCITE-3933) Incorrect SQL Emitted for Unicode for Several Dialects

2020-04-16 Thread Aryeh Hillman (Jira)
Aryeh Hillman created CALCITE-3933: -- Summary: Incorrect SQL Emitted for Unicode for Several Dialects Key: CALCITE-3933 URL: https://issues.apache.org/jira/browse/CALCITE-3933 Project: Calcite

Re: How to get the used columns (categorized by tables) from a SQL

2020-04-16 Thread Julian Hyde
At the RelNode level, you can use RelMetadataQuery.getColumnOrigins. But I’m sure that there’s something available at the SqlNode level, after validation. PreparedExplain.getFieldOrigins() is what the JDBC driver uses to provide ResultSetMetadata.getColumnName(int) etc. Julian > On Apr 16,

Re: How to get the used columns (categorized by tables) from a SQL

2020-04-16 Thread Feng Zhu
You can customize a RelVisitor to visit the RelNode, and collect the columns from TableScan's rowtype. 王驰 于2020年4月16日周四 下午11:23写道: > Hi folks, > > > We're using CalCite in our project for SQL parsing and validating. We have > a question: is there any way to get all used columns from a SQL? > >

Re: Re: [DISCUSS] Refactor how planner rules are parameterized

2020-04-16 Thread Julian Hyde
I have now pushed a dev branch with a prototype. Please see https://issues.apache.org/jira/browse/CALCITE-3923 for details. Having built the prototype, I believe that this change is beneficial and we should do it. But I would like to get to consensus on the design before we pull the trigger.

[jira] [Created] (CALCITE-3932) Make data type cache thread local, non-evictable

2020-04-16 Thread Haisheng Yuan (Jira)
Haisheng Yuan created CALCITE-3932: -- Summary: Make data type cache thread local, non-evictable Key: CALCITE-3932 URL: https://issues.apache.org/jira/browse/CALCITE-3932 Project: Calcite

How to get the used columns (categorized by tables) from a SQL

2020-04-16 Thread 王驰
Hi folks, We're using CalCite in our project for SQL parsing and validating. We have a question: is there any way to get all used columns from a SQL? Consider the following case: we have two tables `user` and `user_region`. And the SQL is like ``` SELECT id, name, age, country,

[jira] [Created] (CALCITE-3931) Add LOOKAHEAD(2) for methods defined in createStatementParserMethods

2020-04-16 Thread Danny Chen (Jira)
Danny Chen created CALCITE-3931: --- Summary: Add LOOKAHEAD(2) for methods defined in createStatementParserMethods Key: CALCITE-3931 URL: https://issues.apache.org/jira/browse/CALCITE-3931 Project: