Skip to content

Extract a common error message pattern for conflicted SQL hints and hint alias #11632

@foreyes

Description

@foreyes

Feature Request

Is your feature request related to a problem? Please describe:

When adding new optimizer hints #11364 , we have these warnings messages:
"Optimizer aggregation hints are conflicted" for TIDB_HASHAGG and TIDB_STREAMAGG.
"Join hints are conflict, you can only specify one type of join" for Join Hints.

Describe the feature you'd like:

Extract a common error message pattern for conflicted SQL hints, for example:

errMsgPattern := "Conflicted SQL Hints for %s. You can only specify one of these hints: %s"
errConflictedSQLHints := terror.ClassOptimizer.New(codeInternal, errMsgPattern)
errConflictedSQLHints.GenWithStackByArgs(
	"Aggregate",
	strings.Join([]string{"TIDB_HASHAGG()", "TIDB_STREAMAGG()"}, ","),
)
errConflictedSQLHints.GenWithStackByArgs(
	"Join",
	strings.Join([]string{"TIDB_HJ()", "TIDB_SMJ()", "TIDB_INLJ()"}, ","),
)

Describe alternatives you've considered:

Teachability, Documentation, Adoption, Migration Strategy:

Metadata

Metadata

Assignees

Labels

sig/plannerSIG: Plannertype/enhancementThe issue or PR belongs to an enhancement.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions