[ https://issues.apache.org/jira/browse/CALCITE-1586?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15830422#comment-15830422 ]
Julian Hyde commented on CALCITE-1586: -------------------------------------- Thanks for the PR; I reviewed it and the logic looks good, just a couple of "technical debt" items: * Is it necessary to call {{SqlPrettyWriter.setNeedWhitespace}}? The writer is supposed to add the necessary whitespace automatically. If it doesn't that is a bug in the writer. * Maybe {{SqlSetOperator}} should be a sub-class of {{SqlOperator}} rather than {{SqlBinaryOperator}} at present. Does that change have a big impact? * The {{okWithOptimizer}} method is really useful, but it would be even better if it could be invoked as a fluid API: rather than "sql(sql).okWithOptimizer(ruleSet, planner, expected)", people should be able to write "sql(sql).withOptimizer(ruleSet, planner).ok(expected)". > wrong rel-to-sql conversion when performing set operation more then two > inputs. > ------------------------------------------------------------------------------- > > Key: CALCITE-1586 > URL: https://issues.apache.org/jira/browse/CALCITE-1586 > Project: Calcite > Issue Type: Bug > Components: jdbc-adapter > Affects Versions: 1.10.0 > Environment: NA > Reporter: Zhiqiang He > Assignee: Julian Hyde > Priority: Critical > Fix For: 1.12.0 > > > in union example, after UnionMergeRule, the union input is convert to three > input, and rel to sql convert result is wrong. > inputsql > {code:sql} > SELECT * > FROM (SELECT \"product_id\" > FROM \"foodmart\".\"product\" > UNION ALL > SELECT \"product_id\" > FROM \"foodmart\".\"sales_fact_1997\") > UNION ALL > SELECT \"product_class_id\" AS \"PRODUCT_ID\" > FROM \"foodmart\".\"product_class\" > {code} > output sql > {code:sql} > SELECT \"product_id\" > FROM \"foodmart\".\"product\" > UNION ALL > SELECT \"product_id\" > FROM \"foodmart\".\"sales_fact_199 > {code} > the lastest union query is lost. -- This message was sent by Atlassian JIRA (v6.3.4#6332)