Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: treat null inputs to `vectorAdd`, `vectorOr` as false > N.b. this approach was abandoned in favor of a more comprehensive > change which also addresses some deviation to the flux lang spec > regarding null handling in logical expressions. > The comprehensive fix comes in the revs that follow. Formerly, when the input to vectorized logical ops was a null, we'd see: ``` runtime error: cannot use vectorized or operation on non-vector invalid ``` The precedent set by the row-based logical ops is to treat incoming nulls as false. This diff extracts the input validation to a separate function which is responsible for transitioning the incoming `values.Value` to a `values.Vector` giving it the chance to intercept the problem null case and convert them to a new vec repeat holding a boolean false. * feat: add logicalStrictNullEvaluator A new version of the logical evaluator which matches the spec. The first thing it does, is check for a feature flag and will delegate to the original version when not enabled. This is not ideal. It would be better to branch higher up in the compiler, but we don't have easy access to the context to read the flagger at that level. BREAKING CHANGE: nulls propagate with the `strictNullLogicalOps` flag on * fix: null handling for vectorOr vectorAnd WRT elements * refactor: fixup row-based to add short circuiting back As I realized these logical ops are commutative I initially thought it meant short circuiting wouldn't be possible (since we'd need to know the null positions on both sides) but this was not true. We can skip evaluating the right side of the op when we see the terminal cases of a `true` for OR, and `false` for AND. Nulls still need to be considered carefully case by case when we resort to looking at the right-hand side, but we can still short circuit. * refactor: vectorized And/Or with short-circuiting and strict null handling * refactor: add flagged impl for strict null handling in interp logicals * test: add testcases for the spec's contract for logicals and nulls * test: add Go-side tests for vectorized logical exprs Tried to exercise the short-circuit and null handling paths to check for memory accounting defects. * refactor: extract vec logical short-circuit attempts into helper func * chore: mention how untyped nulls are introduced in tests * test: add tests for vec repeats in logicals WRT nulls * chore: make generate
- Loading branch information