-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fast Serializer support for Avro-1.4 (#17)
* Fast Serializer support for Avro-1.4 This code change adds support for fast serializer of Avro-1.4. Now, fast serializer/de-serializer are available for Avro 1.4/1.7/1.8. This special logic for Avro-1.4 in Fast Serializer generation is for enum/fixed since those two types in Avro-1.4 are implementing differently from other versions, and the corresponding Schema couldn't be extracted from the generic implementations (GenericData.EnumSymbol and GenericData.Fixed). * Added comment in `SchemaAssistant#isNamedType` method
- Loading branch information
Showing
8 changed files
with
138 additions
and
69 deletions.
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
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
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
22 changes: 22 additions & 0 deletions
22
avro-fastserde/src/main/java/com/linkedin/avro/fastserde/SchemaAssistantForSerializer.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,22 @@ | ||
package com.linkedin.avro.fastserde; | ||
|
||
import com.sun.codemodel.JClass; | ||
import com.sun.codemodel.JCodeModel; | ||
|
||
|
||
public class SchemaAssistantForSerializer extends SchemaAssistant { | ||
public SchemaAssistantForSerializer(JCodeModel codeModel, boolean useGenericTypes) { | ||
super(codeModel, useGenericTypes); | ||
} | ||
|
||
/** | ||
* Special handling for "String" type since the underlying data could be "String" or "Utf8". | ||
* | ||
* This is different from the de-serializer since Avro will always decode it into "Utf8". | ||
* @return | ||
*/ | ||
@Override | ||
protected JClass defaultStringType() { | ||
return getCodeModel().ref(CharSequence.class); | ||
} | ||
} |
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.