flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmetzger <...@git.apache.org>
Subject [GitHub] flink pull request: [Flink-3691] extend avroinputformat to support...
Date Thu, 28 Apr 2016 14:36:49 GMT
Github user rmetzger commented on a diff in the pull request:

    https://github.com/apache/flink/pull/1920#discussion_r61437731
  
    --- Diff: flink-batch-connectors/flink-avro/src/main/java/org/apache/flink/api/java/io/AvroInputFormat.java
---
    @@ -119,12 +138,14 @@ public E nextRecord(E reuseValue) throws IOException {
     		if (reachedEnd()) {
     			return null;
     		}
    -		
    -		if (!reuseAvroValue) {
    -			reuseValue = InstantiationUtil.instantiate(avroValueType, Object.class);
    +		if (org.apache.avro.generic.GenericRecord.class == avroValueType) {
    +			return reuseAvroValue ? dataFileReader.next(reuseValue) : dataFileReader.next();
    +		} else {
    +			if (!reuseAvroValue) {
    +				reuseValue = InstantiationUtil.instantiate(avroValueType, Object.class);
    +			}
    +			reuseValue = dataFileReader.next(reuseValue);
    --- End diff --
    
    The use of the ternary operator seems to be very inconsistent here.
    Either use it for the return value and the assignment or not at all.
    
    I personally prefer to avoid it whenever possible.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message