fix: don't rewrite table names inside subquery when engine doesn't support it #29
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🗣 Description
For certain query engine: dremio, it doesn't support fully qualified table path in the subquery, so for example, this subquery
select * from db.schema.table where db.schema.table.col = 0
won't be supported. The subquery will be supported when subquery columns that are from tablescans within subquery only contains partial path / table name, for exampleselect * from db.schema.table where table.col = 0
. This PR implements changes to only use partial path within subquery for such engines.rewrite_subquery_use_partial_path
to determine whether the subquery requires partial path through the executor name, currently only returns true for Dremio.bool
subquery_uses_partial_path
to track whether a executor engine needs a partial path for query, and aOption<HashSet<TableReference>>
subquery_table_scans
to track the table scans appearing in the subqueries in functionrewrite_table_scans
.subquery_table_scans
, andsubquery_uses_partial_path
is true, use partial path instead of fully qualified table path for rewriting the column.test_subquery_requires_partial_path
to verify the changes.🔨 Related Issues
🤔 Concerns