Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
winoros committed May 23, 2023
1 parent a246875 commit 08c86e0
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions planner/core/find_best_task.go
Expand Up @@ -1215,7 +1215,7 @@ func (ds *DataSource) convertToIndexMergeScan(prop *property.PhysicalProperty, c
}

func (ds *DataSource) convertToPartialIndexScan(prop *property.PhysicalProperty, path *util.AccessPath, matchProp bool) (indexPlan PhysicalPlan) {
is := ds.getOriginalPhysicalIndexScan(prop, path, false, false)
is := ds.getOriginalPhysicalIndexScan(prop, path, matchProp, false)
// TODO: Consider using isIndexCoveringColumns() to avoid another TableRead
indexConds := path.IndexFilters
if len(indexConds) > 0 {
Expand All @@ -1234,8 +1234,6 @@ func (ds *DataSource) convertToPartialIndexScan(prop *property.PhysicalProperty,
return indexPlan
}
if matchProp {
is.KeepOrder = true
is.Desc = prop.SortItems[0].Desc
if is.Table.GetPartitionInfo() != nil && !is.Index.Global && is.SCtx().GetSessionVars().StmtCtx.UseDynamicPartitionPrune() {
is.Columns = append(is.Columns, model.NewExtraPhysTblIDColInfo())
is.schema.Append(&expression.Column{
Expand Down Expand Up @@ -1268,7 +1266,7 @@ func checkColinSchema(cols []*expression.Column, schema *expression.Schema) bool
}

func (ds *DataSource) convertToPartialTableScan(prop *property.PhysicalProperty, path *util.AccessPath, matchProp bool) (tablePlan PhysicalPlan) {
ts, rowCount := ds.getOriginalPhysicalTableScan(prop, path, false)
ts, rowCount := ds.getOriginalPhysicalTableScan(prop, path, matchProp)
overwritePartialTableScanSchema(ds, ts)
// remove ineffetive filter condition after overwriting physicalscan schema
newFilterConds := make([]expression.Expression, 0, len(path.TableFilters))
Expand All @@ -1290,8 +1288,6 @@ func (ds *DataSource) convertToPartialTableScan(prop *property.PhysicalProperty,
return tablePlan
}
if matchProp {
ts.KeepOrder = true
ts.Desc = prop.SortItems[0].Desc
if ts.Table.GetPartitionInfo() != nil && ts.SCtx().GetSessionVars().StmtCtx.UseDynamicPartitionPrune() {
ts.Columns = append(ts.Columns, model.NewExtraPhysTblIDColInfo())
ts.schema.Append(&expression.Column{
Expand Down

0 comments on commit 08c86e0

Please sign in to comment.