Skip to content

feat!: a bounded loader run loads its window in the cursor's type, or fails - #1723

Open
kvlonge wants to merge 3 commits into
mainfrom
fix/loader-cursor-bounds
Open

kvlonge wants to merge 3 commits into
mainfrom
fix/loader-cursor-bounds

Conversation

@kvlonge

@kvlonge kvlonge commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Why

--start-cursor/--end-cursor on a @loader that SQLLoad runs reached SQLLoad as a timestamp whatever the cursor type. For a DATE cursor SQLLoad blocked the table, and SQLBuild read that as success: OK rows=0, exit 0. On ClickHouse a TIMESTAMP source column also blocked its table on the second load, since ClickHouse reports it as DateTime.

Changes

  • A loader's window reaches SQLLoad in the type its source declares for the cursor column (dates, timestamps, integers or numbers, including DECIMAL), and SQLLoad checks it against that column.
  • A bound that doesn't fit a date, timestamp or integer cursor, or any bound on a text cursor, fails the run before anything loads, naming the loader and its cursor type.
  • A table SQLLoad plans but doesn't load fails with SQLLoad's reason, naming the table. This applies to load: projects too.
  • ClickHouse: declared types are pinned under ClickHouse's own name (TIMESTAMP as DateTime, TIMESTAMP(3) as DateTime64(3)), and a cursor kept as a native type reaches the loader typed instead of as text.
  • Docs: "Loading a chosen window" on the loaders page, and the sqb load flags.
  • No DuckShop case: window flags and ClickHouse type names are outside DuckShop's DuckDB runs.

BREAKING CHANGE: a load whose table SQLLoad blocked now fails with the reason instead of reporting zero rows, and window bounds that don't fit a loader's cursor type fail before loading. Give --start-cursor/--end-cursor in the cursor's type.

Verification

  • New e2e tests run the real sqb against the pinned SQLLoad: DATE, timestamp, integer and DECIMAL windows, four refusals (also for an intermediate loader), a blocked table failing by name, and a DATE window into PostgreSQL. On main the DATE windows, refusals and blocked case fail.
  • New ClickHouse e2e: full, incremental and bounded loads of a TIMESTAMP cursor; fails on main.
  • Rust type-name tests, loader tests, fensu, make check-ci.

… fails

--start-cursor/--end-cursor on a loader SQLLoad runs reached it as a
timestamp whatever the loader's cursor type. For a DATE cursor SQLLoad
blocked the table, and SQLBuild read the run as a success with no rows,
so `OK rows=0` and nothing loaded.

- A loader's window now reaches SQLLoad in the type its source declares
  for the cursor column, which SQLLoad checks against that column: dates
  for a DATE cursor, and timestamps, integers or numbers for those cursors,
  so a DECIMAL cursor's window loads too.
- A bound that doesn't fit a date, timestamp or integer cursor (a time of
  day for a DATE cursor, integers for a timestamp cursor, timestamps for
  an integer cursor), or any bound on a text cursor, fails the run before
  anything loads, naming the loader and its cursor type.
- A table SQLLoad plans but doesn't load, such as one it blocks, fails
  with SQLLoad's reason, naming the table. This applies to `load:`
  projects as well as loaders.

BREAKING CHANGE: a load whose table SQLLoad blocked used to report success
with zero rows and now fails with the reason, and window bounds that don't
fit a loader's declared cursor type now fail the run before it loads. To
upgrade, give --start-cursor/--end-cursor in the cursor's type (dates for a
DATE cursor) and fix what the reported reason names.
@kvlonge
kvlonge enabled auto-merge November 30, 2026 12:57
@kvlonge
kvlonge added this pull request to the merge queue Nov 30, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 30, 2026
A source column declared TIMESTAMP on ClickHouse was handed to SQLLoad
pinned as native("TIMESTAMP"). ClickHouse stores it as DateTime and
reports that back, so SQLLoad saw the column drift on the next load and
blocked the table. Declared types are now pinned under ClickHouse's own
name for them, as toTypeName prints it. ClickHouse's DateTime with a
precision is DateTime64 of that precision, and plain DateTime at
precision 0.

A cursor SQLLoad keeps as a warehouse-native type reached the loader as
text, since SQLLoad has no portable kind to read it in. It is now read
as an untyped cursor is on a first load, so ISO timestamps, dates and
integers arrive as such.
@kvlonge
kvlonge enabled auto-merge November 30, 2026 15:02

This branch has not been deployed

No deployments
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