Skip to main content
An External Table normally creates one Pinot segment per source file. Every segment is a ZooKeeper entry and an ideal state entry, so tables with millions of files strain the cluster. Segment groups store a batch of files as one cluster entry instead. A group of 25 files costs the cluster about as much as one segment, so a table can hold about 25 times more files.

What changes

Before 0.18.0, segment groups were off unless you turned them on yourself. Starting in 0.18.0:
  • Every new Iceberg External Table on the snapshot sync path gets segment groups automatically, with 25 files per group.
  • Tables that existed before the upgrade are left alone. They are never switched on automatically.
  • There is no cluster-level setting to turn on for External Tables.
What you see on a grouped table:
  • Ideal state entries are named group_<table>_<minStartMs>_<maxEndMs>_<hash> instead of one name per file.
  • The segment count in the ideal state is roughly the file count divided by 25.
  • The segment limits count groups, not files. See Limits.
  • Queries and results do not change.

Requirements

  • StarTree Cloud 0.18.0 or later.
  • An Iceberg catalog: AWS Glue, S3 Tables, Unity Catalog, Polaris, Horizon, generic Iceberg REST, or an Iceberg table registered in Hive Metastore.
  • executor=controller with no enabled key in the ExternalTableSyncTask config. This is the snapshot sync path, and it is what the Data Portal, the preview API and SQL DDL create.
  • Cluster-side setup, including component upgrades and broker access to the deep store, is managed by StarTree. Contact StarTree support if you are not sure your cluster is ready for grouped tables.

Enable or disable

When the default applies

The default is written into the table config only when every one of these is true:
  • The table is new: no sync has run yet and its ideal state has no segments.
  • The table is OFFLINE and is not a dimension table.
  • The source is an Iceberg catalog with snapshots. Raw S3 or GCS paths and native Hive Parquet tables (type = 'hive') never qualify.
  • ExternalTableSyncTask is the only task in the table config.
  • The sync task runs with executor=controller and has no enabled key (the periodic watcher).
  • The table config has no segmentGroupConfig key at all. Any value you set, including {"enabled":false}, is left alone.
The default is written at create time by the Data Portal, the preview API and SQL DDL. On a table created with a raw POST /tables, or through a preview that skips catalog sampling, it is written by the first sync run instead.

Opt out at create time

Put the key in the table config before the first sync run. In the table config you send to POST /tables:
The snippet shows only the relevant block. Merge it into the full table config the preview API returns. SQL DDL has no option for segment groups. A table created with CREATE TABLE ... WITH (...) gets the default. To opt out, create the table through the preview API and POST /tables as shown above.

Turn on for an existing table

Add the key to the table config and update the table:
  • Grouping applies from the next snapshot. Segments already ingested are never regrouped.
  • Make the change between snapshots. A change while a snapshot is being ingested stalls that snapshot until a newer one arrives.
  • The update is rejected if the table has any task other than ExternalTableSyncTask with executor=controller, or is an upsert, dedup or dimension table.

Turn off on a table that has groups

Set {"enabled":false} and update the table. The next snapshot re-ingests every remaining file as a per-file segment. The old groups stay until retention removes their snapshots, and queries skip them in the meantime. Expect a full re-ingest of the table, and a segment count about 25 times higher.

Config reference

Set this as a JSON string under metadata.customConfigs.segmentGroupConfig. The default writes the full object, so the saved value also lists minSegmentsPerGroup and canRebalanceDuringGrouping. External Tables ignore canRebalanceDuringGrouping.

Example

1. Create the table with SQL DDL

Save the statement to orders_ext.sql:
Submit it to the controller:
catalog_type accepts rest, unity, glue, s3tables and hive. DDL always creates the table with executor=controller, so the table qualifies for the default.

2. Check the config the default wrote

3. Size groups for time-based queries

Say the table receives about 2,000 files a day and most queries filter on the last few days. With the default, a group holds 25 files that may span days, so a one-day filter can’t skip it. Set a daily time bucket and larger groups:
  • timeBucket=1d keeps each group inside one day, so a filter on a date range skips whole groups from other days.
  • maxSegmentsPerGroup=50 gives about 40 groups a day instead of 80, halving the ideal state size.
  • Keep minSegmentsPerGroup at or below maxSegmentsPerGroup, or the update is rejected.
  • If the table also onboards only the last N days of files, a time bucket lets old days drop out as whole groups instead of reshaping every group that spans the cutoff.
Apply it to a new table before its first sync, or to an existing table between snapshots.

Query

Queries don’t change. Write SQL against the table as usual. Inspect the groups:
A group’s metadata carries total.segments.count, the number of files in it, and start and end times that span all of its files. Time pruning works on groups. A group’s time range runs from the earliest start time to the latest end time of its files. Without timeBucket, files are grouped in start-time order and a group can span a wide range. With timeBucket, each group starts inside one bucket, so range filters skip more groups.

Indexes

Indexes work as on any External Table. Each file keeps its own indexes inside the group. Adding an index and reloading the table works: the reload rebuilds each group with the new index. The stale-segments check reports one entry per group when any of its files needs a reload.

Verify

  1. Read the table config and look for the key: curl "$BASE_URL/tables/orders_ext?type=offline". Expect metadata.customConfigs.segmentGroupConfig with "enabled":true on a new table. On a table created with a raw POST /tables, or through a preview that skips catalog sampling, the key appears after the first sync run.
  2. Check sync progress: curl "$BASE_URL/tables/orders_ext_OFFLINE/externalTable/checkpoint" shows "state": "DONE" when the first snapshot is fully ingested. Until then, queries fail with No active Iceberg snapshots are available for table ….
  3. After the first snapshot completes, list the ideal state: curl "$BASE_URL/tables/orders_ext/idealstate". Expect segment names that start with group_, about one per 25 files.
  4. Run SELECT COUNT(*) FROM orders_ext and compare it with the row count in your catalog.

Limits

  • One group counts as one segment for the controller segment limits. The per-table limit defaults to 350,000 entries. At 25 files per group that is about 8.75 million files per table. At 50 files per group it is about 17.5 million.
  • The cluster-wide limit defaults to 1,000,000 entries. Both limits count ideal state entries. Contact StarTree support to change them. When a limit is reached, the controller blocks new External Table ingestion.
  • A group goes ONLINE only when all of its files load. One bad file keeps its whole group out of query results.
  • Groups are OFFLINE-only. Upsert, dedup and dimension tables can’t use them.
  • No other minion task can run on a grouped table. Only ExternalTableSyncTask with executor=controller is allowed.
  • Turning grouping off on a table that has groups re-ingests every grouped file.
  • Turning grouping on for a table with data applies from the next snapshot. Existing segments are never regrouped. Change it between snapshots: a change mid-snapshot stalls that snapshot until a newer one arrives.
  • Before any server downgrade on a cluster that has groups, contact StarTree support.

Common errors