diff --git a/hopsworks-common/src/main/java/io/hops/hopsworks/common/featurestore/featuregroup/FeaturegroupController.java b/hopsworks-common/src/main/java/io/hops/hopsworks/common/featurestore/featuregroup/FeaturegroupController.java index e79923e680..46cf1adcaa 100644 --- a/hopsworks-common/src/main/java/io/hops/hopsworks/common/featurestore/featuregroup/FeaturegroupController.java +++ b/hopsworks-common/src/main/java/io/hops/hopsworks/common/featurestore/featuregroup/FeaturegroupController.java @@ -104,6 +104,8 @@ public class FeaturegroupController { @EJB private FeaturegroupFacade featuregroupFacade; @EJB + private OnlineFeaturestoreController onlineFeaturestoreController; + @EJB private CachedFeaturegroupController cachedFeaturegroupController; @EJB private StreamFeatureGroupController streamFeatureGroupController; @@ -938,6 +940,10 @@ public FeaturegroupPreview getFeaturegroupPreview(Featuregroup featuregroup, Pro Users user, boolean online, int limit) throws SQLException, FeaturestoreException, HopsSecurityException { if (online && featuregroup.isOnlineEnabled()) { + Featurestore userFeatureStore = featurestoreController.getProjectFeaturestore(project); + // Accessing online feature store from a shared project requires online feature store + // being setup in users' project. + onlineFeaturestoreController.setupOnlineFeatureStore(project, userFeatureStore); return onlineFeaturegroupController.getFeaturegroupPreview(featuregroup, project, user, limit); } else if (online) { throw new FeaturestoreException(RESTCodes.FeaturestoreErrorCode.FEATUREGROUP_NOT_ONLINE, Level.FINE);