Query It Back, and Prove Pruning Happened
run(ctx, spark, `
SELECT order_id, order_ts, amount, status, country
FROM hms.db.orders
WHERE order_ts >= TIMESTAMP '2026-01-17 00:00:00'
ORDER BY order_id`)+--------+-------------------+------+---------+-------+
|order_id|order_ts |amount|status |country|
+--------+-------------------+------+---------+-------+
|1005 |2026-01-17 10:00:00|89.00 |COMPLETED|US |
|1006 |2026-01-17 11:30:00|12.00 |CANCELLED|US |
|1007 |2026-01-18 06:15:00|42.00 |COMPLETED|DE |
+--------+-------------------+------+---------+-------+Three rows out of six. Now ask Spark to show its work:
run(ctx, spark, `
EXPLAIN SELECT order_id FROM hms.db.orders
WHERE order_ts >= TIMESTAMP '2026-01-17 00:00:00'`)Somewhere in the physical plan text you'll see a line naming the Iceberg scan node along with how many data files it planned to read — look for it to report 2 files (the 2026-01-17 and 2026-01-18 partitions), not the 4 the table actually has on disk. That's partition pruning happening at planning time, before a single byte of Parquet is opened — it's decided purely from the manifest metadata you'll inspect directly in the next part.
To get values back into Go instead of a printed table, use .Collect():
df, err := spark.Sql(ctx, "SELECT order_id, amount FROM hms.db.orders WHERE country = 'US'")
if err != nil {
log.Fatalf("query: %v", err)
}
rows, err := df.Collect(ctx)
if err != nil {
log.Fatalf("collect: %v", err)
}
for _, row := range rows {
fmt.Println(row)
}