-
Notifications
You must be signed in to change notification settings - Fork 409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Storages: Fix obtaining incorrect column information when there are virtual columns in the query #9189
Conversation
9fce9a5
to
3951444
Compare
…n there are virtual columns in the query
6016504
to
01fd012
Compare
query_info.dag_query = std::make_unique<DAGQueryInfo>( | ||
filter_conditions->conditions, | ||
empty_pushed_down_filters, // Not care now | ||
mockColumnInfosToTiDBColumnInfos(table_schema_for_delta_merge[table_id]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only local const references prolong the lifespan a temporary.
ref: https://stackoverflow.com/questions/2784262/
As a const reference member of DAGQueryInfo
, source_columns
cannot prolong the lifespan of a temporary.
DAGQueryInfo::source_columns
will be a dangle reference after the contructor of DAGQueryInfo
exits.
@@ -99,10 +99,14 @@ PushDownFilterPtr PushDownFilter::build( | |||
has_cast) | |||
{ | |||
NamesWithAliases project_cols; | |||
for (size_t i = 0; i < columns_to_read.size(); ++i) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
casted_columns
align with table_scan_column_info
one by one.
@@ -301,6 +303,8 @@ class StorageDeltaMerge | |||
Context & global_context; | |||
|
|||
LoggerPtr log; | |||
|
|||
friend class MockStorage; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MockStorage
will call getStoreColumnDefines()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: CalvinNeo, Lloyd-Pottiger The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
…irtual columns in the query (#9189) (#9206) close #9188 1. Use the original columns in `query_info.dag_query` instead of `columns_to_read` when building `RSOperator`. 2. For runtime filters, creating the `DM::Attr` object in `StorageDeltaMerge::read`, so it doesn't need to rely on `column_to_read`. Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io> Co-authored-by: jinhelin <linjinhe33@gmail.com>
…irtual columns in the query (#9189) (#9206) close #9188 1. Use the original columns in `query_info.dag_query` instead of `columns_to_read` when building `RSOperator`. 2. For runtime filters, creating the `DM::Attr` object in `StorageDeltaMerge::read`, so it doesn't need to rely on `column_to_read`. Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io> Co-authored-by: jinhelin <linjinhe33@gmail.com>
What problem does this PR solve?
Issue Number: close #9188
Problem Summary:
When parsing some column expressions, it may need to use column index to obtain column information, but since virtual columns are filtered out before being sent to the storage layer, the original columns and the columns for storage to read are
inconsistency.
What is changed and how it works?
columns_to_read
, the way that runtime filters creatingDM::Attr
object is modified.Check List
Tests
Side effects
Documentation
Release note