What changes are proposed in this pull request, and why are they necessary?
During translations, Coral generates SQL where each table name is appended with an alias and this alias is used to reference columns from the table. For example:
source SQL:
SELECT * FROM foo
Translated Trino SQL:
SELECT * FROM default.foo AS foo
source SQL:
SELECT a FROM foo UNION ALL SELECT a FROM foo
Translated Trino SQL:
SELECT foo.a FROM default.foo AS foo UNION ALL SELECT foo0.a FROM default.foo AS foo0
With this information, altering the table name can be accomplished using a post-processing SqlShuttle. This involves:
(1) Identifying the tables accessed in the RelNode via RelOptUtil.findAllTables()
(2) Using SqlShuttle RewriteTableNameShuttle to replace a single reference to the original table name.
The new translation are:
source SQL:
SELECT * FROM foo
Translated Trino SQL:
SELECT * FROM default.foo_tmp AS foo
source SQL:
SELECT a FROM foo UNION ALL SELECT a FROM foo
Translated Trino SQL:
SELECT foo.a FROM default.foo_tmp AS foo UNION ALL SELECT foo0.a FROM default.foo_tmp AS foo0
What changes are proposed in this pull request, and why are they necessary?
During translations, Coral generates SQL where each table name is appended with an alias and this alias is used to reference columns from the table. For example:
With this information, altering the table name can be accomplished using a post-processing SqlShuttle. This involves: (1) Identifying the tables accessed in the RelNode via RelOptUtil.findAllTables() (2) Using SqlShuttle
RewriteTableNameShuttle
to replace a single reference to the original table name.The new translation are:
How was this patch tested?
NA