Query Data (SELECT & JOIN)
Use this page for query-only SQL patterns in KalamDB.
KalamDB supports the DataFusion SELECT query surface. For advanced query syntax and planner behavior, use the DataFusion SQL docs as the primary reference:
- https://datafusion.apache.org/user-guide/sql/select.html
- https://datafusion.apache.org/user-guide/sql/index.html
The visible rows and join targets still follow KalamDB table-type authorization. USER and STREAM
tables are scoped by effective user, SHARED tables use ACCESS_LEVEL, and system.* access is
restricted. See /docs/server/architecture/table-types.
DataFusion Statement Scope
KalamDB uses DataFusion as the engine for query-time SQL, especially read/query workloads:
SELECTand projection/filter/order/limit patterns- joins (
INNER,LEFT,RIGHT,FULL,CROSS,USING) - subqueries and
WITH(CTE) - set operations such as
UNION/UNION ALL - scalar/aggregate/window function execution in query plans
KalamDB-specific operational SQL surfaces are implemented by KalamDB handlers instead of raw DataFusion SQL semantics, including:
- DDL (
CREATE/ALTER/DROPnamespaces, tables, users, storage, topics) - topic/consumer commands (
CREATE TOPIC,ALTER TOPIC,CONSUME,ACK,RESET CONSUMER GROUP) - live-query controls (
SUBSCRIBE TO,KILL LIVE QUERY)
Basic SELECT
Example:
Filtering, Grouping, and Aggregation
JOIN Support
KalamDB supports standard DataFusion join patterns, including:
INNER JOINLEFT JOINRIGHT JOINFULL JOINCROSS JOINJOIN ... USING (...)
Example (INNER JOIN):
Example (LEFT JOIN):
Subqueries and CTEs
Common DataFusion query constructs are supported, including subqueries and CTEs.
Set Operations
You can use DataFusion set operations such as UNION and UNION ALL.
PostgreSQL-style JSON Queries
JSON and JSONB columns can be queried with the same common extraction syntax PostgreSQL users already know.
Use -> when you want a JSON value, ->> when you want text, and ? when you only need to test key existence.
KalamDB also exposes DataFusion JSON helpers such as json_get, json_as_text, json_length, and json_object_keys for function-style access.
For the full JSON function list and current operator coverage, see
/docs/server/sql-reference/functions.
Advanced Query Reference
For advanced SELECT features, rely on DataFusion SQL documentation:
- https://datafusion.apache.org/user-guide/sql/select.html
- https://datafusion.apache.org/user-guide/sql/scalar_functions.html
- https://datafusion.apache.org/user-guide/sql/index.html