pingcap / tiflash

The analytical engine for TiDB and TiDB Cloud. Try free: https://tidbcloud.com/free-trial
https://docs.pingcap.com/tidb/stable/tiflash-overview
Apache License 2.0
944 stars 410 forks source link

Storages: Fix obtaining incorrect column information when there are virtual columns in the query #9189

Closed JinheLin closed 2 months ago

JinheLin commented 3 months ago

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?

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`.
  1. Currently, if a query contains virtual columns, hash join will not be pushed down to TiFlash. So in fact, runtime filters will not occur when a query contains virtual columns. But in order to keep the relevant codes consistent, make them not rely on columns_to_read, the way that runtime filters creating DM::Attr object is modified.

Check List

Tests

Side effects

Documentation

Release note

Fix obtaining incorrect column information when there are virtual columns in the query.
ti-chi-bot[bot] commented 2 months ago

[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: - ~~[OWNERS](https://github.com/pingcap/tiflash/blob/master/OWNERS)~~ [CalvinNeo,Lloyd-Pottiger] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
ti-chi-bot[bot] commented 2 months ago

[LGTM Timeline notifier]

Timeline:

ti-chi-bot commented 2 months ago

In response to a cherrypick label: new pull request created to branch release-7.5: #9206.

ti-chi-bot commented 2 months ago

In response to a cherrypick label: new pull request created to branch release-8.1: #9207.

ti-chi-bot commented 2 months ago

In response to a cherrypick label: new pull request created to branch release-7.1: #9208.