Skip to content
Merged
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
An enabled primary key that is not a prefix of the tuned sort key now fails
before any table is created, with a message that says to put the key columns
first or disable `primary_keys`.
- **DuckDB `auto` and `tuned-fallback` runs no longer enable CHECK
constraints.** CHECK constraints cannot be confirmed from the catalog, so
these DuckDB configurations no longer request them, matching the shipped
DuckDB templates. No shipped benchmark schema emits a CHECK constraint, so
the tables are unchanged, and other platforms are unchanged. These DuckDB
runs record a different `requested_config_hash`, and their cached database
is rebuilt on the next run (for example `tpch_sf001_custom_pk_fk_uniq_check`
becomes `tpch_sf001_custom_pk_fk_uniq`).
- **Spark, LakeSail and Velox per-query times no longer include `clearCache()`.**
With `disable_cache` on (the default), these adapters cleared the session
cache inside each query's timer. They now clear it before the timer starts,
Expand Down Expand Up @@ -283,6 +291,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
the ledger records it as satisfied by that statement instead of dropped.
Sorts that no executed statement realized are still dropped. This lets
ClickHouse tuned runs reach `applied_verified`.
- **DuckDB constraints are checked against the catalog.** Primary keys,
unique constraints and foreign keys in a tuned DuckDB `CREATE TABLE` are
compared with `duckdb_constraints()`. Keys must match on the same columns in
the same order, and a foreign key must also reference the same table and
columns. A tuned DuckDB run with the shipped TPC-H template now reaches
`applied_verified`. A `CHECK` clause in a `CREATE TABLE`, and constraints on
every other platform, still keep a run at `applied_unverified`. So does a
`CREATE TABLE` holding a backslash directly before a single or double
quote, which some engines read as an escaped quote the scanner cannot
mask, or holding a dollar-quoted string whose tag carries non-ASCII
characters; so do a
DuckDB `CREATE TABLE` whose constraints sit next to list syntax (`[...]`),
and a constrained table whose name also exists in another schema or
attached database. On those
platforms this now also holds when the same `CREATE TABLE` carries a
verified sort, partition or cluster key; before, the constraint was ignored
there. Receipt entries for constraints carry `kind: "constraint"` and a
`constraint_type`. Quoted non-ASCII table names, such as "É", are now found
consistently with DuckDB's `lower(table_name)` catalog filters.

### Changed

Expand Down
9 changes: 4 additions & 5 deletions benchbox/cli/commands/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
)
from benchbox.cli.tuning_runtime import (
build_baseline_unified_config,
build_default_unified_config,
infer_runtime_tuning_mode,
resolve_dataframe_tuning_config,
)
Expand Down Expand Up @@ -764,8 +765,6 @@ def _resolve_tuning(s: types.SimpleNamespace, *, non_interactive_override: bool

def _load_unified_tuning_config(s: types.SimpleNamespace, *, non_interactive_override: bool | None = None) -> None:
s.loaded_unified_config = None
from benchbox.core.tuning.interface import UnifiedTuningConfiguration

tuning_resolution = s.tuning_resolution
if tuning_resolution.config_file:
if getattr(s, "resolved_mode", None) == "sql" and is_dataframe_tuning_file(tuning_resolution.config_file):
Expand Down Expand Up @@ -814,13 +813,13 @@ def _load_unified_tuning_config(s: types.SimpleNamespace, *, non_interactive_ove
tuning_resolution.source = TuningSource.BASELINE
console.print("[green]✅ Tuning configuration completed[/green]")
else:
s.loaded_unified_config = UnifiedTuningConfiguration()
s.loaded_unified_config = build_default_unified_config(s.platform)
else:
s.loaded_unified_config = UnifiedTuningConfiguration()
s.loaded_unified_config = build_default_unified_config(s.platform)
if s.logger:
s.logger.debug("Using basic constraints-only configuration (fallback)")
else:
s.loaded_unified_config = UnifiedTuningConfiguration()
s.loaded_unified_config = build_default_unified_config(s.platform)
warn_sql_auto_mode(tuning_resolution, s.resolved_mode, console, s.logger, quiet=bool(s.quiet))

s.tuning_source_value = tuning_resolution.source.value
Expand Down
3 changes: 2 additions & 1 deletion benchbox/cli/tuning_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,8 @@ def warn_sql_auto_mode(
console.print(
"[yellow]Warning: --tuning auto smart defaults are DataFrame-only today; "
"this SQL run proceeds with a basic constraints-only configuration "
"(primary/foreign/unique/check constraints enabled; no other tunings applied), "
"(primary/foreign/unique constraints enabled, plus check constraints except on DuckDB; "
"no other tunings applied), "
"not an untuned baseline.[/yellow]"
)
if logger:
Expand Down
8 changes: 8 additions & 0 deletions benchbox/cli/tuning_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@
from typing import Any, Literal

from benchbox.core.dataframe.tuning.interface import DataFrameTuningConfiguration
from benchbox.core.tuning.capability_registry import resolve_platform_key
from benchbox.core.tuning.interface import UnifiedTuningConfiguration


def build_default_unified_config(platform: str | None) -> UnifiedTuningConfiguration:
config = UnifiedTuningConfiguration()
if platform and resolve_platform_key(str(platform).split(":", 1)[0]) == "duckdb":
config.check_constraints.enabled = False
return config


def build_baseline_unified_config() -> UnifiedTuningConfiguration:
baseline_config = UnifiedTuningConfiguration()
baseline_config.disable_all_constraints()
Expand Down
Loading
Loading