Skip to main content
Version: 97.1

Training guide

Follow the step-by-step instructions in this guide to learn how to query Apache Iceberg tables with Factor House.

Each step lists the form fields to set, and explains how to read the result.

Prepare sample data​

The examples use a small invoices table in a finance namespace. Create it in your own catalog with any engine that can write to Iceberg. The statements below use Spark SQL, with a catalog named demo. Replace demo with the name of your catalog.

CREATE NAMESPACE IF NOT EXISTS demo.finance;

CREATE TABLE demo.finance.invoices (
id STRING,
customer STRING,
status STRING,
amount DECIMAL(12,2),
created_at TIMESTAMP,
address STRUCT<city: STRING, country: STRING>,
items ARRAY<STRUCT<sku: STRING, price: DOUBLE>>
) USING iceberg;

Insert the first batch of invoices:

INSERT INTO demo.finance.invoices VALUES
('INV-1001', 'Acme Corp', 'overdue', 1250.00, TIMESTAMP '2026-10-01 09:00:00',
named_struct('city', 'Melbourne', 'country', 'AU'),
array(named_struct('sku', 'A-100', 'price', 500.0D), named_struct('sku', 'B-200', 'price', 750.0D))),
('INV-1002', 'Acme Corp', 'paid', 300.00, TIMESTAMP '2026-10-03 09:00:00',
named_struct('city', 'Sydney', 'country', 'AU'),
array(named_struct('sku', 'A-100', 'price', 300.0D))),
('INV-1003', 'Globex', 'overdue', 80.50, TIMESTAMP '2026-10-05 09:00:00',
named_struct('city', 'Melbourne', 'country', 'AU'),
array(named_struct('sku', 'C-300', 'price', 80.5D))),
('INV-1004', 'Initech', 'open', 2400.00, TIMESTAMP '2026-10-07 09:00:00',
named_struct('city', 'Auckland', 'country', 'NZ'),
array(named_struct('sku', 'B-200', 'price', 1200.0D), named_struct('sku', 'D-400', 'price', 1200.0D))),
('INV-1005', 'Globex', 'paid', 15.00, TIMESTAMP '2026-10-09 09:00:00',
named_struct('city', 'Perth', 'country', 'AU'),
array(named_struct('sku', 'C-300', 'price', 15.0D))),
('INV-1006', 'Acme Corp', 'open', 640.00, TIMESTAMP '2026-10-11 09:00:00',
named_struct('city', 'Melbourne', 'country', 'AU'),
array(named_struct('sku', 'A-100', 'price', 320.0D), named_struct('sku', 'A-100', 'price', 320.0D)));

Wait until Factor House has observed the table, then insert a second batch. Each insert creates an Iceberg snapshot, so the table now has two snapshots that you can compare in Reading older versions of a table.

INSERT INTO demo.finance.invoices VALUES
('INV-1007', 'Initech', 'overdue', 3100.00, TIMESTAMP '2026-11-02 09:00:00',
named_struct('city', 'Auckland', 'country', 'NZ'),
array(named_struct('sku', 'D-400', 'price', 3100.0D))),
('INV-1008', 'Acme Corp', 'overdue', 99.00, TIMESTAMP '2026-11-04 09:00:00',
named_struct('city', 'Melbourne', 'country', 'AU'),
array(named_struct('sku', 'C-300', 'price', 99.0D)));

The table now holds eight invoices. If you prefer to use one of your own tables, substitute its namespace, table and column names in the examples.

note

Make sure the catalog is configured in Factor House, and that the IAM role Factor House uses can read the table's data files in Amazon S3. See AWS S3 and KMS.

Accessing the Data Inspect UI​

To access the Data Inspect UI, choose your Iceberg catalog in Factor House, then choose the Data option in the Focus group of the menu.

You can also open a table from the catalog and click Inspect data. The Data Inspect UI opens with the namespace and table already selected.

Search basics​

See Data Inspect: Usage documentation for a full description of each query form field.

To reset the form to its default state, click the Clear form button in the top-right corner.

Search the rows of a table​

The most popular query is simply to take a first look at the data in a table.

Form Fields Set

Namespace: finance
Table: invoices

Set the Namespace and Table fields to tell Factor House which table to search. Leave every other form field at its default setting, then click Search.

With Read as of: Current snapshot set, Factor House reads the table as it is now. Rows are streamed to the UI as they are found, and the tab label counts the rows read while the search runs. Rows are returned in the order the table is scanned, so they may not appear in the order they were inserted.

The 8/8 text means that Factor House read 8 rows and returned 8 results (as you had no filter applied). If you hover over that text you see a more detailed description of the number of rows realized, read and skipped, and how long it took to execute the search in milliseconds.

Understand the results​

Each result shows its position, the snapshot it was read from, and the row as JSON.

Click the Context button in the results toolbar to see the details of the query and how it ended.

With no filter applied, Rows read and Rows matched are both 8, Rows skipped is 0, and the Result is Complete, all rows were read. Rows skipped counts the rows that were read but did not match the filter. Table load time shows how long it took to load the table from the catalog, and Snapshot shows the id of the snapshot that was read.

Click the Display button to switch between Pretty printed and Raw rows, or to hide the Position, Snapshot and Row fields.

Filtering rows​

Filter by a column value​

Form Fields Set

Namespace: finance
Table: invoices
kJQ filter: .status == "overdue"

Click Search, or press Shift + Enter in the filter field.

Factor House evaluates the filter against every row it reads. The 4/8 text means that it read 8 rows and returned the 4 that match. The Context shows Rows skipped: 4, the rows that did not match.

Combine conditions​

Form Fields Set

kJQ filter: .status == "overdue" and (.customer | startswith("Acme"))

Use and, or and brackets to build up a condition. and binds more tightly than or. Only the overdue invoices for Acme Corp match, so the tab shows 2/8.

Filter on a number​

Decimal columns are strings when they are filtered, so convert them to a number before comparing.

Form Fields Set

kJQ filter: .amount | to-double > 1000

Three invoices are larger than 1000, so the tab shows 3/8.

Filter on nested values​

Reach into a struct with dots, and into a list with square brackets.

Form Fields Set

kJQ filter: .address.city == "Melbourne"

Four invoices are for Melbourne, so the tab shows 4/8.

Other filters to try:

.items[0].sku == "A-100"
.items | map(.price) | max > 100

See kJQ filters to learn more about filtering Iceberg tables.

note

A filter on a column that does not exist matches no rows. If you get no results, check the column names.

Choosing columns​

Wide tables return a lot of data. Use a projection to return only the columns you need.

Form Fields Set

Projections: .id, .customer, .amount
kJQ filter: .status == "overdue"

Each row that is returned contains only the id, customer and amount columns. For example:

{
"id": "INV-1001",
"customer": "Acme Corp",
"amount": "1250.00"
}

You can filter on status even though it is not part of the projection.

You can also project fields within a struct, for example .id, .address.city. A projection selects at most 10 columns, and each selector must start with a column that exists in the table.

Reading older versions of a table​

Iceberg tables keep their history as snapshots. Use Read as of to see how a table looked in the past, for example to find out what changed after a write.

Read a specific snapshot​

Form Fields Set

Read as of: Snapshot
Snapshot: <select the older snapshot>

The Snapshot selector lists the table's snapshots as <snapshot id> · <UTC timestamp>.

The older snapshot was committed by the first insert, so the tab shows 6/6 instead of 8/8. The Context shows the id of the snapshot that was read.

Read the table as of a point in time​

Form Fields Set

Read as of: Duration ago
Pick a duration: PT1H

This reads the table as it was one hour ago. Durations use the ISO 8601 duration format, and support days, hours, minutes and seconds. Use Timestamp (epoch milliseconds) or Datetime to choose an exact point in time instead.

Factor House reads the latest snapshot committed at or before that time. If the time is earlier than the table's first snapshot, the search returns an error.

Compare two versions​

Each search opens a new result tab, and tabs are kept for the table. Run the same filter against the Current snapshot and then against the older snapshot, and switch between the tabs to compare the results. Each row shows the snapshot it was read from.

Enable Options > Sync form with results to have the form filled in with the query of the tab you select.

Controlling how many rows you get​

Form Fields Set

Namespace: finance
Table: invoices
Result limit: 3

Factor House stops the search once it has returned 3 rows, and the Context shows Result: Limit reached, more rows match.

The default Result limit is 100 and the maximum is 300. To see different rows, narrow the filter or read a different snapshot.

Long-running searches​

Searches stream, so you can work with the first rows while the search continues.

  • Click Cancel consuming to stop a search. The rows received so far stay on screen, and the Result reads Cancelled, the result is incomplete.
  • Closing a result tab that is still running also cancels its search.
  • A search stops on its own after a timeout (30 seconds by default), and the Result reads Timed out, the result is incomplete. Make the filter more selective, or project fewer columns, and search again.
  • If other searches are using every worker, your search shows Queued... until a worker is free.

Filters are applied to rows after they have been read, so finding a rare value in a very large table can take a long time.

Sharing and exporting results​

Click Copy query URL in the results toolbar to copy a link to the Data Inspect UI with the namespace, table, Read as of value, filter, projection and result limit filled in.

Click Download and choose as CSV, as EDN or as JSON to export the rows received for the selected result tab, up to 300 rows. Struct, list and map values are written as JSON in CSV cells.

Troubleshooting​

MessageWhat to check
kJQ errorThe filter could not be parsed. Check brackets, quotes and function names.
Projections errorThe projection could not be parsed. Selectors start with a dot, for example .customer.
Unknown columnsA projected column is not in the table's schema at the snapshot being read.
Select at most 10 columnsReduce the number of projected columns.
Limit must be a numberThe Result limit must be a whole number.
No rows foundThe snapshot has no rows, or no row matches the filter.
Sampler unavailable: Queue is at capacityToo many searches are queued. Retry shortly.
Timed out, the result is incompleteNarrow the filter or project fewer columns. See Worker configuration.
The search fails reading data filesCheck the IAM role's S3 and KMS permissions. See AWS S3 and KMS.