@@ -217,3 +217,52 @@ def test_local_output_node():
217217 node .inputs [0 ].name = "source"
218218 result = node .execute (context )
219219 assert result .num_rows == 4
220+
221+
222+ def test_local_output_node_online_write_default_batch ():
223+ """Test that online_write_batch is called once when batch_size is None (default)."""
224+ # Create a feature view with online=True
225+ feature_view = MagicMock ()
226+ feature_view .online = True
227+ feature_view .offline = False
228+ feature_view .entity_columns = []
229+
230+ # Create context with default materialization config (batch_size=None)
231+ context = create_context (
232+ node_outputs = {"source" : ArrowTableValue (pa .Table .from_pandas (sample_df ))}
233+ )
234+
235+ node = LocalOutputNode ("output" , feature_view )
236+ node .add_input (MagicMock ())
237+ node .inputs [0 ].name = "source"
238+
239+ node .execute (context )
240+
241+ # Verify online_write_batch was called exactly once (all rows in single batch)
242+ assert context .online_store .online_write_batch .call_count == 1
243+
244+
245+ def test_local_output_node_online_write_batched ():
246+ """Test that online_write_batch is called multiple times when batch_size is configured."""
247+ # Create a feature view with online=True
248+ feature_view = MagicMock ()
249+ feature_view .online = True
250+ feature_view .offline = False
251+ feature_view .entity_columns = []
252+
253+ # Create context with batch_size=2 (sample_df has 4 rows, so expect 2 batches)
254+ context = create_context (
255+ node_outputs = {"source" : ArrowTableValue (pa .Table .from_pandas (sample_df ))}
256+ )
257+ context .repo_config .materialization_config = MaterializationConfig (
258+ online_write_batch_size = 2
259+ )
260+
261+ node = LocalOutputNode ("output" , feature_view )
262+ node .add_input (MagicMock ())
263+ node .inputs [0 ].name = "source"
264+
265+ node .execute (context )
266+
267+ # Verify online_write_batch was called twice (4 rows / batch_size 2 = 2 batches)
268+ assert context .online_store .online_write_batch .call_count == 2
0 commit comments