Skip to content

Commit

Permalink
add comments and rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
xiongjiwei committed Jan 4, 2022
1 parent a857aac commit cd6ebaf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 12 additions & 0 deletions expression/collation.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,18 @@ func deriveCollation(ctx sessionctx.Context, funcName string, args []Expression,
return ec, nil
case ast.Case:
// FIXME: case function aggregate collation is not correct.
// We should only aggregate the `then expression`,
// case ... when ... expression will rewrite to:
// args: eq scalar func(args: value, condition1), result1,
// eq scalar func(args: value, condition2), result2,
// ...
// else clause
// Or
// args: condition1, result1,
// condition2, result2,
// ...
// else clause
// so, the odd index arguments will be the `then expression`.
if argTps[1] == types.ETString {
fieldArgs := make([]Expression, 0)
for i := 1; i < len(args); i += 2 {
Expand Down
1 change: 0 additions & 1 deletion expression/integration_serial_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"testing"
"time"

mysql "github.com/pingcap/tidb/errno"
"github.com/pingcap/errors"
"github.com/pingcap/failpoint"
"github.com/pingcap/tidb/ddl/placement"
Expand Down

0 comments on commit cd6ebaf

Please sign in to comment.