You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (Jira)" <ji...@apache.org> on 2019/09/30 18:08:00 UTC

[jira] [Commented] (CALCITE-3379) Support expand atom expression in table to relational node conversion

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

Julian Hyde commented on CALCITE-3379:
--------------------------------------

I don't understand what "Support expand atom expression in table to relational node conversion" means. Can you give a use case?

I do agree that it is confusing to have two different ways to convert table references to table scans. If there was a way to get it down to one I would support it.

> Support expand atom expression in table to relational node conversion
> ---------------------------------------------------------------------
>
>                 Key: CALCITE-3379
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3379
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 1.21.0
>            Reporter: Danny Chen
>            Assignee: Danny Chen
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.22.0
>
>          Time Spent: 1h 40m
>  Remaining Estimate: 0h
>
> Now there are 2 ways to convert a RelOptTable to LogicalTableScan:
> 1. One way is tp open the Config#sConvertTableAccess[1] flag and the SqlToRelConverter would invoke the #toRel method which transforms the table to a node returned by the user(Usually a table scan).
> 2. Another way it to use the LogicalTableScan rule, this rule would invoke RelOptTable#toRel and wrap the returned node with a LogicalTableScan.
>  
> The different between 1 and 2 is that, 2 happens in the planning rule but 1 happens in sql-to-rel conversion, 1 also supports to expand the table columns based on the defined default values expressions, see InitializerExpressionFactory#newColumnDefaultValue.
>  
> The problem with the InitializerExpressionFactory#newColumnDefaultValue is that it use InitializerContext#convertExpression to convert a SqlNode, if the SqlNode is not validated, we always got a RexCall with SqlUnresolvedFunction. We should give the user change to validate their SqlNode or even we can support pure string expressions because they can be used to persist.
>  
> Another problem with #toRel is that after the expressions applied as a projection, use has no change to apply any other rel nodes if they want, we can actually support this, the same way as we support the column expressions.
>  
> [1]https://github.com/apache/calcite/blob/2dc97e6723e1b5bf762540f87ffffb5cd1a848a1/core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java#L5605



--
This message was sent by Atlassian Jira
(v8.3.4#803005)