Skip to content
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

fix type cast for bigint unsigned #210

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/sql/plan/function/type_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ func initFixed1() {
{types.T_uint64, types.T_int8, types.T_uint64, types.T_uint64},
{types.T_uint64, types.T_int16, types.T_uint64, types.T_uint64},
{types.T_uint64, types.T_int32, types.T_uint64, types.T_uint64},
{types.T_uint64, types.T_int64, types.T_int64, types.T_int64},
{types.T_uint64, types.T_int64, types.T_uint64, types.T_uint64},
{types.T_uint64, types.T_uint8, types.T_uint64, types.T_uint64},
{types.T_uint64, types.T_uint16, types.T_uint64, types.T_uint64},
{types.T_uint64, types.T_uint32, types.T_uint64, types.T_uint64},
Expand Down
31 changes: 30 additions & 1 deletion test/distributed/cases/dtype/bigint.result
Original file line number Diff line number Diff line change
Expand Up @@ -504,4 +504,33 @@ insert into t3 values(100);
insert into t3 values(-1000);
select maxvalue from t1;
SQL parser error: You have an error in your SQL syntax; check the manual that corresponds to your MatrixOne server version for the right syntax to use. syntax error at line 1 column 15 near " maxvalue from t1;";
drop table t3;
drop table t3;
drop table if exists t1;
create table t1 (a bigint unsigned);
insert into t1 values (0xFFFFFFFFFFFFFFFD);
insert into t1 values (0xFFFFFFFFFFFFFFFE);
select * from t1;
a
18446744073709551613
18446744073709551614
select * from t1 where a -1 > 1;
a
18446744073709551613
18446744073709551614
select * from t1 where a > 1;
a
18446744073709551613
18446744073709551614
select * from t1 where a + 1 > 1;
a
18446744073709551613
18446744073709551614
select a + 1 from t1;
a + 1
18446744073709551614
18446744073709551615
select a - 1 from t1;
a - 1
18446744073709551612
18446744073709551613
drop table t1;
12 changes: 12 additions & 0 deletions test/distributed/cases/dtype/bigint.test
Original file line number Diff line number Diff line change
Expand Up @@ -265,3 +265,15 @@ insert into t3 values(100);
insert into t3 values(-1000);
select maxvalue from t1;
drop table t3;

drop table if exists t1;
create table t1 (a bigint unsigned);
insert into t1 values (0xFFFFFFFFFFFFFFFD);
insert into t1 values (0xFFFFFFFFFFFFFFFE);
select * from t1;
select * from t1 where a -1 > 1;
select * from t1 where a > 1;
select * from t1 where a + 1 > 1;
select a + 1 from t1;
select a - 1 from t1;
drop table t1;
Loading