@@ -1580,7 +1580,9 @@ func TestExprPushDownToTiKV(t *testing.T) {
1580
1580
require .Len (t , pushed , 0 )
1581
1581
require .Len (t , remained , len (exprs ))
1582
1582
1583
- // Test Conv function
1583
+ // Test Conv function, `conv` function for a BIT column should not be pushed down for its special behavior which
1584
+ // is only handled in TiDB currently.
1585
+ // see issue: https://github.com/pingcap/tidb/issues/51877
1584
1586
exprs = exprs [:0 ]
1585
1587
function , err = NewFunction (mock .NewContext (), ast .Conv , types .NewFieldType (mysql .TypeString ), stringColumn , intColumn , intColumn )
1586
1588
require .NoError (t , err )
@@ -1589,7 +1591,11 @@ func TestExprPushDownToTiKV(t *testing.T) {
1589
1591
require .Len (t , pushed , len (exprs ))
1590
1592
require .Len (t , remained , 0 )
1591
1593
exprs = exprs [:0 ]
1592
- castByteAsStringFunc , err := NewFunction (mock .NewContext (), ast .Cast , types .NewFieldType (mysql .TypeString ), byteColumn )
1594
+ // when conv a column with type BIT, a cast function will be used to cast bit to a binary string
1595
+ castTp := types .NewFieldType (mysql .TypeString )
1596
+ castTp .SetCharset (charset .CharsetBin )
1597
+ castTp .SetCollate (charset .CollationBin )
1598
+ castByteAsStringFunc , err := NewFunction (mock .NewContext (), ast .Cast , castTp , byteColumn )
1593
1599
require .NoError (t , err )
1594
1600
function , err = NewFunction (mock .NewContext (), ast .Conv , types .NewFieldType (mysql .TypeString ), castByteAsStringFunc , intColumn , intColumn )
1595
1601
require .NoError (t , err )
0 commit comments