Package com.logicalclocks.hsfs.beam
Class FeatureStore
java.lang.Object
com.logicalclocks.hsfs.FeatureStoreBase<com.logicalclocks.hsfs.beam.constructor.Query>
com.logicalclocks.hsfs.beam.FeatureStore
-
Field Summary
Fields inherited from class com.logicalclocks.hsfs.FeatureStoreBase
DEFAULT_VERSION, featureGroupApi, LOGGER, storageConnectorApi, trainingDatasetApi -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreate a new feature view metadata object.Create a feature group builder object.createStreamFeatureGroup(@NonNull String name, Integer version, String description, Boolean onlineEnabled, TimeTravelFormat timeTravelFormat, List<String> primaryKeys, List<String> partitionKeys, String eventTime, String hudiPrecombineKey, List<Feature> features, StatisticsConfig statisticsConfig, DataSource dataSource) Create a stream feature group object.createStreamFeatureGroup(@NonNull String name, Integer version, String description, Boolean onlineEnabled, TimeTravelFormat timeTravelFormat, List<String> primaryKeys, List<String> partitionKeys, String eventTime, String hudiPrecombineKey, List<Feature> features, StatisticsConfig statisticsConfig, StorageConnector storageConnector, String path) Create a feature group object.getFeatureView(@NonNull String name, @NonNull Integer version) Get a feature view object from the selected feature store.getFeatureView(String name) Get a feature view object from the selected feature store.getOrCreateFeatureView(String name, com.logicalclocks.hsfs.beam.constructor.Query query, Integer version) Get feature view metadata object or create a new one if it doesn't exist.getOrCreateStreamFeatureGroup(@NonNull String name, Integer version, String description, Boolean onlineEnabled, TimeTravelFormat timeTravelFormat, List<String> primaryKeys, List<String> partitionKeys, String eventTime, String hudiPrecombineKey, List<Feature> features, StatisticsConfig statisticsConfig, DataSource dataSource, OnlineConfig onlineConfig) Get a stream feature group metadata object or create a new one if it doesn't exist.getOrCreateStreamFeatureGroup(@NonNull String name, Integer version, String description, Boolean onlineEnabled, TimeTravelFormat timeTravelFormat, List<String> primaryKeys, List<String> partitionKeys, String eventTime, String hudiPrecombineKey, List<Feature> features, StatisticsConfig statisticsConfig, StorageConnector storageConnector, String path, OnlineConfig onlineConfig) Get a feature group metadata object or create a new one if it doesn't exists.getSqlConnector(String name) getStreamFeatureGroup(@NonNull String name, @NonNull Integer version) Get a stream feature group object from the feature store.getStreamFeatureGroup(String name) Get a stream feature group object from the feature store.Methods inherited from class com.logicalclocks.hsfs.FeatureStoreBase
getAdlsConnector, getBigqueryConnector, getDataSource, getGcsConnector, getHopsFsConnector, getJdbcConnector, getKafkaConnector, getOnlineStorageConnector, getRedshiftConnector, getS3Connector, getSnowflakeConnector, getStorageConnector, toString
-
Constructor Details
-
FeatureStore
public FeatureStore()
-
-
Method Details
-
createStreamFeatureGroup
Create a feature group builder object.// get feature store handle FeatureStore fs = HopsworksConnection.builder().build().getFeatureStore(); // create feature group metadata object StreamFeatureGroup streamFeatureGroup = fs.createStreamFeatureGroup() .name("documentation_example") .version(1) .primaryKeys(Collections.singletonList("pk")) .eventTime("event_time") .onlineEnabled(true) .features(features) .build(); // save the feature group metadata object on the feature store streamFeatureGroup.save()- Returns:
- StreamFeatureGroup.StreamFeatureGroupBuilder a StreamFeatureGroup builder object.
-
createStreamFeatureGroup
public StreamFeatureGroup createStreamFeatureGroup(@NonNull @NonNull String name, Integer version, String description, Boolean onlineEnabled, TimeTravelFormat timeTravelFormat, List<String> primaryKeys, List<String> partitionKeys, String eventTime, String hudiPrecombineKey, List<Feature> features, StatisticsConfig statisticsConfig, StorageConnector storageConnector, String path) Description copied from class:FeatureStoreBaseCreate a feature group object.- Specified by:
createStreamFeatureGroupin classFeatureStoreBase<com.logicalclocks.hsfs.beam.constructor.Query>- Parameters:
name- the name of the feature groupversion- the version of the feature groupdescription- descrption of the feature grouponlineEnabled- whether the feature group should be online enabledtimeTravelFormat- the data format to use to store the offline dataprimaryKeys- list of primary keyspartitionKeys- list of partition keyseventTime- the feature/column to use as event timehudiPrecombineKey- if the timeTravelFormat is set to hudi, the feature/column to use as precombine keyfeatures- the list of feature objects if defined explicitlystatisticsConfig- the statistics configuration for the feature groupstorageConnector- the storage connector to use to store the offline feature data (Default stored internally in Hopsworks).path- the path on the storage where to store the feature data.- Returns:
- The feature group metadata object.
-
createStreamFeatureGroup
public StreamFeatureGroup createStreamFeatureGroup(@NonNull @NonNull String name, Integer version, String description, Boolean onlineEnabled, TimeTravelFormat timeTravelFormat, List<String> primaryKeys, List<String> partitionKeys, String eventTime, String hudiPrecombineKey, List<Feature> features, StatisticsConfig statisticsConfig, DataSource dataSource) Description copied from class:FeatureStoreBaseCreate a stream feature group object.- Specified by:
createStreamFeatureGroupin classFeatureStoreBase<com.logicalclocks.hsfs.beam.constructor.Query>- Parameters:
name- the name of the feature groupversion- the version of the feature groupdescription- descrption of the feature grouponlineEnabled- whether the feature group should be online enabledtimeTravelFormat- the data format to use to store the offline dataprimaryKeys- list of primary keyspartitionKeys- list of partition keyseventTime- the feature/column to use as event timehudiPrecombineKey- if the timeTravelFormat is set to hudi, the feature/column to use as precombine keyfeatures- the list of feature objects if defined explicitlystatisticsConfig- the statistics configuration for the feature groupdataSource- the data source specifying the location of the data.- Returns:
- The feature group metadata object.
-
getOrCreateStreamFeatureGroup
public StreamFeatureGroup getOrCreateStreamFeatureGroup(@NonNull @NonNull String name, Integer version, String description, Boolean onlineEnabled, TimeTravelFormat timeTravelFormat, List<String> primaryKeys, List<String> partitionKeys, String eventTime, String hudiPrecombineKey, List<Feature> features, StatisticsConfig statisticsConfig, StorageConnector storageConnector, String path, OnlineConfig onlineConfig) throws IOException, FeatureStoreException Description copied from class:FeatureStoreBaseGet a feature group metadata object or create a new one if it doesn't exists.- Specified by:
getOrCreateStreamFeatureGroupin classFeatureStoreBase<com.logicalclocks.hsfs.beam.constructor.Query>- Parameters:
name- the name of the feature groupversion- the version of the feature groupdescription- descrption of the feature grouponlineEnabled- whether the feature group should be online enabledtimeTravelFormat- the data format to use to store the offline dataprimaryKeys- list of primary keyspartitionKeys- list of partition keyseventTime- the feature/column to use as event timehudiPrecombineKey- if the timeTravelFormat is set to hudi, the feature/column to use as precombine keyfeatures- the list of feature objects if defined explicitlystatisticsConfig- the statistics configuration for the feature groupstorageConnector- the storage connector to use to store the offline feature data (Default stored internally in Hopsworks).path- the path on the storage where to store the feature data.- Returns:
- The feature group metadata object.
- Throws:
IOExceptionFeatureStoreException
-
getOrCreateStreamFeatureGroup
public StreamFeatureGroup getOrCreateStreamFeatureGroup(@NonNull @NonNull String name, Integer version, String description, Boolean onlineEnabled, TimeTravelFormat timeTravelFormat, List<String> primaryKeys, List<String> partitionKeys, String eventTime, String hudiPrecombineKey, List<Feature> features, StatisticsConfig statisticsConfig, DataSource dataSource, OnlineConfig onlineConfig) throws IOException, FeatureStoreException Description copied from class:FeatureStoreBaseGet a stream feature group metadata object or create a new one if it doesn't exist.- Specified by:
getOrCreateStreamFeatureGroupin classFeatureStoreBase<com.logicalclocks.hsfs.beam.constructor.Query>- Parameters:
name- the name of the feature groupversion- the version of the feature groupdescription- descrption of the feature grouponlineEnabled- whether the feature group should be online enabledtimeTravelFormat- the data format to use to store the offline dataprimaryKeys- list of primary keyspartitionKeys- list of partition keyseventTime- the feature/column to use as event timehudiPrecombineKey- if the timeTravelFormat is set to hudi, the feature/column to use as precombine keyfeatures- the list of feature objects if defined explicitlystatisticsConfig- the statistics configuration for the feature groupdataSource- the data source specifying the location of the data.onlineConfig- the online configuration for the feature group.- Returns:
- The feature group metadata object.
- Throws:
IOExceptionFeatureStoreException
-
getStreamFeatureGroup
Get a stream feature group object from the feature store.Getting a stream feature group metadata handle enables to interact with the feature group, such as read the data or use the `Query`-API to perform joins between feature groups and create feature views.
// get feature store handle FeatureStore fs = HopsworksConnection.builder().build().getFeatureStore(); FeatureGroup fg = fs.getStreamFeatureGroup("electricity_prices", 1);- Specified by:
getStreamFeatureGroupin classFeatureStoreBase<com.logicalclocks.hsfs.beam.constructor.Query>- Parameters:
name- the name of the feature group- Returns:
- StreamFeatureGroup The stream feature group metadata object.
- Throws:
FeatureStoreException- If unable to retrieve feature group from the feature store.IOException- Generic IO exception.
-
getStreamFeatureGroup
public StreamFeatureGroup getStreamFeatureGroup(@NonNull @NonNull String name, @NonNull @NonNull Integer version) throws FeatureStoreException, IOException Get a stream feature group object from the feature store.Getting a stream feature group metadata handle enables to interact with the feature group, such as read the data or use the `Query`-API to perform joins between feature groups and create feature views.
// get feature store handle FeatureStore fs = HopsworksConnection.builder().build().getFeatureStore(); FeatureGroup fg = fs.getStreamFeatureGroup("electricity_prices", 1);- Specified by:
getStreamFeatureGroupin classFeatureStoreBase<com.logicalclocks.hsfs.beam.constructor.Query>- Parameters:
name- the name of the feature groupversion- the version of the feature group- Returns:
- StreamFeatureGroup The stream feature group metadata object.
- Throws:
FeatureStoreException- If unable to retrieve feature group from the feature store.IOException- Generic IO exception.
-
getFeatureView
public FeatureView getFeatureView(@NonNull @NonNull String name, @NonNull @NonNull Integer version) throws FeatureStoreException, IOException Get a feature view object from the selected feature store.// get feature store handle FeatureStore fs = HopsworksConnection.builder().build().getFeatureStore(); FeatureView fv = fs.getFeatureView("fv_name", 1);- Specified by:
getFeatureViewin classFeatureStoreBase<com.logicalclocks.hsfs.beam.constructor.Query>- Parameters:
name- Name of the feature view.version- Version to get.- Returns:
- FeatureView The feature view metadata object.
- Throws:
FeatureStoreException- If unable to retrieve FeatureView from the feature store.IOException- Generic IO exception.
-
getFeatureView
Get a feature view object from the selected feature store.// get feature store handle FeatureStore fs = HopsworksConnection.builder().build().getFeatureStore(); FeatureView fv = fs.getFeatureView("fv_name", 1);- Specified by:
getFeatureViewin classFeatureStoreBase<com.logicalclocks.hsfs.beam.constructor.Query>- Parameters:
name- Name of the feature view.- Returns:
- FeatureView The feature view metadata object.
- Throws:
FeatureStoreException- If unable to retrieve FeatureView from the feature store.IOException- Generic IO exception.
-
createFeatureView
Create a new feature view metadata object.// get feature store handle FeatureStore fs = HopsworksConnection.builder().build().getFeatureStore(); FeatureView fv = fs.createFeatureView .name("fv_name") .version(1) .query(query) .build() // The build method also save the feature view metadata to Hopsworks- Returns:
- FeatureView.FeatureViewBuilder Feature View Builder object to build the feature view metadata object
-
getOrCreateFeatureView
public FeatureView getOrCreateFeatureView(String name, com.logicalclocks.hsfs.beam.constructor.Query query, Integer version) throws FeatureStoreException, IOException Get feature view metadata object or create a new one if it doesn't exist. This method doesn't update existing feature view metadata.// get feature store handle FeatureStore fs = HopsworksConnection.builder().build().getFeatureStore(); FeatureView fv = fs.getOrCreateFeatureView("fv_name", query, 1);- Parameters:
name- Name of the feature view.query- Query object.version- Version of the feature view.- Returns:
- FeatureView The feature view metadata object.
- Throws:
FeatureStoreException- If unable to retrieve FeatureView from the feature store.IOException- Generic IO exception.
-
getSqlConnector
public StorageConnector.SqlConnector getSqlConnector(String name) throws FeatureStoreException, IOException - Specified by:
getSqlConnectorin classFeatureStoreBase<com.logicalclocks.hsfs.beam.constructor.Query>- Throws:
FeatureStoreExceptionIOException
-