Uh oh!
There was an error while loading. Please reload this page.
PARQUET-1711: support recursive proto schemas by limiting recursion depth - #995
Conversation
jinyius
commented
Sep 14, 2022
ping |
jinyius
commented
Sep 28, 2022
fixed missing dep issue. can someone approve the ci flow? |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| } | ||
| private <T> Builder<? extends Builder<?, GroupBuilder<T>>, GroupBuilder<T>> addField(FieldDescriptor descriptor, final GroupBuilder<T> builder) { | ||
| private <T> Builder<? extends Builder<?, GroupBuilder<T>>, GroupBuilder<T>> addField(FieldDescriptor descriptor, final GroupBuilder<T> builder, ImmutableSetMultimap<String, Integer> seen, int depth) { |
There was a problem hiding this comment.
would it make sense to consolidate seen and depth into a single data-structure that can be passed through and abstract some of the direct access to the multimap?
There was a problem hiding this comment.
?
the seen map does encode the seen fields along with their depth as a single datastructure. depth being a separate arg is important b/c it's the current depth in the traversal, and is used to update the seen data structure.
There was a problem hiding this comment.
right, I was thinking of encapsulating this logic into its own class, so they can be recorded and updated together, to 1. Reduce additional parameters that have to be passed through.
2. Encapsulate the logic behind more mnemonic method names (e.g. AddRecursiveStep())
There was a problem hiding this comment.
i'm not sure encapsulation helps with readability or protection in this case. they are really tracking different things, and should be understood by readers of the traversal code to know how each piece of state is used.
jinyius
commented
Sep 30, 2022
thanks for the review. updated to handle the logging perf concern as well as fixing the javadoc errors. |
…epth This approach could address the other recursion related issues (PARQUET-129, PARQUET-554).
jinyius
commented
Oct 7, 2022
ping |
| " }\n" + | ||
| "}"; | ||
| public void testProto3ConvertAllDatatypes() { | ||
| String expectedSchema = JOINER.join( |
There was a problem hiding this comment.
is it possible to separate this tpe of code style cleanup from functional changes?
There was a problem hiding this comment.
wdym by "tpe"?
if this isn't blocking, i'd rather avoid the busy-work to undo and redo in a different branch.
| : value instanceof Message | ||
| ? ((Message) value).toByteString() | ||
| // Worst-case, just dump as plain java string. | ||
| : ByteString.copyFromUtf8(value.toString()); |
There was a problem hiding this comment.
is this actually an intended state? If not it is probably better to raise an exception then writing data that could possibly be hard to recover.
There was a problem hiding this comment.
this is intended. for a real-time, production pipeline i'm working on, losing data as it passes through or killing the job b/c of an uncaught exception is problematic as it could lead to data loss and down time. this way, there's some way to know what the problematic data was and fix it properly asap.
| ? (ByteString) value | ||
| // TODO: figure out a way to use MessageOrBuilder | ||
| : value instanceof Message | ||
| ? ((Message) value).toByteString() |
There was a problem hiding this comment.
does recordconsumer offer a stream API or something else to avoid the additional array/bytestring copies?
There was a problem hiding this comment.
| @@ -0,0 +1,50 @@ | |||
| message Trees.BinaryTree { | |||
| optional group value = 1 { | |||
There was a problem hiding this comment.
this is parquet schema, not proto. protos should/would have a .proto suffix.
| option java_package = "org.apache.parquet.proto.test"; | ||
| message BinaryTree { | ||
| google.protobuf.Any value = 1; |
There was a problem hiding this comment.
it would be good to verify that something like:
message WrappedTree {
google.protobuf.Any non_recursive = 1;
BinaryTree tree = 2;
}
Also gives expected results (non_recursive doesn't accidentally trigger any of the recursio logic).
}
There was a problem hiding this comment.
i think the existing non-recursive proto tests exercise the existing and newly added (the skipping behavior) code paths.
emkornfield
commented
Oct 9, 2022
Mostly looks reasonable, I'm not too familiar with parquet-mr @shangxinli can you recommend someone who might be able to give a better review? |
jinyius
commented
Oct 17, 2022
pinging @shangxinli :) |
shangxinli
commented
Oct 17, 2022
@ggershinsky Can you have a look? |
ggershinsky
left a comment
There was a problem hiding this comment.
I'm ok with the current state of the PR, and would like to thank its reviewers.
ggershinsky
commented
Oct 19, 2022
I would also like to recommend adding @matthieun as a co-author to this PR, per the discussion in the parallel PR. |
|
Co-authored-by: matthieun <matthieu.nahoum@gmail.com>
jinyius
commented
Oct 24, 2022
can someone retry the github actions? there seemed to have been a transient issue that caused one of the test/build targets to fail. i'd like to get this change in this week. |
emkornfield
commented
Oct 31, 2022
@ggershinsky what is the process to merge this? Does parquet-mr just use the github UI? |
ggershinsky
commented
Oct 31, 2022
yep, just the squash/merge button. |
jinyius
commented
Oct 31, 2022
i'd love to just hit the button. i don't see it. the workflow for travis ci had a failure due to a transient connection issue, and so it wasn't giving me the option to merge. the ui messaging also states that "Only those with write access to this repository can merge pull requests." |
ggershinsky
commented
Nov 1, 2022
@shangxinli are you ok with this PR in its current form? |
jinyius
commented
Nov 1, 2022
yeah, i still don't see a button to merge. it now shows everything approved, checks passed, and no conflicts. i think a committer needs to merge. |
emkornfield
commented
Nov 1, 2022
@jinyius only committers can see the button. I was asking because different repos have different commit procedures. Should be able to merge this soon as long as @shangxinli doesn't express concerns. |
shangxinli
commented
Nov 2, 2022
LGTM |
Jira
Tests
ProtoSchemaConverterTest#test*RecursionProtoWriteSupportTest#test*RecursionCommits
Documentation