@@ -88,7 +88,7 @@ public ExternalFeatureGroup(FeatureStore featureStore, @NonNull String name, Int
8888 ExternalDataFormat dataFormat , String path , Map <String , String > options ,
8989 @ NonNull StorageConnector storageConnector , String description ,
9090 List <String > primaryKeys , List <Feature > features , StatisticsConfig statisticsConfig ,
91- String eventTime ) {
91+ String eventTime , boolean onlineEnabled , String onlineTopicName ) {
9292 this ();
9393 this .timeTravelFormat = null ;
9494 this .featureStore = featureStore ;
@@ -108,6 +108,8 @@ public ExternalFeatureGroup(FeatureStore featureStore, @NonNull String name, Int
108108 this .features = features ;
109109 this .statisticsConfig = statisticsConfig != null ? statisticsConfig : new StatisticsConfig ();
110110 this .eventTime = eventTime ;
111+ this .onlineEnabled = onlineEnabled ;
112+ this .onlineTopicName = onlineTopicName ;
111113 }
112114
113115 public ExternalFeatureGroup () {
@@ -135,17 +137,17 @@ public Dataset<Row> read() throws FeatureStoreException, IOException {
135137
136138 @ Override
137139 public Dataset <Row > read (boolean online ) throws FeatureStoreException , IOException {
138- return null ;
140+ return selectAll (). read ( online ) ;
139141 }
140142
141143 @ Override
142144 public Dataset <Row > read (Map <String , String > readOptions ) throws FeatureStoreException , IOException {
143- return null ;
145+ return selectAll (). read ( false , readOptions ) ;
144146 }
145147
146148 @ Override
147149 public Dataset <Row > read (boolean online , Map <String , String > readOptions ) throws FeatureStoreException , IOException {
148- return null ;
150+ return selectAll (). read ( online , readOptions ) ;
149151 }
150152
151153 @ Override
@@ -176,18 +178,7 @@ public void show(int numRows) throws FeatureStoreException, IOException {
176178
177179 @ Override
178180 public void show (int numRows , boolean online ) throws FeatureStoreException , IOException {
179-
180- }
181-
182- @ Override
183- public void insert (Dataset <Row > featureData ) throws IOException , FeatureStoreException , ParseException {
184-
185- }
186-
187- @ Override
188- public void insert (Dataset <Row > featureData , Map <String , String > writeOptions )
189- throws FeatureStoreException , IOException , ParseException {
190-
181+ read (true ).show (numRows );
191182 }
192183
193184 @ Override
@@ -238,6 +229,77 @@ public void insert(Dataset<Row> featureData, boolean overwrite, Map<String, Stri
238229
239230 }
240231
232+ /**
233+ * Incrementally insert data to the online storage of an external feature group. The feature group has to be online
234+ * enabled to perform this operation.
235+ * The `features` dataframe can be a Spark DataFrame or RDD.
236+ * If statistics are enabled, statistics are recomputed for the entire feature group.
237+ * If the feature group doesn't exist, the insert method will create the necessary metadata the first time it is
238+ * invoked and write the specified `features` dataframe as feature group to the online feature store.
239+ *
240+ * <pre>
241+ * {@code
242+ * // get feature store handle
243+ * FeatureStore fs = HopsworksConnection.builder().build().getFeatureStore();
244+ * // get feature group handle
245+ * ExternalFeatureGroup fg = fs.getExternalFeatureGroup("electricity_prices", 1);
246+ * // insert data
247+ * fg.insert(featureData, writeOptions);
248+ * }
249+ * </pre>
250+ *
251+ * @param featureData Spark DataFrame, RDD. Features to be saved.
252+ * @throws IOException Generic IO exception.
253+ * @throws FeatureStoreException If client is not connected to Hopsworks; cannot run read query on storage and/or
254+ * can't reconcile schema.
255+ */
256+ @ Override
257+ public void insert (Dataset <Row > featureData )
258+ throws FeatureStoreException , IOException {
259+
260+ featureGroupEngine .insert (this , featureData , null );
261+
262+ codeEngine .saveCode (this );
263+ computeStatistics ();
264+ }
265+
266+ /**
267+ * Incrementally insert data to the online storage of an external feature group. The feature group has to be online
268+ * enabled to perform this operation.
269+ * The `features` dataframe can be a Spark DataFrame or RDD.
270+ * If statistics are enabled, statistics are recomputed for the entire feature group.
271+ * If the feature group doesn't exist, the insert method will create the necessary metadata the first time it is
272+ * invoked and write the specified `features` dataframe as feature group to the online feature store.
273+ *
274+ * <pre>
275+ * {@code
276+ * // get feature store handle
277+ * FeatureStore fs = HopsworksConnection.builder().build().getFeatureStore();
278+ * // get feature group handle
279+ * ExternalFeatureGroup fg = fs.getExternalFeatureGroup("electricity_prices", 1);
280+ * // Define additional write options (for example for Spark)
281+ * Map<String, String> writeOptions = = new HashMap<String, String>();
282+ * // insert data
283+ * fg.insert(featureData, writeOptions);
284+ * }
285+ * </pre>
286+ *
287+ * @param featureData Spark DataFrame, RDD. Features to be saved.
288+ * @param writeOptions Additional write options as key-value pairs.
289+ * @throws IOException Generic IO exception.
290+ * @throws FeatureStoreException If client is not connected to Hopsworks; cannot run read query on storage and/or
291+ * can't reconcile schema.
292+ */
293+ @ Override
294+ public void insert (Dataset <Row > featureData , Map <String , String > writeOptions )
295+ throws FeatureStoreException , IOException , ParseException {
296+
297+ featureGroupEngine .insert (this , featureData , writeOptions );
298+
299+ codeEngine .saveCode (this );
300+ computeStatistics ();
301+ }
302+
241303 @ Override
242304 public void commitDeleteRecord (Dataset <Row > featureData ) throws FeatureStoreException , IOException , ParseException {
243305
0 commit comments