-
Notifications
You must be signed in to change notification settings - Fork 593
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
feat(frontend): support single dimension array for extended-mode query #15614
Conversation
Thanks @xiangjinwu PTAL |
src/common/src/types/to_sql.rs
Outdated
where | ||
Self: Sized, | ||
{ | ||
self.iter().collect_vec().to_sql(ty, out) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure only 1 dimension?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://docs.rs/postgres-types/0.2.6/postgres_types/trait.ToSql.html#arrays
risingwave/src/common/src/types/to_binary.rs
Lines 124 to 127 in 855cd7d
DataType::Struct(_) | DataType::List(_) => bail_not_implemented!( | |
issue = 7949, | |
"the pgwire extended-mode encoding for lists with more than one dimension ({ty}) is unsupported" | |
), |
I think it should be guaranteed here that there will only be an array of 1 dimension?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But as a general trait implementation, to_sql
may have other callers (in the future) in addition to to_binary
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I rechecked, the postgres-types checked the array dimensions, so it was handled correctly:
https://github.com/sfackler/rust-postgres/blob/e528e01bbe2f7e198a55112fd6de3a24db3b8a6e/postgres-types/src/lib.rs#L586-L588
If the array dimension is greater than 1, it will return Err with error message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current implementation looks fine to me. I don't see buggy points.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The link above is for FromSql
. There seems to be no check of multiple dimensions in ToSql
there:
https://github.com/sfackler/rust-postgres/blob/e528e01bbe2f7e198a55112fd6de3a24db3b8a6e/postgres-types/src/lib.rs#L960
Can we confirm by actually executing to_sql
on a Vec<Vec<i32>>
or ListRef
of ListRef
of i32
value?
src/common/src/types/to_sql.rs
Outdated
where | ||
Self: Sized, | ||
{ | ||
matches!(ty.kind(), postgres_types::Kind::Array(_)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it mean that INT[]
can be accpeted by DATE[]
?
You should check the inner type as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think accept
has a way to check the inner type... it only know the postgres_type::Type
.
It should be a limitation of the ToSql
api.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think
accept
has a way to check the inner type... it only know thepostgres_type::Type
. It should be a limitation of theToSql
api.
What's _
inside the postgres_types::Kind::Array(_)
then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I understand, but we can still only check whether ty is a one-dimensional array. Is this implementation correct?
check it in the to_sql method of ListRef
This PR has been open for 60 days with no activity. Could you please update the status? Feel free to ping a reviewer if you are waiting for review. |
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
Split
e2e_test/batch/types/array_ty.slt.part
into 1-dime2e_test/batch/types/array_1d_ty.slt.part
and multi-dim (keep original name).Partially resolved - #7949.
Checklist
./risedev check
(or alias,./risedev c
)Documentation
Release note
If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.