Skip to content

test(duckshop): edge cases for conversion and analysis findings - #1292

Merged
kvlonge merged 8 commits into
mainfrom
feat/duckshop-review-edges
Nov 2, 2026
Merged

kvlonge merged 8 commits into
mainfrom
feat/duckshop-review-edges

Conversation

@kvlonge

@kvlonge kvlonge commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Why

Reviews of SQL conversion and analysis turned up shapes where a Snowflake-to-DuckDB conversion gave a different answer, or where valid Snowflake SQL was reported as an error. DuckShop's edge-case area is where such shapes live as executable examples, with expected values captured on Snowflake, so this adds them there.

Changes

  • New fixed-row edge__* sources and staging models: basket lines, date and time texts, amount checks, VARIANT attribute values and category links.
  • Edge models and unit tests for:
    • ordering through arrays;
    • dates and zoned times read from text, and time arithmetic;
    • numbers, NULL arithmetic and literal types;
    • VARIANT comparisons;
    • text patterns;
    • lineage-sensitive clauses (CONNECT BY, recursive CTEs, joins on USING);
    • compile-only analysis patterns.
  • Five edge Python functions, covering volatile values, NULL input and values returned as VARIANT.
  • Expectations captured on Snowflake under the pinned edge session.
    • Values Snowflake does not define (ties, volatile calls, MEDIAN above scale 12) are checked by assertions.
    • Shapes Snowflake rejects are left out and listed in the README.
  • README and RUNBOOK updates: the new groups and counts, known limitations, and capture guidance.

Verification

  • sqb compile reports 0 errors and 0 warnings, both with the edge area and on the core copy. The core-copy checksum is unchanged.
  • The edge build and tests pass on Snowflake under the edge target. Two capture runs in a row produced identical files.
  • pytest benchmarks/duckshop/tests passes.
  • ruff format and lint are clean.
  • make check-ci passes.
  • The public-repository hygiene scan passes.

…s and VARIANTs

Fixed rows for basket lines, date and time texts, amount checks, VARIANT attribute values and category links, with their staging models and tests. The ticket-note staging model passes its text on for the pattern cases.
… text and numbers

Unordered ARRAY_AGG ranked under LIMIT and read by order-free functions, SELECT DISTINCT over arrays, TRY_TO_DATE formats, zoned text read back at UTC, TIME arithmetic and formats, JOIN USING across key widths, NULL arithmetic and literal types, MEDIAN scales, DIV0 by zero literals, JSON zero fractions and aggregates inside windows. Expectations await capture on Snowflake.
…xt patterns and lineage

ARRAY_MAX, ARRAY_MIN and ARRAY_REVERSE over mixed arrays, VARIANT equality across types and typed leaves, recursive FLATTEN paths, regular expression and case-folding edges, CONNECT BY beside a level column, recursive CTEs without RECURSIVE, row-deciding clauses, join keys from the right side and SQL that name checks have flagged. Expectations await capture on Snowflake.
Volatile token and number functions checked by assertions that hold for any values, DIV0 of a volatile call beside look-alike names, a handler that answers NULL input, and Python values handed to VARIANT and FLOAT results.
Drop a window frame without ORDER BY, CONVERT_TIMEZONE with a lower-case 'utc' and a scalar subquery inside CONNECT BY, which Snowflake rejects; read SYSTEM$TYPEOF from finished CTEs; check tied modes and scale-15 medians with assertions; output typed VARIANT picks as kind and text; cast date-text clock columns in staging so the source contract has no precision. Expectations captured on Snowflake.
Fill the new edge tests' expected rows from two identical captures under the edge target, and list in the README the shapes Snowflake rejects and the answers worth knowing.
@kvlonge
kvlonge enabled auto-merge (squash) November 2, 2026 01:08
@kvlonge
kvlonge merged commit 3b77897 into main Nov 2, 2026
26 checks passed
@kvlonge
kvlonge deleted the feat/duckshop-review-edges branch November 2, 2026 02:02
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