Package com.logicalclocks.hsfs.beam
Class StreamFeatureGroup
java.lang.Object
com.logicalclocks.hsfs.FeatureGroupBase<org.apache.beam.sdk.values.PCollection<Object>>
com.logicalclocks.hsfs.beam.StreamFeatureGroup
public class StreamFeatureGroup
extends FeatureGroupBase<org.apache.beam.sdk.values.PCollection<Object>>
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsFields inherited from class com.logicalclocks.hsfs.FeatureGroupBase
created, creator, dataSource, deltaStreamerJobConf, deprecated, description, eventTime, expectationsNames, featureGroupEngineBase, features, featureStore, featurestoreId, hudiPrecombineKey, id, location, LOGGER, name, notificationTopicName, onlineConfig, onlineEnabled, onlineIngestionApi, onlineTopicName, partitionKeys, primaryKeys, statisticColumns, statisticsConfig, subject, timeTravelFormat, topicName, type, utils, version -
Constructor Summary
ConstructorsConstructorDescriptionStreamFeatureGroup(FeatureStore featureStore, int id) StreamFeatureGroup(FeatureStore featureStore, @NonNull String name, Integer version, String description, List<String> primaryKeys, List<String> partitionKeys, String hudiPrecombineKey, boolean onlineEnabled, TimeTravelFormat timeTravelFormat, List<Feature> features, StatisticsConfig statisticsConfig, String onlineTopicName, String eventTime, OnlineConfig onlineConfig, StorageConnector storageConnector, String path) StreamFeatureGroup(Integer id, String description, List<Feature> features) -
Method Summary
Modifier and TypeMethodDescriptionIngest a feature data to the online feature store using Beam Pipeline object.insertStream(Map<String, String> writeOptions) insertStream(org.apache.beam.sdk.values.PCollection<Object> featureData) insertStream(org.apache.beam.sdk.values.PCollection<Object> featureData, Map<String, String> writeOptions) voidsave()Save the feature group metadata on Hopsworks.voidsave(Map<String, String> writeOptions, JobConfiguration materializationJobConfiguration) Save the feature group metadata on Hopsworks.com.logicalclocks.hsfs.beam.constructor.QuerySelect a subset of features of the feature group and return a query object.com.logicalclocks.hsfs.beam.constructor.QuerySelect all features of the feature group and return a query object.com.logicalclocks.hsfs.beam.constructor.QueryselectExcept(List<String> features) Select all features including primary key and event time feature of the feature group except provided `features` and return a query object.com.logicalclocks.hsfs.beam.constructor.QueryselectExceptFeatures(List<Feature> features) Select all features including primary key and event time feature of the feature group except provided `features` and return a query object.com.logicalclocks.hsfs.beam.constructor.QueryselectFeatures(List<Feature> features) Select a subset of features of the feature group and return a query object.Methods inherited from class com.logicalclocks.hsfs.FeatureGroupBase
addTag, checkDeprecated, delete, deleteTag, getAvroSchema, getComplexFeatures, getDeserializedAvroSchema, getDeserializedEncodedAvroSchema, getEncodedAvroSchema, getFeature, getFeatureAvroSchema, getLatestOnlineIngestion, getOnlineIngestion, getPrimaryKeys, getSubject, getTag, getTags, setDataSource, setDeprecated, unloadSubject, updateDeprecated, updateDeprecated, updateDescription, updateFeatureDescription, updateNotificationTopicName, updateStatisticsConfig
-
Field Details
-
featureGroupEngine
-
-
Constructor Details
-
StreamFeatureGroup
public StreamFeatureGroup(FeatureStore featureStore, @NonNull @NonNull String name, Integer version, String description, List<String> primaryKeys, List<String> partitionKeys, String hudiPrecombineKey, boolean onlineEnabled, TimeTravelFormat timeTravelFormat, List<Feature> features, StatisticsConfig statisticsConfig, String onlineTopicName, String eventTime, OnlineConfig onlineConfig, StorageConnector storageConnector, String path) -
StreamFeatureGroup
public StreamFeatureGroup() -
StreamFeatureGroup
-
StreamFeatureGroup
-
-
Method Details
-
save
Save the feature group metadata on Hopsworks. This method is idempotent, if the feature group already exists the method does nothing.- Throws:
FeatureStoreExceptionIOException
-
save
public void save(Map<String, String> writeOptions, JobConfiguration materializationJobConfiguration) throws FeatureStoreException, IOExceptionSave the feature group metadata on Hopsworks. This method is idempotent, if the feature group already exists, the method does nothing- Parameters:
writeOptions- Options to provide to the materialization jobmaterializationJobConfiguration- Resource configuration for the materialization job- Throws:
FeatureStoreExceptionIOException
-
insertStream
Ingest a feature data to the online feature store using Beam Pipeline object. Currently, only org.apache.beam.sdk.values.Row types as feature data type are supported.// get feature store handle FeatureStore fs = HopsworksConnection.builder().build().getFeatureStore(); // get feature group handle StreamFeatureGroup fg = fs.getStreamFeatureGroup("taxi_ride", 1); // create Beam pipeline Pipeline pipeline = Pipeline.create(); pipeline .apply("read stream from the source", PubsubIO.readStrings().fromTopic(options.getInputTopic())) .apply("Parse JSON to Beam Rows", JsonToRow.withSchema(schema)) .apply("insert streaming feature data", fg.insertStream());- Returns:
- BeamProducer object, that can be wrapped inside Beam Pipeline `apply` method.
- Throws:
Exception
-
insertStream
- Throws:
Exception
-
insertStream
public Object insertStream(org.apache.beam.sdk.values.PCollection<Object> featureData) throws Exception - Specified by:
insertStreamin classFeatureGroupBase<org.apache.beam.sdk.values.PCollection<Object>>- Throws:
Exception
-
insertStream
public Object insertStream(org.apache.beam.sdk.values.PCollection<Object> featureData, Map<String, String> writeOptions) throws Exception- Specified by:
insertStreamin classFeatureGroupBase<org.apache.beam.sdk.values.PCollection<Object>>- Throws:
Exception
-
selectFeatures
Select a subset of features of the feature group and return a query object. The query can be used to construct joins of feature groups or create a feature view with a subset of features of the feature group.- Parameters:
features- List of Feature meta data objects.- Returns:
- Query object.
-
select
Select a subset of features of the feature group and return a query object. The query can be used to construct joins of feature groups or create a feature view with a subset of features of the feature group.- Parameters:
features- List of Feature names.- Returns:
- Query object.
-
selectAll
public com.logicalclocks.hsfs.beam.constructor.Query selectAll()Select all features of the feature group and return a query object. The query can be used to construct joins of feature groups or create a feature view with a subset of features of the feature group.- Returns:
- Query object.
-
selectExceptFeatures
Select all features including primary key and event time feature of the feature group except provided `features` and return a query object. The query can be used to construct joins of feature groups or create a feature view with a subset of features of the feature group.- Parameters:
features- List of Feature meta data objects.- Returns:
- Query object.
-
selectExcept
Select all features including primary key and event time feature of the feature group except provided `features` and return a query object. The query can be used to construct joins of feature groups or create a feature view with a subset of features of the feature group.- Parameters:
features- List of Feature names.- Returns:
- Query object.
-