|
6 | 6 | import pytest |
7 | 7 | import ray |
8 | 8 |
|
| 9 | +from feast import Entity, FeatureView, Field, FileSource, RepoConfig |
9 | 10 | from feast.aggregation import Aggregation |
10 | 11 | from feast.infra.compute_engines.dag.context import ColumnInfo |
11 | 12 | from feast.infra.compute_engines.dag.model import DAGFormat |
|
19 | 20 | RayJoinNode, |
20 | 21 | RayReadNode, |
21 | 22 | RayTransformationNode, |
| 23 | + RayWriteNode, |
22 | 24 | ) |
| 25 | +from feast.infra.online_stores.sqlite import SqliteOnlineStoreConfig |
23 | 26 | from feast.infra.ray_initializer import ( |
24 | 27 | RayConfigManager, |
25 | 28 | RayExecutionMode, |
26 | 29 | ensure_ray_initialized, |
27 | 30 | get_ray_wrapper, |
28 | 31 | ) |
| 32 | +from feast.types import Float32 |
29 | 33 |
|
30 | 34 |
|
31 | 35 | class DummyInputNode(DAGNode): |
@@ -439,6 +443,38 @@ def test_ray_dedup_node_materialization_no_join_keys( |
439 | 443 | ) |
440 | 444 |
|
441 | 445 |
|
| 446 | +def test_ray_write_node_raises_when_online_write_fails( |
| 447 | + ray_session, mock_context, sample_data, tmp_path |
| 448 | +): |
| 449 | + """A failed online store write must fail the write node, not be swallowed.""" |
| 450 | + driver = Entity(name="driver", join_keys=["driver_id"]) |
| 451 | + feature_view = FeatureView( |
| 452 | + name="driver_stats", |
| 453 | + entities=[driver], |
| 454 | + schema=[Field(name="conv_rate", dtype=Float32)], |
| 455 | + source=FileSource( |
| 456 | + path=str(tmp_path / "source.parquet"), timestamp_field="event_timestamp" |
| 457 | + ), |
| 458 | + online=True, |
| 459 | + offline=False, |
| 460 | + ) |
| 461 | + # The online table was never created, so every write raises "no such table". |
| 462 | + mock_context.repo_config = RepoConfig( |
| 463 | + project="test_project", |
| 464 | + registry=str(tmp_path / "registry.db"), |
| 465 | + provider="local", |
| 466 | + entity_key_serialization_version=3, |
| 467 | + online_store=SqliteOnlineStoreConfig(path=str(tmp_path / "online.db")), |
| 468 | + ) |
| 469 | + input_value = DAGValue(data=ray.data.from_pandas(sample_data), format=DAGFormat.RAY) |
| 470 | + node = RayWriteNode(name="write", feature_view=feature_view) |
| 471 | + node.add_input(DummyInputNode("input_node", input_value)) |
| 472 | + mock_context.node_outputs = {"input_node": input_value} |
| 473 | + |
| 474 | + with pytest.raises(Exception, match="no such table"): |
| 475 | + node.execute(mock_context) |
| 476 | + |
| 477 | + |
442 | 478 | def test_ray_config_validation(): |
443 | 479 | """Test Ray configuration validation.""" |
444 | 480 | # Test valid configuration |
|
0 commit comments