[ 
https://issues.apache.org/jira/browse/CALCITE-6195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17805175#comment-17805175
 ] 

David Dali Susanibar Arce commented on CALCITE-6195:
----------------------------------------------------

Thank you Julian for you comments.

One step needed in my implementation is to be able to validate and convert SQL 
Expression into RexNode. Calcite is able to convert SQL expression such as:

 
{code:java}
L_ORDERKEY
L_ORDERKEY > 10
L_ORDERKEY + 10
L_ORDERKEY IN (10, 20)
L_ORDERKEY is not null
L_ORDERKEY is null {code}
All of this is working properly, but some missing point is what about or [how 
to handle qualified 
names|https://github.com/davisusanibar/substrait-java/blob/3835a4f35d41ac31dc9dfcd9d0fb4876602a002e/isthmus/src/main/java/io/substrait/isthmus/SqlExpressionToSubstrait.java#L102:L113].
 Would you be able to suggest any other methods for me to research on how to 
incorporate qualified names into SQL Expression, just as SQL Query is able to 
do?

 
{code:java}
LINEITEM.L_ORDERKEY
LINEITEM.L_ORDERKEY > 10
LINEITEM.L_ORDERKEY + 10
LINEITEM.L_ORDERKEY IN (10, 20)
LINEITEM.L_ORDERKEY is not null
LINEITEM.L_ORDERKEY is null {code}
Thank you in advance for your support.

> SqlValidator validateParameterizedExpression is not supporting qualified paths
> ------------------------------------------------------------------------------
>
>                 Key: CALCITE-6195
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6195
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.36.0
>            Reporter: David Dali Susanibar Arce
>            Priority: Major
>
> The SQLValidator.validateParameterizedExpression method can be used to 
> validate parameterized expressions.
> It is possible to register 
> [validateParameterizedExpression|https://github.com/apache/calcite/blob/1b11d99e65d03a15ae4b25c47250b6918ce9aa10/core/src/test/java/org/apache/calcite/test/SqlValidatorTest.java#L11421:L11435]:
> {code:java}
> final Map<String, RelDataType> nameToTypeMap = new HashMap<>();
> nameToTypeMap.put("A", intType);
> nameToTypeMap.put("B", intTypeNull); 
> final String expr = "a + b";
> final SqlNode validated = validator.validateParameterizedExpression(sqlNode, 
> nameToTypeMap);{code}
>  
> Problems appear if we are trying to register qualified paths:
> {code:java}
> final Map<String, RelDataType> nameToTypeMap = new HashMap<>(); 
> nameToTypeMap.put("EMP.A", intType);
> nameToTypeMap.put("EMP.B", intTypeNull); 
> final String expr = "EMP.a + EMP.b";
> final SqlNode validated = validator.validateParameterizedExpression(sqlNode, 
> nameToTypeMap); 
> Error:
> org.apache.calcite.runtime.CalciteContextException: From line 1, column 1 to 
> line 1, column 3: Unknown identifier 'EMP'
> {code}
> I would appreciate if you could provide me with some advice regarding how to 
> resolve this error.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to