-
Notifications
You must be signed in to change notification settings - Fork 998
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from baskaranz/feature/kafkaio
KafkaIO implementation for feast
- Loading branch information
Showing
10 changed files
with
527 additions
and
49 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
33 changes: 33 additions & 0 deletions
33
ingestion/src/main/java/feast/ingestion/deserializer/FeatureRowDeserializer.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 @@ | ||
package feast.ingestion.deserializer; | ||
|
||
import com.google.protobuf.InvalidProtocolBufferException; | ||
import feast.types.FeatureRowProto.FeatureRow; | ||
import org.apache.kafka.common.errors.SerializationException; | ||
import org.apache.kafka.common.serialization.Deserializer; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* Deserializer for Kafka to deserialize Protocol Buffers messages | ||
* | ||
* @param <FeatureRow> Protobuf message type | ||
*/ | ||
public class FeatureRowDeserializer implements Deserializer<FeatureRow> { | ||
|
||
@Override | ||
public void configure(Map configs, boolean isKey) { | ||
} | ||
|
||
@Override | ||
public FeatureRow deserialize(String topic, byte[] data) { | ||
try { | ||
return FeatureRow.parseFrom(data); | ||
} catch (InvalidProtocolBufferException e) { | ||
throw new SerializationException("Error deserializing FeatureRow from Protobuf message", e); | ||
} | ||
} | ||
|
||
@Override | ||
public void close() { | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
ingestion/src/main/java/feast/ingestion/deserializer/FeatureRowKeyDeserializer.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 @@ | ||
package feast.ingestion.deserializer; | ||
|
||
import com.google.protobuf.InvalidProtocolBufferException; | ||
import feast.types.FeatureRowProto.*; | ||
import org.apache.kafka.common.errors.SerializationException; | ||
import org.apache.kafka.common.serialization.Deserializer; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* Deserializer for Kafka to deserialize Protocol Buffers messages | ||
* | ||
* @param <FeatureRowKey> Protobuf message type | ||
*/ | ||
public class FeatureRowKeyDeserializer implements Deserializer<FeatureRowKey> { | ||
|
||
@Override | ||
public void configure(Map configs, boolean isKey) { | ||
} | ||
|
||
@Override | ||
public FeatureRowKey deserialize(String topic, byte[] data) { | ||
try { | ||
return FeatureRowKey.parseFrom(data); | ||
} catch (InvalidProtocolBufferException e) { | ||
throw new SerializationException("Error deserializing FeatureRowKey from Protobuf message", e); | ||
} | ||
} | ||
|
||
@Override | ||
public void close() { | ||
} | ||
} |
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
ingestion/src/main/java/feast/ingestion/transform/FeatureEnums.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 @@ | ||
package feast.ingestion.transform; | ||
|
||
public class FeatureEnums { | ||
public enum InputSource { | ||
FILE, | ||
BIGQUERY, | ||
PUBSUB, | ||
KAFKA | ||
} | ||
|
||
public enum FileFormat { | ||
CSV, | ||
JSON | ||
} | ||
} |
Oops, something went wrong.