-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
"avro.java.string" support in union type for fast serializer (#70)
* "avro.java.string" support in union type for fast serializer * Code gen for #70
- Loading branch information
Showing
12 changed files
with
429 additions
and
43 deletions.
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
...gPropertyInsideUnionTest_GenericDeserializer_6238557830396401576_6238557830396401576.java
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,66 @@ | ||
|
||
package com.linkedin.avro.fastserde.generated.deserialization.AVRO_1_4; | ||
|
||
import java.io.IOException; | ||
import com.linkedin.avro.fastserde.FastDeserializer; | ||
import org.apache.avro.Schema; | ||
import org.apache.avro.generic.IndexedRecord; | ||
import org.apache.avro.io.Decoder; | ||
import org.apache.avro.util.Utf8; | ||
|
||
public class FastStringableTest_javaStringPropertyInsideUnionTest_GenericDeserializer_6238557830396401576_6238557830396401576 | ||
implements FastDeserializer<IndexedRecord> | ||
{ | ||
|
||
private final Schema readerSchema; | ||
private final Schema favorite_number0; | ||
private final Schema favorite_color0; | ||
|
||
public FastStringableTest_javaStringPropertyInsideUnionTest_GenericDeserializer_6238557830396401576_6238557830396401576(Schema readerSchema) { | ||
this.readerSchema = readerSchema; | ||
this.favorite_number0 = readerSchema.getField("favorite_number").schema(); | ||
this.favorite_color0 = readerSchema.getField("favorite_color").schema(); | ||
} | ||
|
||
public IndexedRecord deserialize(IndexedRecord reuse, Decoder decoder) | ||
throws IOException | ||
{ | ||
return deserializeFastStringableTest_javaStringPropertyInsideUnionTest0((reuse), (decoder)); | ||
} | ||
|
||
public IndexedRecord deserializeFastStringableTest_javaStringPropertyInsideUnionTest0(Object reuse, Decoder decoder) | ||
throws IOException | ||
{ | ||
IndexedRecord FastStringableTest_javaStringPropertyInsideUnionTest; | ||
if ((((reuse)!= null)&&((reuse) instanceof IndexedRecord))&&(((IndexedRecord)(reuse)).getSchema() == readerSchema)) { | ||
FastStringableTest_javaStringPropertyInsideUnionTest = ((IndexedRecord)(reuse)); | ||
} else { | ||
FastStringableTest_javaStringPropertyInsideUnionTest = new org.apache.avro.generic.GenericData.Record(readerSchema); | ||
} | ||
if (FastStringableTest_javaStringPropertyInsideUnionTest.get(0) instanceof Utf8) { | ||
FastStringableTest_javaStringPropertyInsideUnionTest.put(0, (decoder).readString(((Utf8) FastStringableTest_javaStringPropertyInsideUnionTest.get(0)))); | ||
} else { | ||
FastStringableTest_javaStringPropertyInsideUnionTest.put(0, (decoder).readString(null)); | ||
} | ||
int unionIndex0 = (decoder.readIndex()); | ||
if (unionIndex0 == 0) { | ||
decoder.readNull(); | ||
} | ||
if (unionIndex0 == 1) { | ||
FastStringableTest_javaStringPropertyInsideUnionTest.put(1, (decoder.readInt())); | ||
} | ||
int unionIndex1 = (decoder.readIndex()); | ||
if (unionIndex1 == 0) { | ||
decoder.readNull(); | ||
} | ||
if (unionIndex1 == 1) { | ||
if (FastStringableTest_javaStringPropertyInsideUnionTest.get(2) instanceof Utf8) { | ||
FastStringableTest_javaStringPropertyInsideUnionTest.put(2, (decoder).readString(((Utf8) FastStringableTest_javaStringPropertyInsideUnionTest.get(2)))); | ||
} else { | ||
FastStringableTest_javaStringPropertyInsideUnionTest.put(2, (decoder).readString(null)); | ||
} | ||
} | ||
return FastStringableTest_javaStringPropertyInsideUnionTest; | ||
} | ||
|
||
} |
57 changes: 57 additions & 0 deletions
57
...gPropertyInsideUnionTest_GenericDeserializer_4476580127917956418_4476580127917956418.java
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,57 @@ | ||
|
||
package com.linkedin.avro.fastserde.generated.deserialization.AVRO_1_7; | ||
|
||
import java.io.IOException; | ||
import com.linkedin.avro.fastserde.FastDeserializer; | ||
import org.apache.avro.Schema; | ||
import org.apache.avro.generic.IndexedRecord; | ||
import org.apache.avro.io.Decoder; | ||
|
||
public class FastStringableTest_javaStringPropertyInsideUnionTest_GenericDeserializer_4476580127917956418_4476580127917956418 | ||
implements FastDeserializer<IndexedRecord> | ||
{ | ||
|
||
private final Schema readerSchema; | ||
private final Schema favorite_number0; | ||
private final Schema favorite_color0; | ||
|
||
public FastStringableTest_javaStringPropertyInsideUnionTest_GenericDeserializer_4476580127917956418_4476580127917956418(Schema readerSchema) { | ||
this.readerSchema = readerSchema; | ||
this.favorite_number0 = readerSchema.getField("favorite_number").schema(); | ||
this.favorite_color0 = readerSchema.getField("favorite_color").schema(); | ||
} | ||
|
||
public IndexedRecord deserialize(IndexedRecord reuse, Decoder decoder) | ||
throws IOException | ||
{ | ||
return deserializeFastStringableTest_javaStringPropertyInsideUnionTest0((reuse), (decoder)); | ||
} | ||
|
||
public IndexedRecord deserializeFastStringableTest_javaStringPropertyInsideUnionTest0(Object reuse, Decoder decoder) | ||
throws IOException | ||
{ | ||
IndexedRecord FastStringableTest_javaStringPropertyInsideUnionTest; | ||
if ((((reuse)!= null)&&((reuse) instanceof IndexedRecord))&&(((IndexedRecord)(reuse)).getSchema() == readerSchema)) { | ||
FastStringableTest_javaStringPropertyInsideUnionTest = ((IndexedRecord)(reuse)); | ||
} else { | ||
FastStringableTest_javaStringPropertyInsideUnionTest = new org.apache.avro.generic.GenericData.Record(readerSchema); | ||
} | ||
FastStringableTest_javaStringPropertyInsideUnionTest.put(0, (decoder).readString()); | ||
int unionIndex0 = (decoder.readIndex()); | ||
if (unionIndex0 == 0) { | ||
decoder.readNull(); | ||
} | ||
if (unionIndex0 == 1) { | ||
FastStringableTest_javaStringPropertyInsideUnionTest.put(1, (decoder.readInt())); | ||
} | ||
int unionIndex1 = (decoder.readIndex()); | ||
if (unionIndex1 == 0) { | ||
decoder.readNull(); | ||
} | ||
if (unionIndex1 == 1) { | ||
FastStringableTest_javaStringPropertyInsideUnionTest.put(2, (decoder).readString()); | ||
} | ||
return FastStringableTest_javaStringPropertyInsideUnionTest; | ||
} | ||
|
||
} |
57 changes: 57 additions & 0 deletions
57
...gPropertyInsideUnionTest_GenericDeserializer_4476580127917956418_4476580127917956418.java
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,57 @@ | ||
|
||
package com.linkedin.avro.fastserde.generated.deserialization.AVRO_1_8; | ||
|
||
import java.io.IOException; | ||
import com.linkedin.avro.fastserde.FastDeserializer; | ||
import org.apache.avro.Schema; | ||
import org.apache.avro.generic.IndexedRecord; | ||
import org.apache.avro.io.Decoder; | ||
|
||
public class FastStringableTest_javaStringPropertyInsideUnionTest_GenericDeserializer_4476580127917956418_4476580127917956418 | ||
implements FastDeserializer<IndexedRecord> | ||
{ | ||
|
||
private final Schema readerSchema; | ||
private final Schema favorite_number0; | ||
private final Schema favorite_color0; | ||
|
||
public FastStringableTest_javaStringPropertyInsideUnionTest_GenericDeserializer_4476580127917956418_4476580127917956418(Schema readerSchema) { | ||
this.readerSchema = readerSchema; | ||
this.favorite_number0 = readerSchema.getField("favorite_number").schema(); | ||
this.favorite_color0 = readerSchema.getField("favorite_color").schema(); | ||
} | ||
|
||
public IndexedRecord deserialize(IndexedRecord reuse, Decoder decoder) | ||
throws IOException | ||
{ | ||
return deserializeFastStringableTest_javaStringPropertyInsideUnionTest0((reuse), (decoder)); | ||
} | ||
|
||
public IndexedRecord deserializeFastStringableTest_javaStringPropertyInsideUnionTest0(Object reuse, Decoder decoder) | ||
throws IOException | ||
{ | ||
IndexedRecord FastStringableTest_javaStringPropertyInsideUnionTest; | ||
if ((((reuse)!= null)&&((reuse) instanceof IndexedRecord))&&(((IndexedRecord)(reuse)).getSchema() == readerSchema)) { | ||
FastStringableTest_javaStringPropertyInsideUnionTest = ((IndexedRecord)(reuse)); | ||
} else { | ||
FastStringableTest_javaStringPropertyInsideUnionTest = new org.apache.avro.generic.GenericData.Record(readerSchema); | ||
} | ||
FastStringableTest_javaStringPropertyInsideUnionTest.put(0, (decoder).readString()); | ||
int unionIndex0 = (decoder.readIndex()); | ||
if (unionIndex0 == 0) { | ||
decoder.readNull(); | ||
} | ||
if (unionIndex0 == 1) { | ||
FastStringableTest_javaStringPropertyInsideUnionTest.put(1, (decoder.readInt())); | ||
} | ||
int unionIndex1 = (decoder.readIndex()); | ||
if (unionIndex1 == 0) { | ||
decoder.readNull(); | ||
} | ||
if (unionIndex1 == 1) { | ||
FastStringableTest_javaStringPropertyInsideUnionTest.put(2, (decoder).readString()); | ||
} | ||
return FastStringableTest_javaStringPropertyInsideUnionTest; | ||
} | ||
|
||
} |
56 changes: 56 additions & 0 deletions
56
...ringableTest_javaStringPropertyInsideUnionTest_GenericSerializer_6238557830396401576.java
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,56 @@ | ||
|
||
package com.linkedin.avro.fastserde.generated.serialization.AVRO_1_4; | ||
|
||
import java.io.IOException; | ||
import com.linkedin.avro.fastserde.FastSerializer; | ||
import org.apache.avro.generic.IndexedRecord; | ||
import org.apache.avro.io.Encoder; | ||
import org.apache.avro.util.Utf8; | ||
|
||
public class FastStringableTest_javaStringPropertyInsideUnionTest_GenericSerializer_6238557830396401576 | ||
implements FastSerializer<IndexedRecord> | ||
{ | ||
|
||
|
||
public void serialize(IndexedRecord data, Encoder encoder) | ||
throws IOException | ||
{ | ||
serializeFastStringableTest_javaStringPropertyInsideUnionTest0(data, (encoder)); | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
public void serializeFastStringableTest_javaStringPropertyInsideUnionTest0(IndexedRecord data, Encoder encoder) | ||
throws IOException | ||
{ | ||
if (data.get(0) instanceof Utf8) { | ||
(encoder).writeString(((Utf8) data.get(0))); | ||
} else { | ||
(encoder).writeString(data.get(0).toString()); | ||
} | ||
Integer favorite_number0 = ((Integer) data.get(1)); | ||
if (favorite_number0 == null) { | ||
(encoder).writeIndex(0); | ||
(encoder).writeNull(); | ||
} else { | ||
if (favorite_number0 instanceof Integer) { | ||
(encoder).writeIndex(1); | ||
(encoder).writeInt(((Integer) favorite_number0)); | ||
} | ||
} | ||
CharSequence favorite_color0 = ((CharSequence) data.get(2)); | ||
if (favorite_color0 == null) { | ||
(encoder).writeIndex(0); | ||
(encoder).writeNull(); | ||
} else { | ||
if (favorite_color0 instanceof CharSequence) { | ||
(encoder).writeIndex(1); | ||
if (favorite_color0 instanceof Utf8) { | ||
(encoder).writeString(((Utf8) favorite_color0)); | ||
} else { | ||
(encoder).writeString(favorite_color0 .toString()); | ||
} | ||
} | ||
} | ||
} | ||
|
||
} |
56 changes: 56 additions & 0 deletions
56
...ringableTest_javaStringPropertyInsideUnionTest_GenericSerializer_4476580127917956418.java
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,56 @@ | ||
|
||
package com.linkedin.avro.fastserde.generated.serialization.AVRO_1_7; | ||
|
||
import java.io.IOException; | ||
import com.linkedin.avro.fastserde.FastSerializer; | ||
import org.apache.avro.generic.IndexedRecord; | ||
import org.apache.avro.io.Encoder; | ||
import org.apache.avro.util.Utf8; | ||
|
||
public class FastStringableTest_javaStringPropertyInsideUnionTest_GenericSerializer_4476580127917956418 | ||
implements FastSerializer<IndexedRecord> | ||
{ | ||
|
||
|
||
public void serialize(IndexedRecord data, Encoder encoder) | ||
throws IOException | ||
{ | ||
serializeFastStringableTest_javaStringPropertyInsideUnionTest0(data, (encoder)); | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
public void serializeFastStringableTest_javaStringPropertyInsideUnionTest0(IndexedRecord data, Encoder encoder) | ||
throws IOException | ||
{ | ||
if (data.get(0) instanceof Utf8) { | ||
(encoder).writeString(((Utf8) data.get(0))); | ||
} else { | ||
(encoder).writeString(data.get(0).toString()); | ||
} | ||
Integer favorite_number0 = ((Integer) data.get(1)); | ||
if (favorite_number0 == null) { | ||
(encoder).writeIndex(0); | ||
(encoder).writeNull(); | ||
} else { | ||
if (favorite_number0 instanceof Integer) { | ||
(encoder).writeIndex(1); | ||
(encoder).writeInt(((Integer) favorite_number0)); | ||
} | ||
} | ||
CharSequence favorite_color0 = ((CharSequence) data.get(2)); | ||
if (favorite_color0 == null) { | ||
(encoder).writeIndex(0); | ||
(encoder).writeNull(); | ||
} else { | ||
if (favorite_color0 instanceof CharSequence) { | ||
(encoder).writeIndex(1); | ||
if (favorite_color0 instanceof Utf8) { | ||
(encoder).writeString(((Utf8) favorite_color0)); | ||
} else { | ||
(encoder).writeString(favorite_color0 .toString()); | ||
} | ||
} | ||
} | ||
} | ||
|
||
} |
56 changes: 56 additions & 0 deletions
56
...ringableTest_javaStringPropertyInsideUnionTest_GenericSerializer_4476580127917956418.java
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,56 @@ | ||
|
||
package com.linkedin.avro.fastserde.generated.serialization.AVRO_1_8; | ||
|
||
import java.io.IOException; | ||
import com.linkedin.avro.fastserde.FastSerializer; | ||
import org.apache.avro.generic.IndexedRecord; | ||
import org.apache.avro.io.Encoder; | ||
import org.apache.avro.util.Utf8; | ||
|
||
public class FastStringableTest_javaStringPropertyInsideUnionTest_GenericSerializer_4476580127917956418 | ||
implements FastSerializer<IndexedRecord> | ||
{ | ||
|
||
|
||
public void serialize(IndexedRecord data, Encoder encoder) | ||
throws IOException | ||
{ | ||
serializeFastStringableTest_javaStringPropertyInsideUnionTest0(data, (encoder)); | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
public void serializeFastStringableTest_javaStringPropertyInsideUnionTest0(IndexedRecord data, Encoder encoder) | ||
throws IOException | ||
{ | ||
if (data.get(0) instanceof Utf8) { | ||
(encoder).writeString(((Utf8) data.get(0))); | ||
} else { | ||
(encoder).writeString(data.get(0).toString()); | ||
} | ||
Integer favorite_number0 = ((Integer) data.get(1)); | ||
if (favorite_number0 == null) { | ||
(encoder).writeIndex(0); | ||
(encoder).writeNull(); | ||
} else { | ||
if (favorite_number0 instanceof Integer) { | ||
(encoder).writeIndex(1); | ||
(encoder).writeInt(((Integer) favorite_number0)); | ||
} | ||
} | ||
CharSequence favorite_color0 = ((CharSequence) data.get(2)); | ||
if (favorite_color0 == null) { | ||
(encoder).writeIndex(0); | ||
(encoder).writeNull(); | ||
} else { | ||
if (favorite_color0 instanceof CharSequence) { | ||
(encoder).writeIndex(1); | ||
if (favorite_color0 instanceof Utf8) { | ||
(encoder).writeString(((Utf8) favorite_color0)); | ||
} else { | ||
(encoder).writeString(favorite_color0 .toString()); | ||
} | ||
} | ||
} | ||
} | ||
|
||
} |
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
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
Oops, something went wrong.