x-pack/plugin/esql-datasource-iceberg/qa/src/javaRestTest/resources/iceberg-fixtures/README.md
This directory contains pre-built Iceberg metadata and Parquet files used for testing.
These fixtures serve files directly through the S3HttpFixture, eliminating the need for manual test data setup via addBlobToFixture() calls. Files placed here are automatically loaded into the fixture's blob storage when tests run.
Files in this directory are mapped to S3 paths preserving their structure:
iceberg-fixtures/
├── README.md # This file
├── db/ # Database directory
│ └── table/ # Table directory
│ ├── metadata/ # Iceberg metadata files
│ │ ├── v1.metadata.json # Table metadata version 1
│ │ └── version-hint.text # Current version pointer
│ └── data/ # Parquet data files
│ └── part-00000.parquet # Data file
└── standalone/ # Standalone Parquet files (no Iceberg metadata)
└── simple.parquet # Simple Parquet file for direct reading
Files are automatically mapped to S3 paths:
iceberg-fixtures/db/table/metadata/v1.metadata.json → s3://iceberg-test/warehouse/db/table/metadata/v1.metadata.jsoniceberg-fixtures/standalone/simple.parquet → s3://iceberg-test/warehouse/standalone/simple.parquetAll files in this directory are automatically loaded when tests extending AbstractS3HttpFixtureTest start:
public class MyIcebergTest extends AbstractS3HttpFixtureTest {
public void testReadIcebergTable() throws Exception {
// Files from iceberg-fixtures/ are already loaded!
Catalog catalog = createCatalog();
TableIdentifier tableId = TableIdentifier.of("db", "table");
Table table = catalog.loadTable(tableId);
// Use the table...
}
}
You can still add files programmatically if needed:
public void testWithDynamicData() {
// Add a file at runtime
addBlobToFixture("dynamic/test.parquet", parquetBytes);
// Use it...
}
Test different Parquet versions and encodings:
parquet-v1/ - Parquet format version 1 filesparquet-v2/ - Parquet format version 2 filesdictionary-encoded/ - Dictionary-encoded columnsplain-encoded/ - Plain-encoded columnsTest boundary conditions and special cases:
edge-cases/all-nulls.parquet - File with all null valuesedge-cases/empty-columns.parquet - File with empty columnsedge-cases/large-strings.parquet - File with large string valuesComplete Iceberg table structures with metadata:
db/table/ - Full Iceberg table with metadata and data filesSpecific files that reproduce known bugs or issues.
The org.elasticsearch.xpack.esql.iceberg.testdata.generation package provides utilities for generating test fixtures.
Note: These utilities use Parquet's Hadoop-based APIs (parquet-hadoop) for writing files. While they import
Hadoop classes, they use LocalInputFile/LocalOutputFile which bypass Hadoop's FileSystem and work directly with
java.nio.file.Path. The Configuration class is created with Configuration(false) to avoid loading Hadoop
resources and triggering security manager issues.
// Generate a simple Parquet file
ParquetWriterUtil.writeParquet(
schema,
rows,
outputFile,
ParquetWriterConfig.defaults()
);
// Generate Iceberg metadata
IcebergMetadataGenerator.generateMetadata(
tableName,
parquetFile,
outputDir,
IcebergMetadataConfig.defaults()
);
You can also generate fixtures using external tools like Apache Spark or Iceberg CLI:
# Using PySpark
df = spark.createDataFrame([
(1, "Alice", 30),
(2, "Bob", 25)
], ["id", "name", "age"])
df.write.format("parquet").save("simple.parquet")
To regenerate all fixtures, run the generator tests:
./gradlew :x-pack:plugin:esql:test --tests "*IcebergMetadataGeneratorTests"
If fixtures aren't loading, check:
src/test/resources/iceberg-fixtures/AbstractS3HttpFixtureTestIf S3 paths don't match expectations:
iceberg-fixtures/ rootprintRequestSummary() to see actual S3 requestsIf tests can't find expected files:
iceberg-test and warehouse is warehouses3Fixture.getHandler().blobs() to inspect loaded files