-
Notifications
You must be signed in to change notification settings - Fork 7k
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: protobuf: serde: exception bypass for canonical repeated nested #69556
Merged
Avogar
merged 5 commits into
ClickHouse:master
from
hileef:fix/serde/protobuf/bypass-libunwind-on-nested-repeated
Sep 27, 2024
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
df482bb
fix: protobuf: serde: exception bypass for canonical repeated nested
hileef 2cef7f7
fix: formats: protobuf: serde: fix style
hileef 93ae795
fix: formats: protobuf: serde: pre-create format schema files folder
hileef a44d602
fix: formats: protobuf: serde: formats appear disabled in fasttest
hileef 167196b
fix: formats: protobuf: serde: fix client call, target correct db
hileef File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
3 changes: 3 additions & 0 deletions
3
tests/queries/0_stateless/03234_proto_complex_nested_repeated_noexception.reference
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,3 @@ | ||
{"error_not_raised":1} | ||
{"i":1001,"j.k":[2101,2102],"j.l":[2201,2202],"m":3001,"n":[4001,4002,4003,4004],"o.key":[5001,5002],"o.value":[{"p":[{"q":5111,"r":5121}]},{"p":[{"q":5112,"r":5122},{"q":5113,"r":5123}]}]} | ||
{"i":6001,"j.k":[7101],"j.l":[7201],"m":8001,"n":[],"o.key":[9001],"o.value":[{"p":[{"q":10111,"r":10121}]}]} |
50 changes: 50 additions & 0 deletions
50
tests/queries/0_stateless/03234_proto_complex_nested_repeated_noexception.sh
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,50 @@ | ||
#!/usr/bin/env bash | ||
# Tags: no-fasttest | ||
|
||
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) | ||
. "$CURDIR"/../shell_config.sh | ||
|
||
mkdir -p "${CLICKHOUSE_SCHEMA_FILES}" | ||
SOURCE_SCHEMA_FILE="${CURDIR}/format_schemas/03234_proto_complex_nested_repeated_noexception.proto" | ||
TARGET_SCHEMA_FILE="${CLICKHOUSE_SCHEMA_FILES}/03234_proto_complex_nested_repeated_noexception.proto" | ||
cp "${SOURCE_SCHEMA_FILE}" "${TARGET_SCHEMA_FILE}" | ||
|
||
cat <<'EOF' | $CLICKHOUSE_CLIENT -mn | ||
|
||
DROP TABLE IF EXISTS exception_counter ; | ||
CREATE TABLE exception_counter (`val` UInt32) ENGINE = Memory ; | ||
INSERT INTO exception_counter SELECT sum(value) FROM system.errors WHERE name = 'PROTOBUF_FIELD_NOT_REPEATED' ; | ||
|
||
DROP TABLE IF EXISTS table_file ; | ||
CREATE TABLE table_file ( | ||
`i` UInt32, | ||
`j.k` Array(UInt32), | ||
`j.l` Array(UInt32), | ||
`m` UInt32, | ||
`n` Array(UInt32), | ||
`o` Nested( | ||
`key` UInt32, | ||
`value` Tuple( | ||
`p` Nested( | ||
`q` UInt32, | ||
`r` UInt32 | ||
) | ||
) | ||
) | ||
) ENGINE File(Protobuf) SETTINGS format_schema = '03234_proto_complex_nested_repeated_noexception.proto:A' ; | ||
|
||
INSERT INTO table_file VALUES | ||
( 1001, [2101, 2102], [2201, 2202], 3001, [4001, 4002, 4003, 4004], [5001,5002] , [ ([(5111,5121)]), ([(5112,5122),(5113,5123)]) ] ), | ||
( 6001, [7101], [7201], 8001, [], [9001] , [ ([(10111,10121)]) ] ) ; | ||
|
||
INSERT INTO exception_counter SELECT sum(value) FROM system.errors WHERE name = 'PROTOBUF_FIELD_NOT_REPEATED' ; | ||
SELECT min(val) == max(val) as error_not_raised FROM exception_counter FORMAT JSONEachRow ; | ||
|
||
SELECT * FROM table_file FORMAT JSONEachRow ; | ||
|
||
DROP TABLE exception_counter ; | ||
DROP TABLE table_file ; | ||
|
||
EOF | ||
|
||
rm -f "${TARGET_SCHEMA_FILE}" |
5 changes: 5 additions & 0 deletions
5
tests/queries/0_stateless/03234_proto_simple_nested_repeated_noexception.reference
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,5 @@ | ||
{"error_not_raised":1} | ||
{"u":1001,"v.w":[],"v.x":[],"v.y":[],"v.z":[]} | ||
{"u":2002,"v.w":[2102],"v.x":[2202],"v.y":[[2302]],"v.z":[[2402,2403]]} | ||
{"u":3003,"v.w":[3103,3104],"v.x":[3203,3204],"v.y":[[3303],[3304]],"v.z":[[3403,3404],[3405,3406]]} | ||
{"u":4004,"v.w":[4104,4105,4106],"v.x":[4204,4205,4206],"v.y":[[4304],[4305],[4306]],"v.z":[[4304,4305],[4306,4307],[4308,4309]]} |
44 changes: 44 additions & 0 deletions
44
tests/queries/0_stateless/03234_proto_simple_nested_repeated_noexception.sh
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 @@ | ||
#!/usr/bin/env bash | ||
# Tags: no-fasttest | ||
|
||
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) | ||
. "$CURDIR"/../shell_config.sh | ||
|
||
mkdir -p "${CLICKHOUSE_SCHEMA_FILES}" | ||
SOURCE_SCHEMA_FILE="${CURDIR}/format_schemas/03234_proto_simple_nested_repeated_noexception.proto" | ||
TARGET_SCHEMA_FILE="${CLICKHOUSE_SCHEMA_FILES}/03234_proto_simple_nested_repeated_noexception.proto" | ||
cp "${SOURCE_SCHEMA_FILE}" "${TARGET_SCHEMA_FILE}" | ||
|
||
cat <<'EOF' | $CLICKHOUSE_CLIENT -mn | ||
|
||
DROP TABLE IF EXISTS exception_counter ; | ||
CREATE TABLE exception_counter (`val` UInt32) ENGINE = Memory ; | ||
INSERT INTO exception_counter SELECT sum(value) FROM system.errors WHERE name = 'PROTOBUF_FIELD_NOT_REPEATED' ; | ||
|
||
DROP TABLE IF EXISTS table_file ; | ||
CREATE TABLE table_file ( | ||
`u` UInt32, | ||
`v.w` Array(UInt32), | ||
`v.x` Array(UInt32), | ||
`v.y` Array(Array(UInt32)), | ||
`v.z` Array(Array(UInt32)) | ||
) ENGINE File(Protobuf) SETTINGS format_schema = '03234_proto_simple_nested_repeated_noexception.proto:M' ; | ||
|
||
INSERT INTO table_file VALUES | ||
( 1001, [], [], [], []), | ||
( 2002, [2102], [2202], [[2302]], [[2402, 2403]]), | ||
( 3003, [3103, 3104], [3203, 3204], [[3303], [3304]], [[3403, 3404], [3405, 3406]]), | ||
( 4004, [4104, 4105, 4106], [4204, 4205, 4206], [[4304], [4305], [4306]], [[4304, 4305], [4306, 4307], [4308, 4309]]); | ||
|
||
|
||
INSERT INTO exception_counter SELECT sum(value) FROM system.errors WHERE name = 'PROTOBUF_FIELD_NOT_REPEATED' ; | ||
SELECT min(val) == max(val) as error_not_raised FROM exception_counter FORMAT JSONEachRow ; | ||
|
||
SELECT * FROM table_file FORMAT JSONEachRow ; | ||
|
||
DROP TABLE exception_counter ; | ||
DROP TABLE table_file ; | ||
|
||
EOF | ||
|
||
rm -f "${TARGET_SCHEMA_FILE}" |
25 changes: 25 additions & 0 deletions
25
.../queries/0_stateless/format_schemas/03234_proto_complex_nested_repeated_noexception.proto
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,25 @@ | ||
syntax = "proto3"; | ||
|
||
message A { | ||
message B { | ||
uint32 k = 2100 ; | ||
uint32 l = 2200 ; | ||
} | ||
|
||
uint32 i = 1000 ; | ||
repeated B j = 2000 ; | ||
uint32 m = 3000 ; | ||
|
||
repeated uint32 n = 4000 ; | ||
|
||
map<uint32, C> o = 5000 ; | ||
} | ||
|
||
message D { | ||
uint32 q = 5110 ; | ||
uint32 r = 5120 ; | ||
} | ||
|
||
message C { | ||
repeated D p = 5100 ; | ||
} |
13 changes: 13 additions & 0 deletions
13
...s/queries/0_stateless/format_schemas/03234_proto_simple_nested_repeated_noexception.proto
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,13 @@ | ||
syntax = "proto3"; | ||
|
||
message M { | ||
uint32 u = 1000 ; | ||
repeated N v = 2000 ; | ||
|
||
message N { | ||
uint32 w = 2100 ; | ||
uint32 x = 2200 ; | ||
repeated uint32 y = 2300 ; | ||
repeated uint32 z = 2400 ; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This specific change is not required per se, but it arguably brings all relevant code paths into the diff.
If it may help the review, we can get rid of that 🙏