Skip to content

fix(examples): repair broken examples; restore v1 window-join semantics#261

Open
singaraiona wants to merge 1 commit into
masterfrom
fix/examples-and-v1-window-join
Open

fix(examples): repair broken examples; restore v1 window-join semantics#261
singaraiona wants to merge 1 commit into
masterfrom
fix/examples-and-v1-window-join

Conversation

@singaraiona

Copy link
Copy Markdown
Collaborator

Summary

Investigated all of examples/rfl/ and fixed every breakage found by running each example, plus restored window-join to its v1 behavior (the engine state before the merge: import v2 engine rollup).

Engine

  • timeit no longer swallows errors (src/ops/builtins.c). It evaluated the expression, dropped the result on the error branch, and always returned a timing — so a failing expression printed a happy ... time: X ms. This was masking the broken wj.rfl. It now propagates the error and still times valid expressions.
  • window-join restored to v1 semantics (src/ops/query.c, src/lang/eval.c):
    • intervals now takes the v1 two-parallel-vector form (list lo_vec hi_vec) (one entry per left row, the map-left / literal shape the examples use), not per-row [lo hi] pairs.
    • window-join (wj) and window-join1 (wj1) were registered to the same function. They are split again: wj seeds each window with the prevailing quote (rightmost quote with time <= lo); wj1 is the strict [lo,hi] window. Verified distinct from asof-join.

Examples

  • flips.rfl: C8 (a removed type) → STR in the CSV schema (was error: type).
  • window.rfl: rewritten to run a real window-join and show the wj [3 4 4] vs wj1 [3 3 3] difference.
  • datalog.rfl: (get p 1)(get p 'name) (dicts are key-addressed, not positional).
  • journal.rfl: rewritten to the real .log.* journaling API instead of .ipc.open+write/read.

Tests

~40 window-join assertions converted to the v1 interval format with expected values recomputed by hand for the prevailing-quote semantics, across joins.rfl, dump.rfl, query_coverage.rfl, query_branch_cov.rfl, and the opt/exec coverage files. Collection-test map-right usages (which test the builtin itself) were left untouched.

Test plan

  • make test: 3460 of 3462 passed (2 skipped, 0 failed).
  • All examples/rfl/*.rfl run clean (flips.rfl reports only error: io since it needs the user-provided /tmp/flips.csv, as documented in its header).
  • Verified timeit now surfaces an error (rc=1) instead of a timing, and still times valid expressions.

Running every examples/rfl/*.rfl surfaced several breakages:

1. timeit swallowed errors: ray_timeit_fn discarded an error result and
   always returned a timing, so a failing expression looked like it
   succeeded (this hid the broken wj.rfl). It now propagates the error.

2. window-join diverged from v1 (the engine before the v2 rollup):
   - intervals now take the v1 two-parallel-vector form (list lo_vec
     hi_vec), one entry per left row, instead of per-row [lo hi] pairs.
   - window-join (wj) and window-join1 (wj1) were the same function; they
     are split again. wj seeds each window with the prevailing quote
     (rightmost quote with time <= lo); wj1 is the strict [lo,hi] window.

3. Example fixes:
   - flips.rfl: C8 (removed type) -> STR in the CSV schema.
   - window.rfl: run a real window-join showing wj vs wj1.
   - datalog.rfl: (get p 1) -> (get p 'name) (dicts are key-, not
     index-addressed).
   - journal.rfl: use the .log.* journaling API, not .ipc.open/write/read.

Window-join test assertions were converted to the v1 interval format and
expected values recomputed for the prevailing-quote semantics. Full suite
green (3460/3462, 0 failed).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant