pingcap / tidb

TiDB - the open-source, cloud-native, distributed SQL database designed for modern applications.
https://pingcap.com
Apache License 2.0
37.25k stars 5.84k forks source link

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

Open foreyes opened 5 years ago

foreyes commented 5 years ago

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:

foreyes commented 5 years ago

Maybe we need take Hint Alias into considering too.