Repository navigation
Reject POINT EMPTY in readWKT / readWKTPoint - #110692
nikitamikhaylov merged 3 commits into
Conversation
POINT EMPTY is valid WKT, but a ClickHouse Point is a fixed Tuple(Float64, Float64) with no empty representation. boost::geometry::read_wkt accepts POINT EMPTY without writing the coordinates or throwing, so the functions returned uninitialized coordinates (scalar, non-deterministic, MSan-flaggable) or stale prior-row coordinates (vectorized). Detect the empty-point form after parsing and reject it with CANNOT_PARSE_TEXT. Also move the per-row Geometry object inside the execution loop so a row read_wkt leaves untouched cannot carry over prior-row contents. Non-point empty geometries (LINESTRING/POLYGON/MULTIPOLYGON EMPTY) are unaffected because those types have valid empty representations. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-worker-slot-1:20260716-125100 |
|
cc @nikitamikhaylov @scanhex12 — review please. Rejects |
|
Workflow [PR], commit [94d69f6] Summary: ❌
AI ReviewSummaryThis PR closes the Missing context / blind spots
Final Verdict✅ No new blockers or majors in the current diff. |
FunctionReadWKTCommon::try_deserialize_type dispatched on the untrimmed
lowercased payload, so readWKT(' POINT EMPTY ') matched no type prefix and
fell through to BAD_ARGUMENTS instead of the CANNOT_PARSE_TEXT empty-point
rejection that readWKTPoint already applied. Trim leading whitespace before
the starts_with dispatch so the generic entrypoint rejects the empty point too.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Fixed in 56c81f7. |
CI finish ledger — 56c81f7The bot's change request is resolved: The remaining red checks are pre-existing trunk issues unrelated to this geometry change (04540 is green everywhere):
|
CI finish ledger — 56c81f7Every failure below has an owner: a fixing PR, or a full-effort fix task whose fixing-PR link will be posted here when it opens. Only
Session id: cron:our-pr-ci-monitor:20260716-203000 |
|
Fixing PR for the Stress amd_tsan liftUpUnion block-mismatch line (STID 0993-23fd): #110745 |
…t-point-empty # Conflicts: # src/Functions/readWkt.cpp
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 15/17 (88.24%) · Uncovered code |
CI finish ledger - 94d69f6Every failure below has an owner. None is caused by this PR's diff (readWKT / readWKTPoint POINT EMPTY rejection + test; this head is a mechanical rebase onto master, functional code byte-identical to the approved 56c81f7).
Session id: cron:our-pr-ci-monitor:20260721-173000 |
33deb04
|
Hi @groeneai @nikitamikhaylov — while reviewing this PR I found the following:
Happy to discuss — close anything that's wrong or already addressed. |
readWKTPoint/readWKT('POINT M EMPTY') returned uninitialized coordinates in
the scalar path (garbage subnormal/nan) and silently leaked the previous
row's coordinates in the vectorized path, instead of throwing.
isEmptyPointWKT (added in #110692 to reject bare POINT EMPTY) stripped only
the 'point' prefix and required the remainder to equal exactly 'empty', so
the valid WKT dimension tags Z/M/ZM that may sit between POINT and EMPTY
bypassed the guard. boost::geometry::read_wkt accepts 'POINT M EMPTY' for a
2D point without writing coordinates, so the empty form was not detected.
Strip an optional Z/M/ZM dimension tag (as a whole space-separated token)
before the empty check, so the whole POINT <dim> EMPTY family is rejected
with CANNOT_PARSE_TEXT, matching the existing bare POINT EMPTY handling.
Non-point EMPTY geometries and valid points are unaffected.
Closes: #111505
Co-Authored-By: Claude Opus 4.8 <[email protected]>
…kt-point-empty Reject POINT EMPTY in readWKT / readWKTPoint
readWKTPoint/readWKT('POINT M EMPTY') returned uninitialized coordinates in
the scalar path (garbage subnormal/nan) and silently leaked the previous
row's coordinates in the vectorized path, instead of throwing.
isEmptyPointWKT (added in ClickHouse#110692 to reject bare POINT EMPTY) stripped only
the 'point' prefix and required the remainder to equal exactly 'empty', so
the valid WKT dimension tags Z/M/ZM that may sit between POINT and EMPTY
bypassed the guard. boost::geometry::read_wkt accepts 'POINT M EMPTY' for a
2D point without writing coordinates, so the empty form was not detected.
Strip an optional Z/M/ZM dimension tag (as a whole space-separated token)
before the empty check, so the whole POINT <dim> EMPTY family is rejected
with CANNOT_PARSE_TEXT, matching the existing bare POINT EMPTY handling.
Non-point EMPTY geometries and valid points are unaffected.
Closes: ClickHouse#111505
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Closes: #110687
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed
readWKTandreadWKTPointreturning uninitialized (scalar) or stale prior-row (vectorized) coordinates forPOINT EMPTY.POINT EMPTYis now rejected withCANNOT_PARSE_TEXT, since a ClickHousePointis a fixedTuple(Float64, Float64)with no empty representation.Description
POINT EMPTYis valid WKT, butboost::geometry::read_wktaccepts it without writing the coordinates or throwing. A ClickHousePointis a fixedTuple(Float64, Float64)with no empty representation, so the coordinates were left uninitialized (scalar, non-deterministic and MSan-flaggable) or carried over from a previous row (vectorized).LINESTRING/POLYGON/MULTIPOLYGON EMPTYwere unaffected because those types have valid empty representations.Fix: after parsing, detect the empty-point form (case- and whitespace-insensitive) and reject it with
CANNOT_PARSE_TEXT. Also moved the per-rowGeometryobject inside the execution loop so a row thatread_wktleaves untouched cannot carry over prior-row contents.Report: #110687 (fiddle: https://fiddle.clickhouse.com/16fc1a3e-6065-440a-b8f7-39253fbba8c6)
Version info
26.7.1.1329(included in26.7and later)