Skip to content

ENG-30396: new types and functions (dates, JSON, FLOAT math) and the GEO oracle (milestone 19) - #19

Closed
jwiebema1 wants to merge 6 commits into
ENG-30396-sqlancer-m18from
ENG-30396-sqlancer-m19
Closed

jwiebema1 wants to merge 6 commits into
ENG-30396-sqlancer-m18from
ENG-30396-sqlancer-m19

Conversation

@jwiebema1

@jwiebema1 jwiebema1 commented Nov 9, 2026 •

Copy link
Copy Markdown

Milestone 19 of ENG-30396 (tracked in ENG-30581, epic ENG-30580 "SQL Housekeeping"): new types and functions (dates, JSON, FLOAT math, geography). Stacked on #18 (milestone 18), which is stacked on #17 to #1; review those first.

The nightly job runs the GEO oracle once VoltDB/internal#6364 is merged; VoltDB/pro#7108 adds it to run-jenkins-sqlancer-test.sh's default. The new functions need no change there: every oracle that uses the expression generator writes them.

Why

The generated expressions used ABS, FLOOR, CEILING, MOD, CHAR_LENGTH, string functions, CASE and COALESCE only:

  • No date or time arithmetic, no JSON functions, no FLOAT math.
  • No GEOGRAPHY_POINT or GEOGRAPHY column.

These are separate code paths in VoltDB's planner and its C++ execution engine (boost date arithmetic, a JSON parser, S2 geometry).

What it changes

  • Functions in expressions (gen/VoltDBExpressionGenerator):

    • FLOAT math: SQRT, EXP, LN, LOG10, POWER(x, n), SIN, COS. They appear only where FLOAT operands may (ENG-30513).
    • Date parts: YEAR to WEEKDAY, as integers. HOUR and MINUTE take a TIMESTAMP, since VoltDB refuses them on a DATE.
    • SINCE_EPOCH(unit, TIMESTAMP).
    • Temporal expressions: DATEADD(unit, n, t) and TRUNCATE(unit, t) keep t's type; TO_TIMESTAMP(unit, n) returns a TIMESTAMP.
    • JSON: FIELD, ARRAY_ELEMENT, SET_FIELD and ARRAY_LENGTH over a few JSON documents, or now and then a string expression ("Invalid JSON" expected).
    • Units are a new keyword node (ast/VoltDBKeyword), which PARAMS never makes a parameter.
    • PQS's evaluator doesn't model the new functions and skips queries that hold one.
    • New expected errors: "Invalid JSON", DATEADD's "interval is too large", and TIMESTAMP's 1583 to 9999 range for DATEADD and TO_TIMESTAMP.
  • GEO (oracle/VoltDBGeographyOracle). Once per database it builds its own table of points and small counter-clockwise boxes, replicated or partitioned, and checks against geography computed in Java:

    • LATITUDE and LONGITUDE, within 1e-9 degrees, also after POINTFROMTEXT(ASTEXT(p)).
    • DISTANCE for every pair against the great-circle distance on VoltDB's 6,371,008.8 m sphere, within a relative 1e-9, and a DISTANCE filter.
    • CONTAINS for every point and box. The points are kept away from the box borders, so great-circle edges don't matter. It runs before and after CREATE INDEX on the GEOGRAPHY column.

    The table is dropped afterwards, and the schema reader ignores it, so no other oracle sees its columns.

  • Workarounds for the bugs below, and the README: a section on all of this, the status line, the option and nightly tables, the bug table.

Bugs found

Ticket Issue Workaround while --avoid-known-bugs is true
ENG-30611 DATEADD(YEAR, n, d) on a DATE February 29 into a non-leap year. With a DATE literal, one ad hoc SELECT aborts the server: an uncaught boost::gregorian::bad_day_of_month in NValue::castAsTimestamp. With a column, it is "Invalid date 'February 29' as '2025' is not a leap year". A TIMESTAMP, and MONTH 12, give February 28. Critical. DATEADD has no YEAR unit.
ENG-30510 (comment) The RIGHT JOIN bug reached through a FULL JOIN. A WHERE clause that rejects the right table's NULLs turns a FULL JOIN b ON c >= b.k into a RIGHT JOIN, then a LEFT JOIN that uses the ON condition as b's index range, and b's row is dropped. Found by TLP WHERE. Wrong result. A FULL JOIN's ON condition reads the left table only.

Testing

  • mvn verify (checkstyle, PMD, formatter) and the unit tests pass.

  • Local trials against 16.1.0-SNAPSHOT at internal 17c453541b, built privately, all sixteen oracles, --use-reducer, before milestone 18's last two fixes were merged in:

    • 1 node, 20 minutes: 43,180 checks, PASS (seed 1907, which had found ENG-30510's FULL JOIN form and then ENG-30611), and 43,792 checks, PASS (seed 1909).
    • 3 nodes, k=1, a random node killed every 120 seconds, 20 minutes: 9 kills, 9 rejoins, 14,718 checks, PASS (seed 1908).
    • GEO and NoREC alone, 1 node, 5 minutes: 129 GEO tables, every check run through the indexed CONTAINS, PASS.
  • Lab:
    Lab build ENG-30396: the XCONFLICT oracle, XDCR conflicts on purpose, and ENG-30679 (milestone 38) #37 of matrix-systemtest-apprunner-sqlancer (branch job ENG-30396-sqlancer-nightly, a replay with this milestone's Jenkinsfile and run-jenkins-sqlancer-test.sh) passed. It ran fork commit 2c92d4a, the head of milestone 19, with all sixteen oracles, 45 minutes per run:

    Run Queries Node failures Result
    3 nodes, k=1, a random node killed every 300 s 49,927 8 kills, 8 rejoins PASS
    1 node 102,019 none PASS
    3 nodes, k=2, 2 sites per host 61,316 none PASS

    No failed databases, no FATAL lines in server logs, no transient results skipped (ENG-30602).

    The runs made about a third fewer queries than milestone 18's (88,512, 151,254 and 90,578). GEO is the cause: it creates, indexes and drops a table on every database, four catalog updates that block the whole cluster. Locally, in 150 seconds on 1 node with 4 threads, the milestone made 7,724 queries without GEO and 4,481 with it (milestone 18: 7,836). Milestone 20 runs GEO on one database in four.

@jwiebema1

Copy link
Copy Markdown
Author

Superseded by #51, which combines every ENG-30396 PR of this repo into one. This PR's branch is kept, and its description still has this milestone's details and lab results.

@jwiebema1 jwiebema1 closed this Nov 18, 2026
@jwiebema1
jwiebema1 deleted the ENG-30396-sqlancer-m19 branch November 25, 2026 13:44
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