-
Notifications
You must be signed in to change notification settings - Fork 599
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
disallow usage of jsonb
/map
type in group by
/ order by
/ primary key
#7981
Comments
I think we need to prioritize it |
@xiangjinwu Any reason we postpone this? |
Until recently, it has been inactive because there was no mechanism to disallow a specific DataType in certain Usage. The initial motivation includes replacing Recently we also run into a case where
Disallowing it would effectively mark these queries as unsupported. That being said, these queries perform badly today and are likely unpractical in heavier loads. But they do look useful and may need alternative plans to support. |
Regarding the subqueries, I feel they can be rewritten. Basically it's table functions involved. select col, agg(ele) from tf(json) as tf_results(ele) from t
==
with expanded(pk, col, ele) as (select pk, col, tf(json) from t)
select first_value(col), agg(ele) from expanded
group by pk
select col, ele from t, tf(json) as tf_results(ele);
==
select col, tf(json) from t; Currently, they are not banned just because #14442 puts the Visitor at a too early position. |
The subquery concern is about the general rule / algorithm, rather than these 2 specific cases. In Unnesting Arbitrary Queries, the domain is defined as the set of unique values of correlated columns on the outer side. Without the ability to calculate unique values with agg and the ability to join on them, for certain data types, this decorrelation approach is effectively banned to support columns of such data types to be correlated. ^ This requires real agg & join at the executor level, unless simplified away by plan optimization. |
Note that -- in risingwave
> select '{"a":1,"b":2}'::jsonb = '{"b":2, "a":1}';
t
> select '{"a":1,"b":2}'::jsonb < '{"b":2, "a":1}';
Unsupported function: less_than
-- in duckdb (btw, they seem to preserve original json text)
> SELECT {b:2,a:1}::JSON = {a:1,b:2}::JSON;
false
> SELECT {b:2,a:1}::JSON < {a:1,b:2}::JSON;
false We chose to make it defined, but sacrificed performance. risingwave/src/common/src/types/jsonb.rs Lines 93 to 109 in 0883df5
For the new map type #17743 (which is physically a list), it has the same problem: -- in duckdb
> SELECT MAP {'key1':10,'key2':20}=MAP {'key2':20,'key1':10};
false |
I would consider this as a difference between
|
Some discussion https://risingwave-labs.slack.com/archives/C034TRPKN1F/p1722317649393599 For the
|
Actually, it's a different problem. This issue is mainly targeted at user interface, that is, we may forbid |
jsonb
type in group by
/ order by
/ primary key
jsonb
/map
type in group by
/ order by
/ primary key
No description provided.
The text was updated successfully, but these errors were encountered: