-
Notifications
You must be signed in to change notification settings - Fork 0
Payloadbuilder Query Engine
Payloadbuilder is Queryeer's built-in query engine. It implements a SQL-like query language that can federate queries across multiple heterogeneous data sources — called catalogs — in a single query. Unlike the JDBC engine which connects to a single relational database, Payloadbuilder can join data from an Elasticsearch index with a local CSV file and an HTTP API endpoint in one statement.
Payloadbuilder is a separate open-source project (github.com/kuseman/payloadbuilder) that is embedded in Queryeer. It provides:
- A SQL-like query language parsed by an ANTLR grammar
- A catalog plugin API for adding new data source types
- An execution engine that evaluates queries against one or more catalogs
- A schema/metadata API consumed by Queryeer's code completion
A catalog in Payloadbuilder is a named connector to a specific data source type. Multiple catalog instances can be configured and referenced in a single query using a <catalog>.<table> syntax.
Queryeer ships with the following built-in catalogs:
Query Elasticsearch indices using SQL-like syntax.
Example
SELECT *
FROM es#"index/my_index" i
WHERE i.status = 'active'
AND i.created_at > '2024-01-01'
LIMIT 100Features
- Full-text search predicates mapped to Elasticsearch
matchandtermqueries - Aggregation support
- Nested field access with dot notation
- Configurable Elasticsearch host, port, and authentication
- Index metadata crawled for code completion (field names and types)
Configuration Open Options → Payloadbuilder → Elasticsearch to set:
- Hostname and port
- Authentication (basic auth or API key)
- Default index prefix
Query files and directories on the local filesystem as if they were database tables.
Example — list files in a directory
SELECT name, size, lastModified
FROM fs#"file/C:/data/exports"
WHERE extension = 'csv'
ORDER BY lastModified DESCExample — read lines from a text file
SELECT line, lineNumber
FROM fs#"line/C:/logs/app.log"
WHERE line LIKE '%ERROR%'Features
- Browse directory contents (file name, size, dates, extension)
- Read file contents line by line
- Pattern-based file filtering
- Cross-catalog joins between file data and other sources
Query HTTP/REST endpoints and treat the JSON response as a table.
Example
SELECT id, name, status
FROM http#"endpoint/https://api.example.com/users"
WHERE status = 'active'Features
- GET requests with optional headers and query parameters
- JSON response automatically flattened into rows and columns
- Configurable base URL, headers, and authentication
- Supports paginated APIs through catalog-level configuration
A key feature of Payloadbuilder is the ability to join data from different catalog types in a single query:
-- Join Elasticsearch data with a local CSV file
SELECT u.id, u.name, f.region
FROM es#"index/users" u
INNER JOIN fs#"line/C:/data/regions.csv" f
ON u.region_id = f.id
WHERE u.active = trueThe Payloadbuilder execution engine handles cross-catalog joins by pulling data from each source and performing the join in memory.
Payloadbuilder's query language is a subset of SQL extended with catalog-specific table reference syntax:
<catalog>#"<type>/<path or name>"
Supported SQL constructs:
-
SELECTwith column aliases and expressions -
FROMwith single and multi-table sources -
WHEREwith comparison, logical, andLIKEoperators -
JOIN(INNER, LEFT, CROSS) across tables and catalogs -
GROUP BYand aggregate functions (COUNT,SUM,MIN,MAX,AVG) -
ORDER BYwithASC/DESC -
LIMIT/TOPfor result truncation - Subqueries and CTEs (
WITH ... AS (...)) - Built-in scalar functions (string, date, math, type conversion)
When a Payloadbuilder query is open, the editor's completion engine is aware of:
- Configured catalog names (as table prefixes)
- Field/column names from connected catalogs (Elasticsearch field names, filesystem columns, etc.)
- Built-in Payloadbuilder functions
- Table aliases defined earlier in the same query
New catalog types can be added via the plugin system by implementing the ICatalogExtensionFactory interface. A custom catalog must provide:
- A
Catalogimplementation with table/schema metadata - An operator that executes scan/filter/projection against the data source
- Optional: a configuration panel shown in the Options dialog
Once packaged as a JAR and placed in plugins/, the new catalog type is available to all Payloadbuilder queries.
Payloadbuilder and its catalogs are configured under Options → Payloadbuilder. Each catalog instance has its own sub-section where connection details, credentials, and catalog-specific options are set.
The IPayloadbuilderService is also available as an injectable service for use by other plugins that want to execute Payloadbuilder queries programmatically.