-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for StdFloat, StdDouble, and StdBinary (#46)
* Introduce StdFloat, StdDouble, and StdBinary interfaces * Add implementations of those interfaces in Avro, Hive, Presto, Spark, and Generic type systems * Add examples of transport UDFs on those new types, and add tests for those UDFs * Update documentation
- Loading branch information
Showing
84 changed files
with
1,656 additions
and
30 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
15 changes: 15 additions & 0 deletions
15
transportable-udfs-api/src/main/java/com/linkedin/transport/api/data/StdBinary.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,15 @@ | ||
/** | ||
* Copyright 2018 LinkedIn Corporation. All rights reserved. | ||
* Licensed under the BSD-2 Clause license. | ||
* See LICENSE in the project root for license information. | ||
*/ | ||
package com.linkedin.transport.api.data; | ||
|
||
import java.nio.ByteBuffer; | ||
|
||
/** A Standard UDF data type for representing binary objects. */ | ||
public interface StdBinary extends StdData { | ||
|
||
/** Returns the underlying {@link ByteBuffer} value. */ | ||
ByteBuffer get(); | ||
} |
13 changes: 13 additions & 0 deletions
13
transportable-udfs-api/src/main/java/com/linkedin/transport/api/data/StdDouble.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,13 @@ | ||
/** | ||
* Copyright 2018 LinkedIn Corporation. All rights reserved. | ||
* Licensed under the BSD-2 Clause license. | ||
* See LICENSE in the project root for license information. | ||
*/ | ||
package com.linkedin.transport.api.data; | ||
|
||
/** A Standard UDF data type for representing doubles. */ | ||
public interface StdDouble extends StdData { | ||
|
||
/** Returns the underlying double value. */ | ||
double get(); | ||
} |
13 changes: 13 additions & 0 deletions
13
transportable-udfs-api/src/main/java/com/linkedin/transport/api/data/StdFloat.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,13 @@ | ||
/** | ||
* Copyright 2018 LinkedIn Corporation. All rights reserved. | ||
* Licensed under the BSD-2 Clause license. | ||
* See LICENSE in the project root for license information. | ||
*/ | ||
package com.linkedin.transport.api.data; | ||
|
||
/** A Standard UDF data type for representing floats. */ | ||
public interface StdFloat extends StdData { | ||
|
||
/** Returns the underlying float value. */ | ||
float get(); | ||
} |
10 changes: 10 additions & 0 deletions
10
transportable-udfs-api/src/main/java/com/linkedin/transport/api/types/StdBinaryType.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,10 @@ | ||
/** | ||
* Copyright 2018 LinkedIn Corporation. All rights reserved. | ||
* Licensed under the BSD-2 Clause license. | ||
* See LICENSE in the project root for license information. | ||
*/ | ||
package com.linkedin.transport.api.types; | ||
|
||
/** A {@link StdType} representing a {@link java.nio.ByteBuffer} type. */ | ||
public interface StdBinaryType extends StdType { | ||
} |
10 changes: 10 additions & 0 deletions
10
transportable-udfs-api/src/main/java/com/linkedin/transport/api/types/StdDoubleType.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,10 @@ | ||
/** | ||
* Copyright 2018 LinkedIn Corporation. All rights reserved. | ||
* Licensed under the BSD-2 Clause license. | ||
* See LICENSE in the project root for license information. | ||
*/ | ||
package com.linkedin.transport.api.types; | ||
|
||
/** A {@link StdType} representing a double type. */ | ||
public interface StdDoubleType extends StdType { | ||
} |
10 changes: 10 additions & 0 deletions
10
transportable-udfs-api/src/main/java/com/linkedin/transport/api/types/StdFloatType.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,10 @@ | ||
/** | ||
* Copyright 2018 LinkedIn Corporation. All rights reserved. | ||
* Licensed under the BSD-2 Clause license. | ||
* See LICENSE in the project root for license information. | ||
*/ | ||
package com.linkedin.transport.api.types; | ||
|
||
/** A {@link StdType} representing a float type. */ | ||
public interface StdFloatType extends StdType { | ||
} |
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
34 changes: 34 additions & 0 deletions
34
transportable-udfs-avro/src/main/java/com/linkedin/transport/avro/data/AvroBinary.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,34 @@ | ||
/** | ||
* Copyright 2018 LinkedIn Corporation. All rights reserved. | ||
* Licensed under the BSD-2 Clause license. | ||
* See LICENSE in the project root for license information. | ||
*/ | ||
package com.linkedin.transport.avro.data; | ||
|
||
import com.linkedin.transport.api.data.PlatformData; | ||
import com.linkedin.transport.api.data.StdBinary; | ||
import java.nio.ByteBuffer; | ||
|
||
|
||
public class AvroBinary implements StdBinary, PlatformData { | ||
private ByteBuffer _byteBuffer; | ||
|
||
public AvroBinary(ByteBuffer aByteBuffer) { | ||
_byteBuffer = aByteBuffer; | ||
} | ||
|
||
@Override | ||
public Object getUnderlyingData() { | ||
return _byteBuffer; | ||
} | ||
|
||
@Override | ||
public void setUnderlyingData(Object value) { | ||
_byteBuffer = (ByteBuffer) value; | ||
} | ||
|
||
@Override | ||
public ByteBuffer get() { | ||
return _byteBuffer; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
transportable-udfs-avro/src/main/java/com/linkedin/transport/avro/data/AvroDouble.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,33 @@ | ||
/** | ||
* Copyright 2018 LinkedIn Corporation. All rights reserved. | ||
* Licensed under the BSD-2 Clause license. | ||
* See LICENSE in the project root for license information. | ||
*/ | ||
package com.linkedin.transport.avro.data; | ||
|
||
import com.linkedin.transport.api.data.PlatformData; | ||
import com.linkedin.transport.api.data.StdDouble; | ||
|
||
|
||
public class AvroDouble implements StdDouble, PlatformData { | ||
private Double _double; | ||
|
||
public AvroDouble(Double aDouble) { | ||
_double = aDouble; | ||
} | ||
|
||
@Override | ||
public Object getUnderlyingData() { | ||
return _double; | ||
} | ||
|
||
@Override | ||
public void setUnderlyingData(Object value) { | ||
_double = (Double) value; | ||
} | ||
|
||
@Override | ||
public double get() { | ||
return _double; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
transportable-udfs-avro/src/main/java/com/linkedin/transport/avro/data/AvroFloat.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,33 @@ | ||
/** | ||
* Copyright 2018 LinkedIn Corporation. All rights reserved. | ||
* Licensed under the BSD-2 Clause license. | ||
* See LICENSE in the project root for license information. | ||
*/ | ||
package com.linkedin.transport.avro.data; | ||
|
||
import com.linkedin.transport.api.data.PlatformData; | ||
import com.linkedin.transport.api.data.StdFloat; | ||
|
||
|
||
public class AvroFloat implements StdFloat, PlatformData { | ||
private Float _float; | ||
|
||
public AvroFloat(Float aFloat) { | ||
_float = aFloat; | ||
} | ||
|
||
@Override | ||
public Object getUnderlyingData() { | ||
return _float; | ||
} | ||
|
||
@Override | ||
public void setUnderlyingData(Object value) { | ||
_float = (Float) value; | ||
} | ||
|
||
@Override | ||
public float get() { | ||
return _float; | ||
} | ||
} |
Oops, something went wrong.