Skip to content

feat(query_engine): add table function to create inline tables - #1780

Open
fengelniederhammer wants to merge 7 commits into
mainfrom
1380-add-table-literal-to-query-language
Open

fengelniederhammer wants to merge 7 commits into
mainfrom
1380-add-table-literal-to-query-language

Conversation

@fengelniederhammer

@fengelniederhammer fengelniederhammer commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

resolves #1380

Summary

Adds a table(...) function to SaneQL to write a small, fixed table inline in a query:

table({{a := 1, b := 2}, {3, 4}})
a b
1 2
3 4
  • Rows — the first row is a record that names the columns; every later row is positional and must have the same width.
  • Types — the first row fixes each column's type; later cells must match it. Integer literals are INT64; use casts for others (1::int32, null::string). A bare null in the first row is rejected because it leaves the type undetermined.
  • Cells — any constant expression (literal, cast, scalar function call); column references are rejected.
  • Execution — new TableLiteralNode source node. The Arrow table is built at plan time, so cell errors are reported as query errors (HTTP 400).

PR Checklist

  • All necessary documentation has been adapted or there is an issue to do so.
  • The implemented feature is covered by an appropriate test.

@fengelniederhammer
fengelniederhammer requested a balanced review from Copilot November 18, 2026 09:39
@fengelniederhammer
fengelniederhammer marked this pull request as ready for review November 18, 2026 09:39
@github-actions

Copy link
Copy Markdown
Contributor

This is a preview of the changelog of the next release. If this branch is not up-to-date with the current main branch, the changelog may not be accurate. Rebase your branch on the main branch to get the most accurate changelog.

Note that this might contain changes that are on main, but not yet released.

Changelog:

0.17.6 (2026-11-18)

Features

  • query_engine: add type casts at query execution time (#1799) (f7acdf0)

Bug Fixes

  • query_engine: do not decompress every row before applying a limit (#1833) (d3c06a2)
  • query_engine: evaluate out-of-bound .at() expressions to null for null inputs (#1839) (511d2ee)
  • query_engine: limit the nesting of queries (#1828) (599d3a4)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are recorded for the change adding SaneQL inline tables.

No open issues 🎉

What changed in this PR

Adds SaneQL’s table(rows) function for creating inline relations, addressing #1380 and integrating literal data with the existing query engine.

Changes:

  • Validates named first rows, positional later rows, constant cells, and consistent column types.
  • Adds an ordered Arrow-backed source node and registers it with query planning and operator visitors.
  • Adds parser, query, insertion, and end-to-end tests, plus user documentation.
File Description
src/​rhydb/​query_engine/​saneql/​table_literal_builder.h Declares the table-literal builder and its contract.
src/​rhydb/​query_engine/​saneql/​table_literal_builder.cpp Validates rows and materializes typed Arrow columns.
src/​rhydb/​query_engine/​saneql/​parser.test.cpp Tests parsing nested table-literal syntax.
src/​rhydb/​query_engine/​saneql/​ast_to_query.cpp Registers and dispatches the table function.
src/​rhydb/​query_engine/​operators/​table_literal_node.test.cpp Tests values, validation, composition, and insertion.
src/​rhydb/​query_engine/​operators/​table_literal_node.h Defines the inline-table source node.
src/​rhydb/​query_engine/​operators/​table_literal_node.cpp Emits literal rows as an ordered Arrow batch.
src/​rhydb/​query_engine/​operators/​query_node.h Adds the table-literal node kind.
src/​rhydb/​query_engine/​operators/​query_node.cpp Provides the node’s display name.
src/​rhydb/​query_engine/​operator_visitor.h Adds visitor dispatch for table literals.
endToEndTests/​test/​queries/​TableLiteral.json Verifies a successful table-literal query.
endToEndTests/​test/​invalidQueries/​tableLiteralMixedTypes.json Verifies rejection of mixed column types.
documentation/​query_documentation.md Documents table syntax, cell restrictions, and typing.

Review effort: Balanced

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.

Add table literal to query language

3 participants