-
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.
add newBinaryDecoder which re-configures a BinaryDecoder in AvroCompa…
…tibilityHelper (#52) Venice has a local optimization requires re-initialize a BinaryDecoder, but the method signature is different in avro 1.4 and versions after 1.4. In order to be compatible with all avro versions, we need to add this method in AvroCompatibilityHelper. Co-authored-by: xnma <[email protected]>
- Loading branch information
1 parent
0d79aa6
commit 10bef2f
Showing
14 changed files
with
200 additions
and
0 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
25 changes: 25 additions & 0 deletions
25
.../impls/helper-impl-14/src/main/java/org/apache/avro/io/Avro14BinaryDecoderAccessUtil.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,25 @@ | ||
/* | ||
* Copyright 2020 LinkedIn Corp. | ||
* Licensed under the BSD 2-Clause License (the "License"). | ||
* See License in the project root for license information. | ||
*/ | ||
|
||
package org.apache.avro.io; | ||
|
||
/** | ||
* this class exists to allow us access to package-private classes and methods on class {@link BinaryDecoder} | ||
* | ||
* the difference between this method and {@link DecoderFactory#createBinaryDecoder(byte[], int, int, BinaryDecoder)} | ||
* is that this method supports configuring custom BinaryDecoder since it does not check class type of BinaryDecoder. | ||
*/ | ||
public class Avro14BinaryDecoderAccessUtil { | ||
public static BinaryDecoder newBinaryDecoder(byte[] bytes, int offset, | ||
int length, BinaryDecoder reuse) { | ||
if (null != reuse) { | ||
reuse.init(bytes, offset, length); | ||
return reuse; | ||
} else { | ||
return new BinaryDecoder(bytes, offset, length); | ||
} | ||
} | ||
} |
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
24 changes: 24 additions & 0 deletions
24
.../impls/helper-impl-15/src/main/java/org/apache/avro/io/Avro15BinaryDecoderAccessUtil.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,24 @@ | ||
/* | ||
* Copyright 2020 LinkedIn Corp. | ||
* Licensed under the BSD 2-Clause License (the "License"). | ||
* See License in the project root for license information. | ||
*/ | ||
|
||
package org.apache.avro.io; | ||
|
||
/** | ||
* this class exists to allow us access to package-private classes and methods on class {@link BinaryDecoder} | ||
* | ||
* the difference between this method and {@link DecoderFactory#binaryDecoder(byte[], int, int, BinaryDecoder)} | ||
* is that this method supports configuring custom BinaryDecoder since it does not check class type of BinaryDecoder. | ||
*/ | ||
public class Avro15BinaryDecoderAccessUtil { | ||
public static BinaryDecoder newBinaryDecoder(byte[] bytes, int offset, | ||
int length, BinaryDecoder reuse) { | ||
if (null == reuse) { | ||
return new BinaryDecoder(bytes, offset, length); | ||
} else { | ||
return reuse.configure(bytes, offset, length); | ||
} | ||
} | ||
} |
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
24 changes: 24 additions & 0 deletions
24
.../impls/helper-impl-16/src/main/java/org/apache/avro/io/Avro16BinaryDecoderAccessUtil.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,24 @@ | ||
/* | ||
* Copyright 2020 LinkedIn Corp. | ||
* Licensed under the BSD 2-Clause License (the "License"). | ||
* See License in the project root for license information. | ||
*/ | ||
|
||
package org.apache.avro.io; | ||
|
||
/** | ||
* this class exists to allow us access to package-private classes and methods on class {@link BinaryDecoder} | ||
* | ||
* the difference between this method and {@link DecoderFactory#binaryDecoder(byte[], int, int, BinaryDecoder)} | ||
* is that this method supports configuring custom BinaryDecoder since it does not check class type of BinaryDecoder. | ||
*/ | ||
public class Avro16BinaryDecoderAccessUtil { | ||
public static BinaryDecoder newBinaryDecoder(byte[] bytes, int offset, | ||
int length, BinaryDecoder reuse) { | ||
if (null == reuse) { | ||
return new BinaryDecoder(bytes, offset, length); | ||
} else { | ||
return reuse.configure(bytes, offset, length); | ||
} | ||
} | ||
} |
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
24 changes: 24 additions & 0 deletions
24
.../impls/helper-impl-17/src/main/java/org/apache/avro/io/Avro17BinaryDecoderAccessUtil.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,24 @@ | ||
/* | ||
* Copyright 2020 LinkedIn Corp. | ||
* Licensed under the BSD 2-Clause License (the "License"). | ||
* See License in the project root for license information. | ||
*/ | ||
|
||
package org.apache.avro.io; | ||
|
||
/** | ||
* this class exists to allow us access to package-private classes and methods on class {@link BinaryDecoder} | ||
* | ||
* the difference between this method and {@link DecoderFactory#binaryDecoder(byte[], int, int, BinaryDecoder)} | ||
* is that this method supports configuring custom BinaryDecoder since it does not check class type of BinaryDecoder. | ||
*/ | ||
public class Avro17BinaryDecoderAccessUtil { | ||
public static BinaryDecoder newBinaryDecoder(byte[] bytes, int offset, | ||
int length, BinaryDecoder reuse) { | ||
if (null == reuse) { | ||
return new BinaryDecoder(bytes, offset, length); | ||
} else { | ||
return reuse.configure(bytes, offset, length); | ||
} | ||
} | ||
} |
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
24 changes: 24 additions & 0 deletions
24
.../impls/helper-impl-18/src/main/java/org/apache/avro/io/Avro18BinaryDecoderAccessUtil.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,24 @@ | ||
/* | ||
* Copyright 2020 LinkedIn Corp. | ||
* Licensed under the BSD 2-Clause License (the "License"). | ||
* See License in the project root for license information. | ||
*/ | ||
|
||
package org.apache.avro.io; | ||
|
||
/** | ||
* this class exists to allow us access to package-private classes and methods on class {@link BinaryDecoder} | ||
* | ||
* the difference between this method and {@link DecoderFactory#binaryDecoder(byte[], int, int, BinaryDecoder)} | ||
* is that this method supports configuring custom BinaryDecoder since it does not check class type of BinaryDecoder. | ||
*/ | ||
public class Avro18BinaryDecoderAccessUtil { | ||
public static BinaryDecoder newBinaryDecoder(byte[] bytes, int offset, | ||
int length, BinaryDecoder reuse) { | ||
if (null == reuse) { | ||
return new BinaryDecoder(bytes, offset, length); | ||
} else { | ||
return reuse.configure(bytes, offset, length); | ||
} | ||
} | ||
} |
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
24 changes: 24 additions & 0 deletions
24
.../impls/helper-impl-19/src/main/java/org/apache/avro/io/Avro19BinaryDecoderAccessUtil.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,24 @@ | ||
/* | ||
* Copyright 2020 LinkedIn Corp. | ||
* Licensed under the BSD 2-Clause License (the "License"). | ||
* See License in the project root for license information. | ||
*/ | ||
|
||
package org.apache.avro.io; | ||
|
||
/** | ||
* this class exists to allow us access to package-private classes and methods on class {@link BinaryDecoder} | ||
* | ||
* the difference between this method and {@link DecoderFactory#binaryDecoder(byte[], int, int, BinaryDecoder)} | ||
* is that this method supports configuring custom BinaryDecoder since it does not check class type of BinaryDecoder. | ||
*/ | ||
public class Avro19BinaryDecoderAccessUtil { | ||
public static BinaryDecoder newBinaryDecoder(byte[] bytes, int offset, | ||
int length, BinaryDecoder reuse) { | ||
if (null == reuse) { | ||
return new BinaryDecoder(bytes, offset, length); | ||
} else { | ||
return reuse.configure(bytes, offset, length); | ||
} | ||
} | ||
} |