[
https://issues.apache.org/jira/browse/CALCITE-5144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17537878#comment-17537878
]
Julian Hyde commented on CALCITE-5144:
--------------------------------------
{quote}
It seems that user can conveniently create a RelNode instances manually
{quote}
Most {{RelNode}} instances are created by transformation rules, not users. It's
not practical to change the transformation rules to fix up names as the tree is
transformed. The fix up is not even possible in general, because the tree will
have a different structure from the original SQL.
{quote}
Actually I'm confused with 'position-based hints', can you take an example?
{quote}
I don't know what position-based hints would look like. All I know is that
{{RelNode}}s don't have names. The only nodes a {{RelNode}} can refer to are
its inputs, which would be called (say) input 0 and input 1.
Second order inputs (grandchildren) or higher are not very well defined,
because in Volcano the inputs are often equivalence sets (i.e. sets of
equivalent RelNodes).
All of which is to say, this seems like a bad idea. At best it is going to be
confusing duct tape that fails as often as it succeeds. I advise you to resolve
the references at Sql-to-rel time, and throw away the names.
> table alias is lost by SqlToRelConverter
> ----------------------------------------
>
> Key: CALCITE-5144
> URL: https://issues.apache.org/jira/browse/CALCITE-5144
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Reporter: xuyang
> Priority: Major
>
> I found that in SqlToRelConverter#convertFrom, "AS" only cares about the
> first operand and just ignore the second operand, and this behavior will
> cause the information of the table alias lost.
> The simple SQL is :
> {code:java}
> // code placeholder
> select * from (select * from emp) t1 {code}
> The "t1" will be lost in the final RelNode tree. I think we can retain this
> alias information in the RelNode by some way.
> The real scenarios that require table aliases are Join Hint on subquery just
> like:
> {code:java}
> // code placeholder
> SELECT /*+ USE_NL(v2) */ v2.a
> FROM (select * from test1) v2 join test2 ON v2.a = test2.a {code}
--
This message was sent by Atlassian Jira
(v8.20.7#820007)