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
Some code refactor for better performance of Avro-Extension
#4092
Conversation
asdf2014
commented
Mar 22, 2017
- Collections.singletonList instand of Arrays.asList;
- close FSDataInputStream/ByteBufferInputStream for releasing resource;
- convert com.google.common.base.Function into java.util.function.Function;
- others code refactor
…aInputStream/ByteBufferInputStream for releasing resource; 3. convert com.google.common.base.Function into java.util.function.Function; 4. others code refactor
Is that due to the issues #2386?
|
@asdf2014 unfortunately, sometimes the test fails sporadically. We can re-run them. Although, it looks like this conflicts with your other PR, so could you please resolve those first? LGTM otherwise. 👍 |
@gianm Thx. Already fix confilcts. |
Are there benchmarks to show performance improvements? |
@drcrallen I think that is not nessnary to benchmark those changes in the |
@asdf2014 without evidence of performance improvements please retract the claim of performance improvements. Refactoring code in ways that makes sense regardless of performance impact is fine. But claiming performance improvements without evidence is not. |
The suspected improvements can be left as-is, I'm just asking the claim in the PR title (and thus the squash-merged commit message that will be in master) be changed. |
Okey, i got it. Sorry for that. You can change the |
Benchmark Configa) Tranquility: b) JVM Option: c) Message: GC Result:Origin (before adding the
|
protected static InputRow parseGenericRecord(GenericRecord record, ParseSpec parseSpec, List<String> dimensions, | ||
boolean fromPigAvroStorage, boolean binaryAsString) | ||
protected static InputRow parseGenericRecord( | ||
GenericRecord record, ParseSpec parseSpec, List<String> dimensions, |
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.
According to Druid's code style, each param should be on it's own line
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 see, it will be changed into
protected static InputRow parseGenericRecord(
GenericRecord record,
ParseSpec parseSpec,
List<String> dimensions,
boolean fromPigAvroStorage,
boolean binaryAsString
)
@@ -102,7 +102,7 @@ public Object get(Object key) | |||
{ | |||
Object field = record.get(key.toString()); | |||
if (fromPigAvroStorage && field instanceof GenericData.Array) { | |||
return Lists.transform((List) field, PIG_AVRO_STORAGE_ARRAY_TO_STRING_INCLUDING_NULL); | |||
return Lists.transform((List) field, PIG_AVRO_STORAGE_ARRAY_TO_STRING_INCLUDING_NULL::apply); |
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.
How this change makes anything better?
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.
Yep, it will have a more functional
style with Java 8 Lambdas
instead of Guava Function
. :)
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.
PIG_AVRO_STORAGE_ARRAY_TO_STRING_INCLUDING_NULL
is already a function. By adding ::apply
, you transform it twice, but it end up being the same Guava's Function. It doesn't make anything more functional than it is currently
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.
Sure, you are right. I revert it back. 👍
Thanks @asdf2014! |