Skip to content

update ... by: loses HAS_NULLS on the per-group gather — aggregates read null sentinels as values #411

Description

@singaraiona

Summary

ray_update's by: branch gathers each group's rows into a per-group sub-table with ray_vec_new + raw memcpy, but never propagates RAY_ATTR_HAS_NULLS from the source column. The per-group aggregate then sees raw sentinel payloads as values.

Repro

(set NN (table [k v] (list [1 2 1 2] (as 'I64 [10 0N 30 40]))))
(at (update {mn: (min v) by: k from: NN}) 'mn)  ;; [10 0Nl 10 0Nl]  — wrong, should be 10, 40
(at (update {sm: (sum v) by: k from: NN}) 'sm)  ;; [40 -9223372036854775768 ...] — sentinel summed in
(select {mn: (min v) from: NN by: k})            ;; 10, 40 — correct oracle

Notes

  • Pre-existing on the atom-aggregate path (reachable on base via new columns); it became reachable on existing columns once fix(query): support update over parted tables and prevent column duplication by: #406 removed the duplicate-column bug, which is how it surfaced during that PR's review.
  • Likely one-line fix adjacent to the gather in ray_update's by: branch: sub_col->attrs |= full_col->attrs & RAY_ATTR_HAS_NULLS; — plus a regression test mirroring the repro (min/sum over a nullable column under update by:, checked against the select by: oracle).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions