GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [SQL] Forbid comparisons between ROW-typed values in SQL by mihaibudiu · Pull Request #7674 · feldera/feldera

Conversation

@mihaibudiu

@mihaibudiu mihaibudiu commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Linked Issue

We reject all programs that use <, <=, >=, > or implicit forms of these (e.g., BETWEEN) involving ROW-typed values.
We still allow ORDER BY of ROW values, and sorting of ROW ARRAY values.

Fixes #7652

Checklist

  • Unit tests added/updated
  • Integration tests added/updated
  • Documentation updated
  • Changelog updated

Breaking Changes?

  • Feldera SQL (Syntax, Semantics)

Describe Incompatible Changes

We now reject programs comparing ROW values. We already used to forbid comparing ROW values for equality, now we also forbid comparing them for ordering. This will make some the compiler reject some user program that were compiled previously.

The reason for this incompatible change is that our implementation of comparison does not match the standard SQL semantics. SQL expects ROW comparisons to use ternary logic, where NULL compared with anything is NULL. Our previous implementation used to produce a non-nullable Boolean results, and was treating NULL as the smallest value of the field type.

The rationale for rejecting such operations is the same as for equality: instead of providing results for such programs that do not match the SQL standard, we prefer to reject such programs.

In SQL ORDER BY uses a different ordering than < or LEAST. That's the reason we actually support ORDER BY on ROW values - it does match our semantics.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mihaibudiu
[SQL] Forbid comparisons between ROW-typed values in SQL
dc79474
Signed-off-by: Mihai Budiu <[email protected]>
mythical-fred-oss[bot]
mythical-fred-oss Bot reviewed Oct 28, 2026
View reviewed changes
Comment thread ...org/dbsp/sqlCompiler/compiler/frontend/calciteCompiler/optimizer/RejectUnsupportedPlans.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@mythical-fred-oss

mythical-fred-oss Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

What I ran

Check Result
./build.sh ✅
mvn test -Dtest=RowComparisonTests,Regression1Tests,IncrementalRegressionTests ✅ 228/228
pre-commit run --files <changed> ✅
Ad-hoc probe tests (not committed), listed below ✅ all behave as documented

QA probes. These are cases the PR's own tests don't cover; worth adding a few to RowComparisonTests:

  • Accepted, as the docs promise: ORDER BY r LIMIT 2, top-k via ROW_NUMBER() OVER (ORDER BY r), ARG_MIN(id, r), SORT_ARRAY/ARRAY_MAX on ROW ARRAY, MAX(row_array), ARRAY_CONTAINS(arr, ROW(1)), r.a < s.a.
  • Rejected with the new error: GREATEST(r, NULL), CASE WHEN r < s, JOIN ... ON T.r < T2.s, WHERE r < ROW(1, NULL).
  • r > ALL (SELECT s ...) / < SOME: Calcite already rejects these ("must have compatible types"), so they never reach the new check. Fine, but untested.
  • missing (medium): the PR adds no positive test for ORDER BY or window ORDER BY on ROW columns. The docs promise that keeps working, and a future change to this check could silently break it.

Gates: the tests, docs, changelog and breaking-change description are all present. commit (medium): the commit body is only Signed-off-by. For an incompatible SQL change, please copy the why (the three-valued-logic mismatch) from the PR description into the commit message, since only the commit survives in the linear history.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

gz
gz approved these changes Oct 30, 2026
View reviewed changes

@gz gz left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to rewrite all my SQL now

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mihaibudiu

mihaibudiu commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

You will notice that not many tests need rewriting. People don't really compare ROW types.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mihaibudiu
mihaibudiu added this pull request to the merge queue Oct 30, 2026
Merged via the queue into main with commit 380970b Oct 31, 2026
3 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@mihaibudiu
mihaibudiu deleted the issue7652 branch October 31, 2026 02:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@mythical-fred-oss mythical-fred-oss[bot] mythical-fred-oss[bot] left review comments
@gz gz gz approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[SQL] Comparison for ROW types is inconsistent

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@mihaibudiu @gz
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.