Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
89eed55
v2.4.0 (#327)
singaraiona Jul 11, 2026
eb66eed
feat(query): support live inserts into parted tables
singaraiona Jul 14, 2026
bbdc419
fix(core): restore total-core -c semantics
singaraiona Jul 15, 2026
9961388
fix(parse) Fix nonstring if not defined
protocolstardust Jul 16, 2026
6cac6e8
Merge pull request #330 from protocolstardust/dev
protocolstardust Jul 16, 2026
f44ab81
Merge branch 'master' into dev
singaraiona Jul 16, 2026
49d8524
fix(store): surface FlushFileBuffers failure in journal SYNC mode (#335)
belowzeroff Jul 18, 2026
cb1c6cd
fix(hnsw): reject build dims whose vector count overflows size_t (#333)
belowzeroff Jul 18, 2026
7475949
fix(store): read full link sidecar to avoid wrong-symbol truncation (…
belowzeroff Jul 18, 2026
ebadd07
fix(hnsw): reject index files whose vector count overflows size_t (#332)
belowzeroff Jul 21, 2026
fa39d9d
fix(docs): remediate F-0001 F-0005 F-0007
singaraiona Jul 22, 2026
ffd784f
fix(docs): remediate CF-0001
singaraiona Jul 22, 2026
1f27e61
fix(docs): remediate CF-0002
singaraiona Jul 22, 2026
465e58e
chore(audit): plan CF-0003 ratification
singaraiona Jul 22, 2026
8f8033c
fix(docs): remediate CF-0003
singaraiona Jul 22, 2026
3ae79f5
feat(docs): redesign website and documentation
singaraiona Jul 22, 2026
5dc8265
Merge branch 'master' into dev
singaraiona Jul 22, 2026
4d2c8f3
fix(null): avoid f64 null casts to integers (#340)
belowzeroff Jul 23, 2026
4e49626
fix(expr): avoid null truthiness casts in fallback binary ops (#339)
belowzeroff Jul 23, 2026
a05886d
ci: make Rayforce audit PR comments best-effort
singaraiona Jul 23, 2026
6ca3d8a
ci: publish Rayforce audit comments from trusted workflow
singaraiona Jul 23, 2026
04d8f3d
ci: resolve fork PRs for audit commenter
singaraiona Jul 23, 2026
6acdc2c
perf: parallelize serial stages around group-by; unify binary-agg nul…
ser-vasilich Jul 23, 2026
a53d98e
Merge branch 'master' into dev
singaraiona Jul 23, 2026
260e018
fix(aggr): preserve slice nullability in binary groups
singaraiona Jul 23, 2026
492c5db
fix(expr): avoid f64 null cast in fallback idiv integer output (#344)
belowzeroff Jul 23, 2026
d250108
fix(group): avoid f64 null read cast in dense aggs (#343)
belowzeroff Jul 23, 2026
95f0a3d
fix(ipc): preserve boxed data list args (#346)
belowzeroff Jul 24, 2026
e10d1ab
fix(group): avoid f64 null cast in DA reads (#348)
belowzeroff Jul 24, 2026
842acc0
ci: use portable march for fuzz jobs (#347)
belowzeroff Jul 24, 2026
84cea17
chore(release): merge master into dev
singaraiona Jul 24, 2026
7a5839e
fix(pivot): preserve generic missing cells as null (#350)
belowzeroff Jul 27, 2026
57628fb
fix(xbar): avoid narrow bucket truncation (#351)
belowzeroff Jul 28, 2026
d7a1f6f
Merge branch 'master' into dev
singaraiona Jul 28, 2026
c501ae0
fix(arith): reject float temporal operands (#353)
belowzeroff Jul 29, 2026
aea9bda
fix(ops): make nested (LIST) columns usable through a parted view (fi…
singaraiona Jul 30, 2026
0605f1a
fix(query): preserve temporal arithmetic semantics (#354)
belowzeroff Jul 30, 2026
282d3a1
Merge branch 'master' into dev
singaraiona Jul 30, 2026
17bf2b8
ci: skip audit comments for cancelled runs
singaraiona Jul 30, 2026
05c8078
fix(query): preserve if temporal branch types (#359)
belowzeroff Jul 31, 2026
488a296
fix(store): reject duplicate splayed column names (#360)
belowzeroff Aug 3, 2026
5684559
fix(builtins): reject malformed strings in TIMESTAMP cast (#361)
belowzeroff Aug 3, 2026
c9b9a66
fix(store): support nested column inserts and persistence (#365)
singaraiona Aug 3, 2026
4c0fa46
fix(eval): enforce restricted mode in compiled lambdas (#366)
singaraiona Aug 3, 2026
8c9300b
feat(core): add bounded poll step for embedders (#367)
singaraiona Aug 3, 2026
3c79632
Merge branch 'master' into dev
singaraiona Aug 3, 2026
9b05f60
fix(test): rely on public runtime declarations (#369)
belowzeroff Aug 4, 2026
add3498
feat: website add consumer
singaraiona Aug 4, 2026
9d255c2
Merge branch 'master' into dev
singaraiona Aug 4, 2026
a1dcfd9
feat(core): expose restricted poll mode (#372)
singaraiona Aug 4, 2026
d5d5240
fix(aggr): preserve grouped nested first and last
singaraiona Aug 4, 2026
c35fa2b
Merge branch 'master' into dev
singaraiona Aug 4, 2026
2cfc70e
fix(join): preserve nested columns (#376)
singaraiona Aug 4, 2026
ac9d0cc
Merge branch 'master' into dev
singaraiona Aug 4, 2026
2fa0fbd
fix(csv): round-trip signed and >=24h TIME values in .csv.read (#379)
belowzeroff Aug 4, 2026
959db02
fix(str): propagate null start/length in substr instead of overflowin…
belowzeroff Aug 4, 2026
2083f24
fix(builtins): clamp out-of-range float in scalar numeric casts (#380)
belowzeroff Aug 5, 2026
5419053
Merge branch 'master' into dev
singaraiona Aug 5, 2026
c731b42
fix(builtins): validate bounds in DATE string cast (#382)
belowzeroff Aug 6, 2026
93db5ce
perf(aggr): specialize reduction scans (#383)
singaraiona Aug 6, 2026
e71798a
perf(collection): parallel radix distinct for fixed-width columns (#384)
protocolstardust Aug 6, 2026
8d6466f
fix(csv): harden import cancellation and schema handling (#387)
singaraiona Aug 7, 2026
8a1cf0c
fix(temporal): guard int64 overflow in DATE/TIMESTAMP decomposition (…
belowzeroff Aug 9, 2026
7bf522a
fix(eval): materialize lazy values at compiled boundaries (#391)
singaraiona Aug 11, 2026
caa529d
fix(arith): wrap scalar integer add/sub/mul on overflow instead of UB…
belowzeroff Aug 11, 2026
a2607ac
fix(builtins): reject malformed strings in TIME cast (#389)
belowzeroff Aug 11, 2026
a14ba5c
Merge branch 'master' into dev
singaraiona Aug 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ jobs:
# work-stealing ring real contention to race against. Linux + clang only.
tsan:
runs-on: ubuntu-latest
env:
# Keep Clang off transient hosted-runner ISA features that become
# -Werror diagnostics before the TSan suites can run.
RAY_MARCH: x86-64
steps:
- uses: actions/checkout@v4
- name: TSan concurrency suites
Expand Down
4 changes: 4 additions & 0 deletions src/app/repl.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ static void render_progress_full(int64_t done, int64_t total,
if (total > 0) {
pct = (double)done / (double)total;
if (pct > 1.0) pct = 1.0;
/* A dispatch can finish before its enclosing query's cleanup and
* finalization phases. Reserve 100% for the final snapshot (which
* clears the line) so the live bar never claims completion early. */
if (pct >= 1.0) pct = 0.99;
int sub = (int)(pct * sub_total);
full = sub / 8;
frac = sub % 8;
Expand Down
375 changes: 307 additions & 68 deletions src/io/csv.c

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions src/lang/compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,10 @@ static void compile_list(compiler_t *c, ray_t *ast) {
ray_t *name_obj = elems[1];
if (name_obj->type != -RAY_SYM) { c->error = true; return; }
compile_expr(c, elems[2]);
/* Match ray_set_fn: globals must never retain a single-use lazy
* DAG handle. Materializing one alias consumes its graph and
* would leave every other global read pointing at a spent handle. */
emit(c, OP_FORCE);
int32_t idx = add_constant(c, name_obj);
if (idx < 256) {
emit(c, OP_STOREGLOBAL);
Expand Down Expand Up @@ -332,6 +336,9 @@ static void compile_list(compiler_t *c, ray_t *ast) {
/* (if cond then else?) */
if (sym_id == sf_if && n >= 3) {
compile_expr(c, elems[1]);
/* Match ray_cond_fn: truthiness belongs to the materialized value,
* not to the non-NULL lazy handle that happens to contain it. */
emit(c, OP_FORCE);
int32_t jmpf_pos = emit_jump(c, OP_JMPF);
compile_expr(c, elems[2]);
if (n >= 4) {
Expand Down
15 changes: 12 additions & 3 deletions src/ops/arith.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,12 @@ ray_t* ray_add_fn(ray_t* a, ray_t* b) {
if (both_f32_atoms(a, b)) return ray_f32((float)(as_f64(a) + as_f64(b)));
if (is_float_op(a, b)) return make_f64(as_f64(a) + as_f64(b));
int8_t rt = promote_int_type(a, b);
return make_typed_int(rt, as_i64(a) + as_i64(b));
/* Wrap on overflow (defined) rather than signed-overflow UB, matching the
* vector arithmetic kernel (src/ops/expr.c OP_ADD/SUB/MUL). The wrapped
* i64 (INT64_MIN on MAX+1) is the null sentinel, so results are unchanged
* — only the undefined arithmetic is removed. */
int64_t la = as_i64(a), lb = as_i64(b);
return make_typed_int(rt, (int64_t)((uint64_t)la + (uint64_t)lb));
}

ray_t* ray_sub_fn(ray_t* a, ray_t* b) {
Expand Down Expand Up @@ -220,7 +225,9 @@ ray_t* ray_sub_fn(ray_t* a, ray_t* b) {
return make_f64(r);
}
int8_t rt = promote_int_type_right(a, b);
return make_typed_int(rt, as_i64(a) - as_i64(b));
/* uint64 wrap on overflow (defined), like ray_add_fn / the vector kernel. */
int64_t la = as_i64(a), lb = as_i64(b);
return make_typed_int(rt, (int64_t)((uint64_t)la - (uint64_t)lb));
}

ray_t* ray_mul_fn(ray_t* a, ray_t* b) {
Expand Down Expand Up @@ -254,7 +261,9 @@ ray_t* ray_mul_fn(ray_t* a, ray_t* b) {
if (both_f32_atoms(a, b)) return ray_f32((float)(as_f64(a) * as_f64(b)));
if (is_float_op(a, b)) return make_f64(as_f64(a) * as_f64(b));
int8_t rt = promote_int_type(a, b);
return make_typed_int(rt, as_i64(a) * as_i64(b));
/* uint64 wrap on overflow (defined), like ray_add_fn / the vector kernel. */
int64_t la = as_i64(a), lb = as_i64(b);
return make_typed_int(rt, (int64_t)((uint64_t)la * (uint64_t)lb));
}

ray_t* ray_div_fn(ray_t* a, ray_t* b) {
Expand Down
106 changes: 90 additions & 16 deletions src/ops/builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,13 @@ static int8_t resolve_type_name(int64_t sym_id) {
else if (len == 3 && memcmp(name, "F64", 3) == 0) result = RAY_F64;
else if (len == 2 && memcmp(name, "B8", 2) == 0) result = RAY_BOOL;
else if (len == 2 && memcmp(name, "U8", 2) == 0) result = RAY_U8;
else if (len == 3 && memcmp(name, "SYM", 3) == 0) result = RAY_SYM;
else if (len == 6 && memcmp(name, "SYMBOL", 6) == 0) result = RAY_SYM;
else if (len == 3 && memcmp(name, "STR", 3) == 0) result = RAY_STR;
/* CSV cells are scalar text, so the historical LIST schema spelling is
* materialized as the native packed STR column rather than a boxed list.
* This keeps schemas copied from older table displays loadable. */
else if (len == 4 && memcmp(name, "LIST", 4) == 0) result = RAY_STR;
else if (len == 3 && memcmp(name, "F32", 3) == 0) result = RAY_F32;
else if (len == 4 && memcmp(name, "DATE", 4) == 0) result = RAY_DATE;
else if (len == 4 && memcmp(name, "TIME", 4) == 0) result = RAY_TIME;
Expand Down Expand Up @@ -1553,18 +1558,48 @@ ray_t* ray_cast_fn(ray_t* type_sym, ray_t* val) {
if (val->type == -RAY_TIME) return ray_date((int64_t)val->i32);
if (val->type == -RAY_TIMESTAMP) return ray_date(ts_days_floor(val->i64));
if (val->type == -RAY_STR) {
/* Parse "YYYY.MM.DD" format */
/* Parse "YYYY.MM.DD" with a bounded cursor that must consume the
* whole string. The old sscanf path accepted trailing garbage
* ("2024.01.02junk") and, worse, never range-checked the month:
* a month > 13 drove the days-in-month table index out of bounds
* — e.g. (as 'DATE "9999.99.99") read md[99] (ASan OOB). Validate
* the month BEFORE indexing the table, and the day against the
* actual days in that (possibly leap) month. Mirrors the strict
* TIMESTAMP string cast. */
const char* sp = ray_str_ptr(val);
int y, m, d2;
if (sscanf(sp, "%d.%d.%d", &y, &m, &d2) != 3) return ray_error("domain", "as: cannot parse str as date, expected YYYY.MM.DD");
size_t sl = ray_str_len(val);
size_t i = 0;
int y = 0, m = 0, d2 = 0;
#define DT_DIGITS(w, out) do { \
(out) = 0; \
for (int _k = 0; _k < (w); _k++) { \
if (i >= sl || sp[i] < '0' || sp[i] > '9') \
return ray_error("domain", "as: cannot parse str as date, expected YYYY.MM.DD"); \
(out) = (out) * 10 + (sp[i] - '0'); i++; \
} \
} while (0)
DT_DIGITS(4, y);
if (i >= sl || sp[i] != '.') return ray_error("domain", "as: cannot parse str as date, expected YYYY.MM.DD");
i++;
DT_DIGITS(2, m);
if (i >= sl || sp[i] != '.') return ray_error("domain", "as: cannot parse str as date, expected YYYY.MM.DD");
i++;
DT_DIGITS(2, d2);
if (i != sl) return ray_error("domain", "as: cannot parse str as date, unexpected trailing characters");
#undef DT_DIGITS
static const int dt_md[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
int leap = (y % 4 == 0 && (y % 100 != 0 || y % 400 == 0));
if (m < 1 || m > 12)
return ray_error("domain", "as: cannot parse str as date, month out of range");
int mdays = dt_md[m] + (m == 2 && leap ? 1 : 0);
if (d2 < 1 || d2 > mdays)
return ray_error("domain", "as: cannot parse str as date, day out of range for month");
int64_t days = 0;
{ int ty;
for (ty = 2000; ty < y; ty++) days += (ty % 4 == 0 && (ty % 100 != 0 || ty % 400 == 0)) ? 366 : 365;
for (ty = y; ty < 2000; ty++) days -= (ty % 4 == 0 && (ty % 100 != 0 || ty % 400 == 0)) ? 366 : 365;
}
{ static const int md2[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
int leap = (y % 4 == 0 && (y % 100 != 0 || y % 400 == 0));
for (int mi = 1; mi < m; mi++) days += md2[mi] + (mi == 2 && leap ? 1 : 0);
{ for (int mi = 1; mi < m; mi++) days += dt_md[mi] + (mi == 2 && leap ? 1 : 0);
days += d2 - 1;
}
return ray_date(days);
Expand Down Expand Up @@ -1592,21 +1627,60 @@ ray_t* ray_cast_fn(ray_t* type_sym, ray_t* val) {
* matching wall-clock semantics. */
return ray_time((int64_t)(ts_ns_in_day(val->i64) / 1000000LL));
if (val->type == -RAY_STR) {
/* Parse "HH:MM:SS[.mmm]" */
/* Parse "[-]HH:MM[:SS][.fff]" with a bounded cursor that must
* consume the whole string. TIME is a signed duration — ms-of-day
* can exceed a day and go negative (see .csv.read round-tripping) —
* so the hour field is variable width and unbounded, but minutes
* and seconds are 0-59. The old sscanf path accepted trailing
* garbage ("12:34:56junk") and out-of-range fields ("25:99:99" →
* 26:40:39), silently corrupting the value; mirror the strict DATE
* / TIMESTAMP string casts. */
const char* sp = ray_str_ptr(val);
int th = 0, tm = 0, ts = 0, tms = 0;
int nr = sscanf(sp, "%d:%d:%d", &th, &tm, &ts);
if (nr < 2) return ray_error("domain", "as: cannot parse str as time, expected HH:MM:SS[.mmm]");
const char* dot = strchr(sp, '.');
if (dot) {
dot++;
size_t sl = ray_str_len(val);
size_t i = 0;
int64_t sign = 1;
if (i < sl && sp[i] == '-') { sign = -1; i++; }
/* Variable-width hour, >= 1 digit, capped so ms cannot overflow. */
if (i >= sl || sp[i] < '0' || sp[i] > '9')
return ray_error("domain", "as: cannot parse str as time, expected [-]HH:MM[:SS][.fff]");
int64_t hh = 0;
int hd = 0;
while (i < sl && sp[i] >= '0' && sp[i] <= '9') {
hh = hh * 10 + (sp[i] - '0'); i++;
if (++hd > 7) return ray_error("domain", "as: cannot parse str as time, hour field too long");
}
/* Read exactly 2 digits into `out`, validate 0..59. */
#define TM_2DIGIT(out) do { \
if (i + 1 >= sl || sp[i] < '0' || sp[i] > '9' || sp[i+1] < '0' || sp[i+1] > '9') \
return ray_error("domain", "as: cannot parse str as time, expected 2-digit field"); \
(out) = (sp[i]-'0')*10 + (sp[i+1]-'0'); i += 2; \
if ((out) > 59) return ray_error("domain", "as: cannot parse str as time, minute/second out of range"); \
} while (0)
if (i >= sl || sp[i] != ':')
return ray_error("domain", "as: cannot parse str as time, expected ':' after hour");
i++;
int mm = 0, ss = 0, tms = 0;
TM_2DIGIT(mm);
if (i < sl && sp[i] == ':') { i++; TM_2DIGIT(ss); }
#undef TM_2DIGIT
/* Optional fractional seconds → milliseconds; a bare trailing '.'
* is accepted as .000. */
if (i < sl && sp[i] == '.') {
i++;
char mbuf[4] = "000";
int mi = 0;
while (*dot >= '0' && *dot <= '9' && mi < 3) mbuf[mi++] = *dot++;
while (i < sl && sp[i] >= '0' && sp[i] <= '9') {
if (mi < 3) mbuf[mi++] = sp[i];
i++;
}
tms = (int)strtol(mbuf, NULL, 10);
}
int32_t ms = (int32_t)th * 3600000 + (int32_t)tm * 60000 + (int32_t)ts * 1000 + tms;
return ray_time((int64_t)ms);
if (i != sl)
return ray_error("domain", "as: cannot parse str as time, unexpected trailing characters");
int64_t ms = sign * (hh * 3600000LL + (int64_t)mm * 60000LL + (int64_t)ss * 1000LL + tms);
if (ms > INT32_MAX || ms < INT32_MIN)
return ray_error("domain", "as: cannot parse str as time, out of int32 millisecond range");
return ray_time(ms);
}
/* Vector cast */
if (ray_is_vec(val) || val->type == RAY_LIST)
Expand Down
31 changes: 24 additions & 7 deletions src/ops/collection.c
Original file line number Diff line number Diff line change
Expand Up @@ -1048,16 +1048,33 @@ ray_t* distinct_vec_eager(ray_t* x) {
}
}

hashset_t hs;
if (!hashset_init(&hs, x, len)) {
/* Parallel radix kernel for large fixed-width columns — same
* partition scheme as exec_count_distinct, producing the same row-id
* set the hashset pass below would (one first-occurrence id per
* value). NULL means the kernel declined (type, size, or pool) and
* the hashset handles it. Either way the ids flow into the shared
* sort + gather tail, so result semantics are identical. */
int64_t count = 0;
ray_t* rids = distinct_radix_first_ids(x);
if (rids && RAY_IS_ERR(rids)) {
if (idx != idx_stack) ray_sys_free(idx);
return ray_error("oom", NULL);
return rids;
}
int64_t count = 0;
for (int64_t i = 0; i < len; i++) {
if (hashset_insert(&hs, i)) idx[count++] = i;
if (rids) {
count = ray_len(rids);
memcpy(idx, ray_data(rids), (size_t)count * sizeof(int64_t));
ray_release(rids);
} else {
hashset_t hs;
if (!hashset_init(&hs, x, len)) {
if (idx != idx_stack) ray_sys_free(idx);
return ray_error("oom", NULL);
}
for (int64_t i = 0; i < len; i++) {
if (hashset_insert(&hs, i)) idx[count++] = i;
}
hashset_destroy(&hs);
}
hashset_destroy(&hs);

/* Sort unique indices by value for numeric/temporal types — preserves
* pre-existing distinct semantics. qsort-based; was O(count^2). */
Expand Down
11 changes: 11 additions & 0 deletions src/ops/graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -1766,6 +1766,8 @@ ray_t* ray_lazy_wrap(ray_graph_t* g, ray_op_t* op) {
ray_t* ray_lazy_append(ray_t* lazy, uint16_t opcode) {
ray_graph_t* g = RAY_LAZY_GRAPH(lazy);
ray_op_t* prev = RAY_LAZY_OP(lazy);
if (!g || !prev)
return ray_error("domain", "lazy handle already materialized");

/* Determine output type based on opcode */
int8_t out_type;
Expand Down Expand Up @@ -1833,6 +1835,8 @@ ray_t* ray_lazy_append(ray_t* lazy, uint16_t opcode) {
ray_t* ray_lazy_append_param(ray_t* lazy, uint16_t opcode, int64_t param) {
ray_graph_t* g = RAY_LAZY_GRAPH(lazy);
ray_op_t* prev = RAY_LAZY_OP(lazy);
if (!g || !prev)
return ray_error("domain", "lazy handle already materialized");

int8_t out_type;
switch (opcode) {
Expand Down Expand Up @@ -1865,6 +1869,12 @@ ray_t* ray_lazy_materialize(ray_t* val) {

ray_graph_t* g = RAY_LAZY_GRAPH(val);
ray_op_t* op = RAY_LAZY_OP(val);
if (!g || !op) {
RAY_LAZY_GRAPH(val) = NULL;
RAY_LAZY_OP(val) = NULL;
ray_release(val);
return ray_error("domain", "lazy handle already materialized");
}

/* Run the full optimizer pipeline before execution. ray_optimize
may return a different root (e.g. predicate pushdown). */
Expand All @@ -1876,6 +1886,7 @@ ray_t* ray_lazy_materialize(ray_t* val) {
/* Clear graph pointer before releasing to prevent double-free in
* ray_release_owned_refs */
RAY_LAZY_GRAPH(val) = NULL;
RAY_LAZY_OP(val) = NULL;
ray_release(val);
return result;
}
Loading
Loading