-
Notifications
You must be signed in to change notification settings - Fork 6.2k
*: use user keyspace's collation mode for DXF tasks #69677
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
Changes from all commits
8c906d4
556f001
ed3adf7
dec0b7b
f8a0520
b9ed895
0fb3ffd
02ed166
d891385
390f262
c50e392
65d4216
d986cd8
f787d1a
ec4757b
3a6ac45
ef07673
a755f2d
8ce0b06
0a38136
0b27b76
b574e4a
76fab39
56df426
3e58e05
0adebb6
67428e4
94bf00f
69efbf0
7e9637b
f95c567
2357d7a
a739efc
38623f2
51bbaa9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,6 +46,7 @@ type CopContextBase struct { | |
| ExprCtx exprctx.BuildContext | ||
| PushDownFlags uint64 | ||
| RequestSource string | ||
| UseNewCollate bool | ||
|
|
||
| ColumnInfos []*model.ColumnInfo | ||
| FieldTypes []*types.FieldType | ||
|
|
@@ -80,6 +81,7 @@ func NewCopContextBase( | |
| tblInfo *model.TableInfo, | ||
| idxCols []*model.IndexColumn, | ||
| requestSource string, | ||
| useNewCollate bool, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ℹ️ [Info]
|
||
| ) (*CopContextBase, error) { | ||
| var err error | ||
| usedColumnIDs := make(map[int64]struct{}, len(idxCols)) | ||
|
|
@@ -125,8 +127,14 @@ func NewCopContextBase( | |
| handleIDs = []int64{extra.ID} | ||
| } | ||
|
|
||
| expColInfos, _, err := expression.ColumnInfos2ColumnsAndNames(exprCtx, | ||
| ast.CIStr{} /* unused */, tblInfo.Name, colInfos, tblInfo) | ||
| expColInfos, _, err := expression.ColumnInfos2ColumnsAndNamesWithCollate( | ||
| exprCtx, | ||
| ast.CIStr{}, // unused | ||
| tblInfo.Name, | ||
| colInfos, | ||
| tblInfo, | ||
| useNewCollate, | ||
| ) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
@@ -139,6 +147,7 @@ func NewCopContextBase( | |
| ExprCtx: exprCtx, | ||
| PushDownFlags: pushDownFlags, | ||
| RequestSource: requestSource, | ||
| UseNewCollate: useNewCollate, | ||
| ColumnInfos: colInfos, | ||
| FieldTypes: fieldTps, | ||
| ExprColumnInfos: expColInfos, | ||
|
|
@@ -148,27 +157,36 @@ func NewCopContextBase( | |
| }, nil | ||
| } | ||
|
|
||
| // NewCopContext creates a CopContext. | ||
| // NewCopContext creates a CopContext with a fixed collation mode. | ||
| func NewCopContext( | ||
| exprCtx exprctx.BuildContext, | ||
| pushDownFlags uint64, | ||
| tblInfo *model.TableInfo, | ||
| allIdxInfo []*model.IndexInfo, | ||
| requestSource string, | ||
| useNewCollate bool, | ||
| ) (CopContext, error) { | ||
| if len(allIdxInfo) == 1 { | ||
| return NewCopContextSingleIndex(exprCtx, pushDownFlags, tblInfo, allIdxInfo[0], requestSource) | ||
| return NewCopContextSingleIndex( | ||
| exprCtx, | ||
| pushDownFlags, | ||
| tblInfo, | ||
| allIdxInfo[0], | ||
| requestSource, | ||
| useNewCollate, | ||
| ) | ||
| } | ||
| return NewCopContextMultiIndex(exprCtx, pushDownFlags, tblInfo, allIdxInfo, requestSource) | ||
| return NewCopContextMultiIndex(exprCtx, pushDownFlags, tblInfo, allIdxInfo, requestSource, useNewCollate) | ||
| } | ||
|
|
||
| // NewCopContextSingleIndex creates a CopContextSingleIndex. | ||
| // NewCopContextSingleIndex creates a CopContextSingleIndex with a fixed collation mode. | ||
| func NewCopContextSingleIndex( | ||
| exprCtx exprctx.BuildContext, | ||
| pushDownFlags uint64, | ||
| tblInfo *model.TableInfo, | ||
| idxInfo *model.IndexInfo, | ||
| requestSource string, | ||
| useNewCollate bool, | ||
| ) (*CopContextSingleIndex, error) { | ||
| cols := idxInfo.Columns | ||
| neededCols, err := tables.ExtractColumnsFromCondition(exprCtx, idxInfo, tblInfo, false) | ||
|
|
@@ -178,7 +196,7 @@ func NewCopContextSingleIndex( | |
| cols = append(cols, neededCols...) | ||
| cols = tables.DedupIndexColumns(cols) | ||
|
|
||
| base, err := NewCopContextBase(exprCtx, pushDownFlags, tblInfo, cols, requestSource) | ||
| base, err := NewCopContextBase(exprCtx, pushDownFlags, tblInfo, cols, requestSource, useNewCollate) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
@@ -228,13 +246,14 @@ func (c *CopContextSingleIndex) GetCondition() (expression.Expression, error) { | |
| return expr, nil | ||
|
joechenrh marked this conversation as resolved.
|
||
| } | ||
|
|
||
| // NewCopContextMultiIndex creates a CopContextMultiIndex. | ||
| // NewCopContextMultiIndex creates a CopContextMultiIndex with a fixed collation mode. | ||
| func NewCopContextMultiIndex( | ||
| exprCtx exprctx.BuildContext, | ||
| pushDownFlags uint64, | ||
| tblInfo *model.TableInfo, | ||
| allIdxInfo []*model.IndexInfo, | ||
| requestSource string, | ||
| useNewCollate bool, | ||
| ) (*CopContextMultiIndex, error) { | ||
| approxColLen := 0 | ||
| for _, idxInfo := range allIdxInfo { | ||
|
|
@@ -252,7 +271,7 @@ func NewCopContextMultiIndex( | |
| } | ||
| allIdxCols = tables.DedupIndexColumns(allIdxCols) | ||
|
|
||
| base, err := NewCopContextBase(exprCtx, pushDownFlags, tblInfo, allIdxCols, requestSource) | ||
| base, err := NewCopContextBase(exprCtx, pushDownFlags, tblInfo, allIdxCols, requestSource, useNewCollate) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.