-
Notifications
You must be signed in to change notification settings - Fork 594
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Part of the `jsonb` type support: * #7977 * #7986 * Introduce `DataType::Jsonb` **(this PR)** * Add more expressions #7714 In this PR: * Add `DataType::Jsonb`. * Support constructing it from string and displaying it as string. * Add e2e tests for `insert` and `select`. Also tested for the following but not added in CI: * prepared statement with BINARY format * kafka+json source with a `jsonb` field Approved-By: BugenZhao
- Loading branch information
1 parent
298a950
commit 32c55d0
Showing
22 changed files
with
196 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
statement ok | ||
SET RW_IMPLICIT_FLUSH TO true; | ||
|
||
query T rowsort | ||
values ('{"a":[2, true, "", {}]}'::jsonb), ('1'), ('true'), ('null'), (null), ('[1, true]'); | ||
---- | ||
1 | ||
NULL | ||
[1,true] | ||
null | ||
true | ||
{"a":[2,true,"",{}]} | ||
|
||
statement ok | ||
create table t (v1 jsonb); | ||
|
||
statement ok | ||
insert into t values ('1'), ('true'), ('null'), (null); | ||
|
||
query T rowsort | ||
select * from t; | ||
---- | ||
1 | ||
NULL | ||
null | ||
true | ||
|
||
query T | ||
select * from t order by v1::varchar; | ||
---- | ||
1 | ||
null | ||
true | ||
NULL | ||
|
||
statement ok | ||
drop table t; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# We do not intend to support using `jsonb` type for `group by` / `order by` / `primary key` | ||
# Before #7981 is done, we need these tests to make sure our system do not panic. | ||
# After #7981, we need them to make sure proper errors are returned to user. | ||
|
||
statement ok | ||
SET RW_IMPLICIT_FLUSH TO true; | ||
|
||
statement ok | ||
values ('{"a":[2, true, "", {}]}'::jsonb), ('1'), ('true'), ('null'), (null), ('[1, true]') order by 1; | ||
|
||
statement ok | ||
create table t (v1 jsonb); | ||
|
||
statement ok | ||
insert into t values ('1'), ('true'), ('null'), (null); | ||
|
||
statement ok | ||
select * from t order by v1; | ||
|
||
# deserialize length | ||
statement ok | ||
create materialized view mv1 as select * from t group by v1; | ||
|
||
statement ok | ||
select * from mv1; | ||
|
||
statement ok | ||
drop materialized view mv1; | ||
|
||
# deserialize pk | ||
statement ok | ||
create table t2 (v1 jsonb primary key); | ||
|
||
statement ok | ||
insert into t2 values ('1'), ('true'), ('null'), (null); | ||
|
||
statement ok | ||
select * from t2; | ||
|
||
statement ok | ||
drop table t2; | ||
|
||
statement ok | ||
drop table t; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.