-
Notifications
You must be signed in to change notification settings - Fork 613
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): fix parsing array literal and printing struct value #13229
Conversation
Signed-off-by: Runji Wang <[email protected]>
Signed-off-by: Runji Wang <[email protected]>
Signed-off-by: Runji Wang <[email protected]>
Signed-off-by: Runji Wang <[email protected]>
Signed-off-by: Runji Wang <[email protected]>
Signed-off-by: Runji Wang <[email protected]>
Signed-off-by: Runji Wang <[email protected]>
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://www.postgresql.org/docs/16/arrays.html#ARRAYS-IO
https://www.postgresql.org/docs/16/rowtypes.html#ROWTYPES-IO-SYNTAX
#4769
There are many edge cases. It is okay if we cannot resolve them all at once.
The wrong output may have been used in a lot of existing e2e slt tests 😢
src/common/src/array/list_array.rs
Outdated
elems.push(match trimmed[start..i].trim() { | ||
"" => return Err("Unexpected \"}\" character.".into()), | ||
s if s.eq_ignore_ascii_case("null") => None, | ||
s => Some(ScalarImpl::from_literal(&unquote(s), elem_type)?), |
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.
ScalarImpl::from_literal
and ScalarImpl::from_text
shall be consolidate to a FromText
(opposite of ToText
). For now I am okay with using either one.
Signed-off-by: Runji Wang <[email protected]>
Signed-off-by: Runji Wang <[email protected]>
Signed-off-by: Runji Wang <[email protected]>
Signed-off-by: Runji Wang <[email protected]>
Signed-off-by: Runji Wang <[email protected]>
Signed-off-by: Runji Wang <[email protected]>
96ac71e
to
48d7649
Compare
Signed-off-by: Runji Wang <[email protected]>
48d7649
to
47c8a4b
Compare
Signed-off-by: Runji Wang <[email protected]>
1e8e994
to
87e68e2
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #13229 +/- ##
==========================================
+ Coverage 67.62% 67.65% +0.03%
==========================================
Files 1527 1527
Lines 260464 260714 +250
==========================================
+ Hits 176132 176381 +249
- Misses 84332 84333 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
Very close ... Thank you for the effort!
Signed-off-by: Runji Wang <[email protected]>
Signed-off-by: Runji Wang <[email protected]>
Signed-off-by: Runji Wang <[email protected]>
Signed-off-by: Runji Wang <[email protected]>
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.
Did not construct any further problematic cases, but left two suggestions that hopefully improves the readability.
Btw there may be new tests added in main that uses the old output format, and we would need to fix them after merge-main.
Signed-off-by: Runji Wang <[email protected]>
0431ff2
to
e78129b
Compare
@xiangjinwu Thanks for your patient review. 🥹 |
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
Fix parsing array literal
fix #4769
This PR rewrites the parser using recursive descent approach.
Fix row to text
(),"\
"
is escaped to""
\
is escaped to\\
Move parsing logic to common
This PR also moves the parsing logic to a method
ListValue::from_str
in the common crate. The cast function no longer needs to build sub-expression on every call. As a result, the runtime ofcast(varchar) -> int8[]
function decreased from 952.10 µs to 185.21 µs (-80%).Checklist
./risedev check
(or alias,./risedev c
)Documentation