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>>
  • Field Details

  • Constructor Details

  • Method Details

    • save

      public void save() throws FeatureStoreException, IOException
      Save the feature group metadata on Hopsworks. This method is idempotent, if the feature group already exists the method does nothing.
      Throws:
      FeatureStoreException
      IOException
    • save

      public void save(Map<String,String> writeOptions, JobConfiguration materializationJobConfiguration) throws FeatureStoreException, IOException
      Save 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 job
      materializationJobConfiguration - Resource configuration for the materialization job
      Throws:
      FeatureStoreException
      IOException
    • insertStream

      public BeamProducer insertStream() throws Exception
      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

      public BeamProducer insertStream(Map<String,String> writeOptions) throws Exception
      Throws:
      Exception
    • insertStream

      public Object insertStream(org.apache.beam.sdk.values.PCollection<Object> featureData) throws Exception
      Specified by:
      insertStream in class FeatureGroupBase<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:
      insertStream in class FeatureGroupBase<org.apache.beam.sdk.values.PCollection<Object>>
      Throws:
      Exception
    • selectFeatures

      public com.logicalclocks.hsfs.beam.constructor.Query selectFeatures(List<Feature> features)
      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

      public com.logicalclocks.hsfs.beam.constructor.Query select(List<String> features)
      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

      public com.logicalclocks.hsfs.beam.constructor.Query selectExceptFeatures(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. 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

      public com.logicalclocks.hsfs.beam.constructor.Query selectExcept(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. 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.