You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@asterixdb.apache.org by AsterixDB Code Review <do...@asterix-gerrit.ics.uci.edu> on 2026/05/11 05:27:29 UTC

[XL] Change in asterixdb[lumina]: [ASTERIXDB-3634][EXT]: correctly parse iceberg data types

From Hussain Towaileb <hu...@gmail.com>:

Hussain Towaileb has uploaded this change for review. ( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21226?usp=email )


Change subject: [ASTERIXDB-3634][EXT]: correctly parse iceberg data types
......................................................................

[ASTERIXDB-3634][EXT]: correctly parse iceberg data types

Details:
- Parse float type as float instead of promoting to double.
- Parse Map type (with String key) to JSON object type.
- Ensure date, time and timestamp types are handled correctly.

Ext-ref: MB-70462
Change-Id: I968952f850e3e1c88d630566fb764f6b89ca2300
---
A asterixdb/asterix-app/data/json/iceberg_all_types.json
M asterixdb/asterix-app/src/test/java/org/apache/asterix/api/common/LocalCloudUtilAdobeMock.java
M asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
M asterixdb/asterix-app/src/test/java/org/apache/asterix/test/iceberg/IcebergTest.java
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/all-data-types/test.000.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/all-data-types/test.010.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/all-data-types/test.020.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/all-data-types/test.030.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/all-data-types/test.999.ddl.sqlpp
R asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/all-supported-catalog-types/test.000.ddl.sqlpp
R asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/all-supported-catalog-types/test.001.ddl.sqlpp
R asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/check-catalog-record/test.000.ddl.sqlpp
R asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/check-catalog-record/test.001.query.sqlpp
R asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/check-catalog-record/test.002.ddl.sqlpp
R asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/negative/bad-catalog-type/test.000.ddl.sqlpp
R asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/negative/bad-source-type/test.000.ddl.sqlpp
R asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/negative/catalog-already-exists/test.000.ddl.sqlpp
R asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/negative/catalog-already-exists/test.001.ddl.sqlpp
R asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/negative/drop-does-not-exist/test.000.ddl.sqlpp
R asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/negative/drop-has-dependent-collections/test.000.ddl.sqlpp
R asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/negative/drop-has-dependent-collections/test.001.ddl.sqlpp
R asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/negative/missing-source-type/test.000.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/results/iceberg/all-data-types/result.020.adm
A asterixdb/asterix-app/src/test/resources/runtimets/results/iceberg/all-data-types/result.030.adm
R asterixdb/asterix-app/src/test/resources/runtimets/results/iceberg/check-catalog-record/result.001.adm
M asterixdb/asterix-app/src/test/resources/runtimets/testsuite_iceberg.xml
M asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/IcebergParquetDataParser.java
27 files changed, 793 insertions(+), 274 deletions(-)



  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/26/21226/1

diff --git a/asterixdb/asterix-app/data/json/iceberg_all_types.json b/asterixdb/asterix-app/data/json/iceberg_all_types.json
new file mode 100644
index 0000000..85ecbc7
--- /dev/null
+++ b/asterixdb/asterix-app/data/json/iceberg_all_types.json
@@ -0,0 +1,40 @@
+{
+  "bool_field": true,
+  "byte_field": 42,
+  "short_field": 1000,
+  "int_field": 42,
+  "long_field": 9223372036854775807,
+  "float_field": 3.14,
+  "double_field": 2.718281828459045,
+  "decimal_field": "12345.6789",
+  "string_field": "hello world",
+  "varchar_field": "varchar value one",
+  "char_field": "Hi",
+  "uuid_field": "550e8400-e29b-41d4-a716-446655440000",
+  "binary_field": "AQIDBAUGBwg=",
+  "fixed_field": "SGVsbG8gV29ybGQ=",
+  "date_field": 19723,
+  "time_field": 37230000000,
+  "timestamp_field": 1707000000000000,
+  "timestamp_ntz_field": "2024-02-04 12:00:00",
+  "timestamp_nano_field": 1707000000000000000,
+  "interval_ym_field": 14,
+  "interval_dt_field": 37230000000,
+  "geometry_field": "AQIDBAUGBwgJCg==",
+  "geography_field": "AQIDBAUGBwgJCg0=",
+  "struct_field": {
+    "name": "Alice",
+    "age": 30,
+    "active": true
+  },
+  "list_field": [
+    "a",
+    "b",
+    "c"
+  ],
+  "map_field": {
+    "key1": "value1",
+    "key2": "100"
+  },"variant_field": "string value",
+  "unknown_field": null
+}
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/api/common/LocalCloudUtilAdobeMock.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/api/common/LocalCloudUtilAdobeMock.java
index 8180942..9b366da 100644
--- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/api/common/LocalCloudUtilAdobeMock.java
+++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/api/common/LocalCloudUtilAdobeMock.java
@@ -19,6 +19,7 @@
 package org.apache.asterix.api.common;
 
 import static org.apache.asterix.api.common.LocalCloudUtil.MOCK_SERVER_REGION;
+import static org.apache.asterix.test.cloud_storage.CloudStorageTest.MOCK_SERVER_HOSTNAME_FRAGMENT;
 
 import java.io.FileReader;
 import java.io.FileWriter;
@@ -54,12 +55,14 @@
 public class LocalCloudUtilAdobeMock {
 
     private static final Logger LOGGER = LogManager.getLogger();
+    private static final String S3MOCK_CONTAINER_NAME = "adobe-s3-mock";
 
     public static final String CLOUD_STORAGE_BUCKET = "cloud-storage-container";
     public static final String S3MOCK_VERSION_TAG = "4.7.0";
     public static final String PLAYGROUND_BUCKET = "playground";
     public static final String CLOUD_URL_KEY = "cloudUrl";
     private static S3MockContainer s3Mock;
+    public static String DOCKER_ADOBE_S3_MOCK_URI;
 
     private LocalCloudUtilAdobeMock() {
         throw new AssertionError("Do not instantiate");
@@ -86,7 +89,8 @@
         }
         // Starting S3 mock server to be used instead of real S3 server
         LOGGER.info("Starting S3 mock server");
-        s3Mock = new S3MockContainer(S3MOCK_VERSION_TAG).withRetainFilesOnExit(!cleanStart);
+        s3Mock = new S3MockContainer(S3MOCK_VERSION_TAG).withRetainFilesOnExit(!cleanStart)
+                .withCreateContainerCmdModifier(cmd -> cmd.withName(S3MOCK_CONTAINER_NAME));
         if (!cleanStart) {
             Path s3MockDataDir = Path.of("target", "s3mock");
             boolean existingData = s3MockDataDir.toFile().exists();
@@ -99,6 +103,7 @@
         }
         s3Mock.start();
         LOGGER.info("S3 mock server started successfully");
+        DOCKER_ADOBE_S3_MOCK_URI = MOCK_SERVER_HOSTNAME_FRAGMENT + s3Mock.getHttpServerPort();
 
         S3ClientBuilder builder = S3Client.builder();
         URI endpoint = URI.create(s3Mock.getHttpEndpoint()); // endpoint pointing to S3 mock server
diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
index 425df54..29aab1b 100644
--- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
+++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
@@ -102,6 +102,7 @@
 import java.util.stream.IntStream;
 import java.util.stream.Stream;
 
+import org.apache.asterix.api.common.LocalCloudUtilAdobeMock;
 import org.apache.asterix.api.http.server.QueryServiceRequestParameters;
 import org.apache.asterix.app.external.IExternalUDFLibrarian;
 import org.apache.asterix.common.api.Duration;
@@ -112,6 +113,7 @@
 import org.apache.asterix.common.utils.Servlets;
 import org.apache.asterix.lang.sqlpp.util.SqlppStatementUtil;
 import org.apache.asterix.runtime.evaluators.common.NumberUtils;
+import org.apache.asterix.test.iceberg.IcebergTest;
 import org.apache.asterix.test.server.ITestServer;
 import org.apache.asterix.test.server.TestServerProvider;
 import org.apache.asterix.testframework.context.TestCaseContext;
@@ -2472,6 +2474,9 @@
         str = str.replace(TENANT_ID_PLACEHOLDER, TENANT_ID_DEFAULT);
         str = replaceExternalEndpoint(str);
 
+        str = str.replace("%NESSIE_SERVER_URI%", IcebergTest.NESSIE_URI);
+        str = str.replace("%DOCKER_S3_CONTAINER%", LocalCloudUtilAdobeMock.DOCKER_ADOBE_S3_MOCK_URI);
+
         return str;
     }
 
diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/iceberg/IcebergTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/iceberg/IcebergTest.java
index 1afc682..4a0b451 100644
--- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/iceberg/IcebergTest.java
+++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/iceberg/IcebergTest.java
@@ -23,44 +23,64 @@
 import static org.apache.asterix.test.cloud_storage.CloudStorageTest.CONFIG_FILE_TEMPLATE;
 import static org.apache.asterix.test.cloud_storage.CloudStorageTest.MOCK_SERVER_HOSTNAME_FRAGMENT;
 import static org.apache.hyracks.util.file.FileUtil.joinPath;
-import static org.apache.iceberg.hadoop.HadoopOutputFile.fromPath;
 import static org.apache.iceberg.types.Types.NestedField.required;
 
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
+import java.math.BigDecimal;
 import java.net.URI;
+import java.nio.ByteBuffer;
 import java.nio.file.Files;
 import java.nio.file.Paths;
+import java.time.LocalDate;
+import java.time.LocalTime;
+import java.time.OffsetDateTime;
+import java.time.ZoneOffset;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Base64;
 import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
 import java.util.List;
-import java.util.zip.GZIPOutputStream;
+import java.util.Map;
+import java.util.UUID;
 
 import org.apache.asterix.api.common.LocalCloudUtilAdobeMock;
 import org.apache.asterix.common.config.GlobalConfig;
-import org.apache.asterix.external.util.aws.s3.S3Constants;
+import org.apache.asterix.external.awsclient.EnsureCloseAWSClientFactory;
+import org.apache.asterix.external.util.aws.AwsConstants;
+import org.apache.asterix.external.util.iceberg.IcebergConstants;
+import org.apache.asterix.external.util.iceberg.IcebergUtils;
+import org.apache.asterix.external.util.iceberg.nessie.NessieUtils;
 import org.apache.asterix.test.common.TestConstants;
 import org.apache.asterix.test.common.TestExecutor;
 import org.apache.asterix.test.runtime.LangExecutionUtil;
 import org.apache.asterix.testframework.context.TestCaseContext;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.Path;
+import org.apache.iceberg.CatalogProperties;
 import org.apache.iceberg.DataFile;
 import org.apache.iceberg.DataFiles;
+import org.apache.iceberg.DeleteFile;
 import org.apache.iceberg.FileFormat;
+import org.apache.iceberg.FileScanTask;
+import org.apache.iceberg.PartitionData;
 import org.apache.iceberg.PartitionSpec;
+import org.apache.iceberg.RowDelta;
 import org.apache.iceberg.Schema;
+import org.apache.iceberg.Snapshot;
 import org.apache.iceberg.Table;
 import org.apache.iceberg.TableProperties;
-import org.apache.iceberg.Tables;
-import org.apache.iceberg.data.GenericAppenderFactory;
+import org.apache.iceberg.aws.AwsProperties;
+import org.apache.iceberg.catalog.Namespace;
+import org.apache.iceberg.catalog.TableIdentifier;
 import org.apache.iceberg.data.GenericRecord;
+import org.apache.iceberg.data.IcebergGenerics;
 import org.apache.iceberg.data.Record;
-import org.apache.iceberg.hadoop.HadoopInputFile;
-import org.apache.iceberg.hadoop.HadoopTables;
+import org.apache.iceberg.data.parquet.GenericParquetWriter;
+import org.apache.iceberg.deletes.EqualityDeleteWriter;
+import org.apache.iceberg.io.CloseableIterable;
 import org.apache.iceberg.io.FileAppender;
-import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
-import org.apache.iceberg.relocated.com.google.common.collect.ImmutableList;
-import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap;
+import org.apache.iceberg.io.OutputFile;
+import org.apache.iceberg.nessie.NessieCatalog;
+import org.apache.iceberg.parquet.Parquet;
 import org.apache.iceberg.types.Types;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
@@ -72,16 +92,18 @@
 import org.junit.runners.MethodSorters;
 import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameters;
+import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.utility.DockerImageName;
 
 import com.adobe.testing.s3mock.testcontainers.S3MockContainer;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
 
 import software.amazon.awssdk.auth.credentials.AnonymousCredentialsProvider;
-import software.amazon.awssdk.core.sync.RequestBody;
 import software.amazon.awssdk.regions.Region;
 import software.amazon.awssdk.services.s3.S3Client;
 import software.amazon.awssdk.services.s3.S3ClientBuilder;
 import software.amazon.awssdk.services.s3.model.CreateBucketRequest;
-import software.amazon.awssdk.services.s3.model.PutObjectRequest;
 
 /**
  * Runs an AWS S3 mock server and test for iceberg catalogs and tables
@@ -89,56 +111,48 @@
 @RunWith(Parameterized.class)
 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
 public class IcebergTest {
-
     private static final Logger LOGGER = LogManager.getLogger();
-
-    private static final String PATH_BASE = joinPath("data");
-    private static final String EXTERNAL_FILTER_DATA_PATH = joinPath(PATH_BASE, "json", "external-filter");
+    private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
 
     private static final String SUITE_TESTS = "testsuite_iceberg.xml";
     private static final String ONLY_TESTS = "testsuite_iceberg_only.xml";
-    static Runnable PREPARE_ICEBERG_TABLE_BUCKET;
 
-    // Client and service endpoint
-    private static S3Client client;
-    private static final int MOCK_SERVER_PORT = 8001;
+    // s3 config
     private static final String MOCK_SERVER_REGION = "us-west-2";
+    private static final String ICEBERG_CONTAINER = "iceberg-container";
+    private static final String ALL_ICEBERG_TYPES_PATH = joinPath("data", "json", "iceberg_all_types.json");
+    private static S3MockContainer s3Mock;
+
+    // Nessie config
+    private static final String NESSIE_CONTAINER_NAME = "iceberg-nessie";
+    private static GenericContainer<?> nessie;
+    private static final DockerImageName NESSIE_IMAGE = DockerImageName.parse("ghcr.io/projectnessie/nessie:0.107.5");
+    private static final int NESSIE_PORT = 19120;
+    public static final String NESSIE_URI = "http://localhost:" + NESSIE_PORT + "/api/v2";
+    public static final String NESSIE_WAREHOUSE = "s3://" + ICEBERG_CONTAINER + "/nessie/warehouse";
+    private static final Namespace NAMESPACE = Namespace.of("my_namespace");
+    private static final TableIdentifier TABLE_ID = TableIdentifier.of(NAMESPACE, "users");
+    private static final TableIdentifier ALL_TYPES_TABLE_ID = TableIdentifier.of(NAMESPACE, "allTypes");
 
     protected TestCaseContext tcCtx;
 
-    public static final String ICEBERG_CONTAINER = "iceberg-improved-container";
-    public static final PutObjectRequest.Builder icebergContainerBuilder =
-            PutObjectRequest.builder().bucket(ICEBERG_CONTAINER);
-
     public IcebergTest(TestCaseContext tcCtx) {
         this.tcCtx = tcCtx;
     }
 
-    // iceberg
-    private static final Schema SCHEMA =
-            new Schema(required(1, "id", Types.IntegerType.get()), required(2, "data", Types.StringType.get()));
-    private static final Configuration CONF = new Configuration();
-
-    private static final String ICEBERG_TABLE_PATH = "s3a://" + ICEBERG_CONTAINER + "/my-table/";
-    private static final String ICEBERG_TABLE_PATH_FORMAT_VERSION_2 =
-            "s3a://" + ICEBERG_CONTAINER + "/my-table-format-version-2/";
-    private static final String ICEBERG_TABLE_PATH_MIXED_DATA_FORMAT =
-            "s3a://" + ICEBERG_CONTAINER + "/my-table-mixed-data-format/";
-
-    private static final String ICEBERG_TABLE_PATH_EMPTY = "s3a://" + ICEBERG_CONTAINER + "/my-table-empty/";
-
-    private static final String ICEBERG_TABLE_PATH_MULTIPLE_DATA_FILES =
-            "s3a://" + ICEBERG_CONTAINER + "/my-table-multiple-data-files/";
-
-    private static final String ICEBERG_TABLE_PATH_MODIFIED_DATA =
-            "s3a://" + ICEBERG_CONTAINER + "/my-table-modified-data/";
-
-    private static S3MockContainer s3Mock;
-
     @BeforeClass
     public static void setUp() throws Exception {
         final TestExecutor testExecutor = new TestExecutor();
+        LOGGER.info("Starting S3 mock and Nessie containers");
         s3Mock = LocalCloudUtilAdobeMock.startS3CloudEnvironment(true);
+        nessie = new GenericContainer<>(NESSIE_IMAGE).withExposedPorts(NESSIE_PORT)
+                .withCreateContainerCmdModifier(cmd -> cmd.withName(NESSIE_CONTAINER_NAME));
+        nessie.setPortBindings(List.of(NESSIE_PORT + ":" + NESSIE_PORT));
+        nessie.start();
+
+        prepareIcebergContainer();
+        prepareIcebergData();
+
         testExecutor.executorId = "cloud";
         testExecutor.stripSubstring = "//DB:";
         fillConfigTemplate(MOCK_SERVER_HOSTNAME_FRAGMENT + s3Mock.getHttpServerPort(), CONFIG_FILE_TEMPLATE,
@@ -147,21 +161,6 @@
                 MOCK_SERVER_HOSTNAME_FRAGMENT + s3Mock.getHttpServerPort());
         LangExecutionUtil.setUp(CONFIG_FILE, testExecutor);
         System.setProperty(GlobalConfig.CONFIG_FILE_PROPERTY, CONFIG_FILE);
-
-        // create the iceberg bucket
-        S3ClientBuilder builder = S3Client.builder();
-        URI endpoint = URI.create(MOCK_SERVER_HOSTNAME_FRAGMENT + s3Mock.getHttpServerPort()); // endpoint pointing to S3 mock server
-        builder.region(Region.of(MOCK_SERVER_REGION)).credentialsProvider(AnonymousCredentialsProvider.create())
-                .endpointOverride(endpoint);
-        S3Client client = builder.build();
-        client.createBucket(CreateBucketRequest.builder().bucket(ICEBERG_CONTAINER).build());
-        client.close();
-    }
-
-    @AfterClass
-    public static void tearDown() throws Exception {
-        LangExecutionUtil.tearDown();
-        LocalCloudUtilAdobeMock.shutdownSilently();
     }
 
     @Parameters(name = "IcebergTest {index}: {0}")
@@ -174,160 +173,401 @@
         LangExecutionUtil.test(tcCtx);
     }
 
-    private static DataFile writeFile(String filename, List<Record> records, String location) throws IOException {
-        Path path = new Path(location, filename);
-        FileFormat fileFormat = FileFormat.fromFileName(filename);
-        Preconditions.checkNotNull(fileFormat, "Cannot determine format for file: %s", filename);
-
-        FileAppender<Record> fileAppender =
-                new GenericAppenderFactory(IcebergTest.SCHEMA).newAppender(fromPath(path, CONF), fileFormat);
-        try (FileAppender<Record> appender = fileAppender) {
-            appender.addAll(records);
-        }
-
-        return DataFiles.builder(PartitionSpec.unpartitioned()).withInputFile(HadoopInputFile.fromPath(path, CONF))
-                .withMetrics(fileAppender.metrics()).build();
+    private static void prepareIcebergContainer() {
+        S3ClientBuilder builder = S3Client.builder();
+        URI endpoint = URI.create(MOCK_SERVER_HOSTNAME_FRAGMENT + s3Mock.getHttpServerPort()); // endpoint pointing to S3 mock server
+        LOGGER.info("Creating bucket {} via mock endpoint {}", ICEBERG_CONTAINER, endpoint);
+        builder.region(Region.of(MOCK_SERVER_REGION)).credentialsProvider(AnonymousCredentialsProvider.create())
+                .endpointOverride(endpoint);
+        S3Client client = builder.build();
+        client.createBucket(CreateBucketRequest.builder().bucket(ICEBERG_CONTAINER).build());
+        LOGGER.info("Created bucket {}", ICEBERG_CONTAINER);
+        client.close();
     }
 
-    private static void prepareIcebergConfiguration() {
-        CONF.set(S3Constants.HADOOP_SERVICE_END_POINT, s3Mock.getHttpEndpoint());
-        // switch to http
-        CONF.set("fs.s3a.connection.ssl.enabled", "false");
-        // forces URL style access which is required by the mock. Overwrites DNS based bucket access scheme.
-        CONF.set("fs.s3a.path.style.access", "true");
-        // Mock server doesn't support concurrency control
-        CONF.set("fs.s3a.change.detection.version.required", "false");
-        CONF.set(S3Constants.HADOOP_ACCESS_KEY_ID, TestConstants.S3_ACCESS_KEY_ID_DEFAULT);
-        CONF.set(S3Constants.HADOOP_SECRET_ACCESS_KEY, TestConstants.S3_SECRET_ACCESS_KEY_DEFAULT);
-    }
-
-    public static void prepareIcebergTableContainer() {
-        prepareIcebergConfiguration();
-        Tables tables = new HadoopTables(CONF);
-
-        // test data
-        Record genericRecord = GenericRecord.create(SCHEMA);
-
-        List<Record> fileFirstSnapshotRecords =
-                ImmutableList.of(genericRecord.copy(ImmutableMap.of("id", 0, "data", "vibrant_mclean")),
-                        genericRecord.copy(ImmutableMap.of("id", 1, "data", "frosty_wilson")),
-                        genericRecord.copy(ImmutableMap.of("id", 2, "data", "serene_kirby")));
-
-        List<Record> fileSecondSnapshotRecords =
-                ImmutableList.of(genericRecord.copy(ImmutableMap.of("id", 3, "data", "peaceful_pare")),
-                        genericRecord.copy(ImmutableMap.of("id", 4, "data", "laughing_mahavira")),
-                        genericRecord.copy(ImmutableMap.of("id", 5, "data", "vibrant_lamport")));
-
-        // create the table
-        Table table = tables.create(SCHEMA, PartitionSpec.unpartitioned(),
-                ImmutableMap.of(TableProperties.DEFAULT_FILE_FORMAT, FileFormat.PARQUET.name()), ICEBERG_TABLE_PATH);
-
-        // load test data
-        try {
-            DataFile file = writeFile(FileFormat.PARQUET.addExtension("file"), fileFirstSnapshotRecords,
-                    IcebergTest.ICEBERG_TABLE_PATH);
-            table.newAppend().appendFile(file).commit();
-        } catch (IOException e) {
-            throw new RuntimeException(e);
-        }
-
-        // create a table with unsupported iceberg version
-        Table unsupportedTable = tables.create(SCHEMA,
-                PartitionSpec.unpartitioned(), ImmutableMap.of(TableProperties.DEFAULT_FILE_FORMAT,
-                        FileFormat.PARQUET.name(), TableProperties.FORMAT_VERSION, "2"),
-                ICEBERG_TABLE_PATH_FORMAT_VERSION_2);
-
-        // load test data
-        try {
-            DataFile file = writeFile(FileFormat.PARQUET.addExtension("file"), fileFirstSnapshotRecords,
-                    IcebergTest.ICEBERG_TABLE_PATH_FORMAT_VERSION_2);
-            unsupportedTable.newAppend().appendFile(file).commit();
-        } catch (IOException e) {
-            throw new RuntimeException(e);
-        }
-
-        // create a table with mix of parquet and avro data files
-        Table mixedDataFormats = tables.create(SCHEMA, PartitionSpec.unpartitioned(),
-                ImmutableMap.of(TableProperties.DEFAULT_FILE_FORMAT, FileFormat.PARQUET.name()),
-                ICEBERG_TABLE_PATH_MIXED_DATA_FORMAT);
-
-        // load test data
-        try {
-            DataFile parquetFile = writeFile(FileFormat.PARQUET.addExtension("parquet-file"), fileFirstSnapshotRecords,
-                    IcebergTest.ICEBERG_TABLE_PATH_MIXED_DATA_FORMAT);
-            DataFile avroFile = writeFile(FileFormat.AVRO.addExtension("avro-file"), fileSecondSnapshotRecords,
-                    IcebergTest.ICEBERG_TABLE_PATH_MIXED_DATA_FORMAT);
-
-            mixedDataFormats.newAppend().appendFile(parquetFile).appendFile(avroFile).commit();
-        } catch (IOException e) {
-            throw new RuntimeException(e);
-        }
-
-        // empty table
-        tables.create(SCHEMA, PartitionSpec.unpartitioned(),
-                ImmutableMap.of(TableProperties.DEFAULT_FILE_FORMAT, FileFormat.PARQUET.name()),
-                ICEBERG_TABLE_PATH_EMPTY);
-
-        // multiple data files
-
-        Table multipleDataFiles = tables.create(SCHEMA, PartitionSpec.unpartitioned(),
-                ImmutableMap.of(TableProperties.DEFAULT_FILE_FORMAT, FileFormat.PARQUET.name()),
-                ICEBERG_TABLE_PATH_MULTIPLE_DATA_FILES);
-
-        // load test data
-        try {
-            DataFile file1 = writeFile(FileFormat.PARQUET.addExtension("file-1"), fileFirstSnapshotRecords,
-                    IcebergTest.ICEBERG_TABLE_PATH_MULTIPLE_DATA_FILES);
-            DataFile file2 = writeFile(FileFormat.PARQUET.addExtension("file-2"), fileSecondSnapshotRecords,
-                    IcebergTest.ICEBERG_TABLE_PATH_MULTIPLE_DATA_FILES);
-
-            multipleDataFiles.newAppend().appendFile(file1).appendFile(file2).commit();
-        } catch (IOException e) {
-            throw new RuntimeException(e);
-        }
-
-        // modify data
-        Table modifiedData = tables.create(SCHEMA, PartitionSpec.unpartitioned(),
-                ImmutableMap.of(TableProperties.DEFAULT_FILE_FORMAT, FileFormat.PARQUET.name()),
-                ICEBERG_TABLE_PATH_MODIFIED_DATA);
-
-        // load test data
-        try {
-            DataFile file1 = writeFile(FileFormat.PARQUET.addExtension("file-1"), fileFirstSnapshotRecords,
-                    IcebergTest.ICEBERG_TABLE_PATH_MODIFIED_DATA);
-            DataFile file2 = writeFile(FileFormat.PARQUET.addExtension("file-2"), fileSecondSnapshotRecords,
-                    IcebergTest.ICEBERG_TABLE_PATH_MODIFIED_DATA);
-
-            modifiedData.newAppend().appendFile(file1).appendFile(file2).commit();
-            modifiedData.newDelete().deleteFile(file1).commit();
-
-        } catch (IOException e) {
-            throw new RuntimeException(e);
+    private static void prepareIcebergData() throws Exception {
+        LOGGER.info("[START] IcebergTest running…");
+        try (org.apache.iceberg.nessie.NessieCatalog catalog = createNessieCatalog()) {
+            ensureNamespace(catalog, NAMESPACE);
+            writeUserTable(catalog);
+            writeAllTypesTable(catalog);
         }
     }
 
-    private static RequestBody getRequestBody(String content, boolean fromFile, boolean gzipped) {
-        RequestBody body;
-        // Content is string
-        if (!fromFile) {
-            body = RequestBody.fromString(content);
-        } else {
-            // Content is a file path
-            if (!gzipped) {
-                body = RequestBody.fromFile(Paths.get(content));
-            } else {
-                try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
-                        GZIPOutputStream gzipOutputStream = new GZIPOutputStream(byteArrayOutputStream)) {
-                    gzipOutputStream.write(Files.readAllBytes(Paths.get(content)));
-                    gzipOutputStream.close(); // Need to close or data will be invalid
-                    byte[] gzipBytes = byteArrayOutputStream.toByteArray();
-                    body = RequestBody.fromBytes(gzipBytes);
-                } catch (IOException ex) {
-                    throw new IllegalArgumentException(ex.toString());
-                }
+    private static void writeUserTable(org.apache.iceberg.nessie.NessieCatalog catalog) throws Exception {
+        Schema schemaV1 = buildSchemaV1();
+        PartitionSpec spec = buildPartitionSpec(schemaV1);
+        Table table = createTable(catalog, TABLE_ID, schemaV1, spec);
+
+        LOGGER.info("[TABLE] name={}", table.name());
+        LOGGER.info("[TABLE] location={}", table.location());
+        LOGGER.info("[TABLE] spec={}", table.spec());
+        LOGGER.info("[TABLE] schema(v1)={}", table.schema());
+        GenericRecord templateV1 = GenericRecord.create(table.schema());
+        long snap1 = writeSnapshot(table, templateV1, 1, 800);
+        evolveSchemaAddColumn(table);
+        LOGGER.info("[SCHEMA EVOLUTION] schema(now)={}", table.schema());
+        GenericRecord templateV2 = GenericRecord.create(table.schema());
+        long snap2 = writeSnapshot(table, templateV2, 801, 1000);
+
+        LOGGER.info("[DELETE] Committing equality deletes for ids=[10, 20, 30]");
+        int[] idsToDelete = { 10, 20, 30 };
+        RowDelta delta = table.newRowDelta();
+        for (int idToDelete : idsToDelete) {
+            String country = countryForId(idToDelete);
+            LOGGER.info("[DELETE] Writing equality delete for id={} (partition country={})", idToDelete, country);
+            DeleteFile deleteFile = writePartitionedEqualityDelete(table, templateV2, idToDelete, country);
+            delta.addDeletes(deleteFile);
+        }
+        delta.commit();
+
+        long snap3 = table.currentSnapshot().snapshotId();
+        LOGGER.info("[DELETE] Committed RowDelta snapshotId={} snapshotTimestamp={}", snap3,
+                table.currentSnapshot().timestampMillis());
+        printSnapshotSummary(table);
+        validateCountsWithIceberg(table);
+        LOGGER.info("[FINISH] snapshots: snap1={}, snap2={}, snap3={}", snap1, snap2, snap3);
+    }
+
+    private static void writeAllTypesTable(NessieCatalog catalog) throws Exception {
+        Table allTypesTable =
+                createTable(catalog, ALL_TYPES_TABLE_ID, buildAllTypesSchema(), PartitionSpec.unpartitioned());
+        LOGGER.info("[TABLE] name={}", allTypesTable.name());
+        LOGGER.info("[TABLE] location={}", allTypesTable.location());
+        LOGGER.info("[TABLE] spec={}", allTypesTable.spec());
+        LOGGER.info("[TABLE] schema(all_types)={}", allTypesTable.schema());
+        writeAllTypesData(allTypesTable);
+    }
+
+    private static org.apache.iceberg.nessie.NessieCatalog createNessieCatalog() throws Exception {
+        LOGGER.info("[CATALOG] Initializing Nessie catalog at {}", NESSIE_URI);
+        Map<String, String> properties = new HashMap<>();
+        properties.put(IcebergConstants.ICEBERG_SOURCE_PROPERTY_KEY, "NESSIE");
+        properties.put(CatalogProperties.CATALOG_IMPL, org.apache.iceberg.nessie.NessieCatalog.class.getName());
+        properties.put("uri", NESSIE_URI);
+        properties.put("warehouse", NESSIE_WAREHOUSE);
+        properties.put(CatalogProperties.FILE_IO_IMPL, IcebergConstants.Aws.S3_FILE_IO);
+        properties.put(AwsProperties.CLIENT_FACTORY, EnsureCloseAWSClientFactory.class.getName());
+        properties.put(IcebergConstants.ICEBERG_COLLECTION_PROPERTY_PREFIX_INTERNAL
+                + AwsConstants.SERVICE_END_POINT_FIELD_NAME, s3Mock.getHttpEndpoint());
+        properties.put(IcebergConstants.ICEBERG_COLLECTION_PROPERTY_PREFIX_INTERNAL + AwsConstants.REGION_FIELD_NAME,
+                MOCK_SERVER_REGION);
+        properties.put(IcebergConstants.ICEBERG_COLLECTION_PROPERTY_PREFIX_INTERNAL + "pathStyleAddressing", "true");
+        properties.put(
+                IcebergConstants.ICEBERG_COLLECTION_PROPERTY_PREFIX_INTERNAL + AwsConstants.ACCESS_KEY_ID_FIELD_NAME,
+                TestConstants.S3_ACCESS_KEY_ID_DEFAULT);
+        properties.put(IcebergConstants.ICEBERG_COLLECTION_PROPERTY_PREFIX_INTERNAL
+                + AwsConstants.SECRET_ACCESS_KEY_FIELD_NAME, TestConstants.S3_SECRET_ACCESS_KEY_DEFAULT);
+        NessieUtils.setNessieCatalogProperties(properties);
+        org.apache.iceberg.nessie.NessieCatalog catalog =
+                (org.apache.iceberg.nessie.NessieCatalog) IcebergUtils.initializeCatalogOnly(properties);
+        LOGGER.info("[CATALOG] Initialized Nessie catalog");
+        return catalog;
+    }
+
+    private static Schema buildSchemaV1() {
+        return new Schema(required(1, "id", Types.IntegerType.get()),
+                Types.NestedField.optional(2, "name", Types.StringType.get()),
+                Types.NestedField.optional(3, "country", Types.StringType.get()),
+                Types.NestedField.optional(4, "booleanValue", Types.BooleanType.get()),
+                Types.NestedField.optional(5, "longValue", Types.LongType.get()),
+                Types.NestedField.optional(6, "floatValue", Types.FloatType.get()),
+                Types.NestedField.optional(7, "doubleValue", Types.DoubleType.get()),
+                Types.NestedField.optional(8, "price", Types.DecimalType.of(20, 5)),
+                Types.NestedField.optional(9, "info_struct",
+                        Types.StructType.of(Types.NestedField.required(201, "x", Types.IntegerType.get()),
+                                Types.NestedField.optional(202, "y", Types.StringType.get()))),
+                Types.NestedField.optional(10, "tags", Types.ListType.ofOptional(301, Types.StringType.get())),
+                Types.NestedField.optional(11, "metrics",
+                        Types.MapType.ofOptional(401, 402, Types.StringType.get(), Types.IntegerType.get())),
+                Types.NestedField.optional(12, "uuidValue", Types.UUIDType.get()),
+                Types.NestedField.optional(13, "fixed16", Types.FixedType.ofLength(16)),
+                Types.NestedField.optional(14, "binary_value", Types.BinaryType.get()),
+                Types.NestedField.optional(15, "event_date", Types.DateType.get()),
+                Types.NestedField.optional(16, "event_time", Types.TimeType.get()));
+    }
+
+    private static Schema buildAllTypesSchema() {
+        return new Schema(Types.NestedField.optional(1, "bool_field", Types.BooleanType.get()),
+                Types.NestedField.optional(2, "byte_field", Types.IntegerType.get()),
+                Types.NestedField.optional(3, "short_field", Types.IntegerType.get()),
+                Types.NestedField.optional(4, "int_field", Types.IntegerType.get()),
+                Types.NestedField.optional(5, "long_field", Types.LongType.get()),
+                Types.NestedField.optional(6, "float_field", Types.FloatType.get()),
+                Types.NestedField.optional(7, "double_field", Types.DoubleType.get()),
+                Types.NestedField.optional(8, "decimal_field", Types.DecimalType.of(10, 4)),
+                Types.NestedField.optional(9, "string_field", Types.StringType.get()),
+                Types.NestedField.optional(10, "varchar_field", Types.StringType.get()),
+                Types.NestedField.optional(11, "char_field", Types.StringType.get()),
+                Types.NestedField.optional(12, "uuid_field", Types.UUIDType.get()),
+                Types.NestedField.optional(13, "binary_field", Types.BinaryType.get()),
+                Types.NestedField.optional(14, "fixed_field", Types.FixedType.ofLength(11)),
+                Types.NestedField.optional(15, "date_field", Types.DateType.get()),
+                Types.NestedField.optional(16, "time_field", Types.TimeType.get()),
+                Types.NestedField.optional(17, "timestamp_field", Types.TimestampType.withZone()),
+                Types.NestedField.optional(18, "timestamp_ntz_field", Types.TimestampType.withoutZone()),
+                Types.NestedField.optional(19, "timestamp_nano_field", Types.TimestampNanoType.withZone()),
+                Types.NestedField.optional(20, "interval_ym_field", Types.IntegerType.get()),
+                Types.NestedField.optional(21, "interval_dt_field", Types.LongType.get()),
+                Types.NestedField.optional(22, "geometry_field", Types.BinaryType.get()),
+                Types.NestedField.optional(23, "geography_field", Types.BinaryType.get()),
+                Types.NestedField.optional(24, "struct_field",
+                        Types.StructType.of(Types.NestedField.optional(241, "name", Types.StringType.get()),
+                                Types.NestedField.optional(242, "age", Types.IntegerType.get()),
+                                Types.NestedField.optional(243, "active", Types.BooleanType.get()))),
+                Types.NestedField.optional(25, "list_field", Types.ListType.ofOptional(251, Types.StringType.get())),
+                Types.NestedField.optional(26, "map_field",
+                        Types.MapType.ofOptional(261, 262, Types.StringType.get(), Types.StringType.get())),
+                Types.NestedField.optional(27, "variant_field", Types.StringType.get()),
+                Types.NestedField.optional(28, "unknown_field", Types.StringType.get()));
+    }
+
+    private static PartitionSpec buildPartitionSpec(Schema schema) {
+        return PartitionSpec.builderFor(schema).identity("country").build();
+    }
+
+    private static Table createTable(org.apache.iceberg.nessie.NessieCatalog catalog, TableIdentifier id, Schema schema,
+            PartitionSpec spec) {
+        LOGGER.info("[CREATE] Creating table {} (format v3) ...", id);
+        return catalog.buildTable(id, schema).withPartitionSpec(spec).withProperty(TableProperties.FORMAT_VERSION, "3")
+                .create();
+    }
+
+    private static long writeSnapshot(Table table, GenericRecord template, int start, int end) throws Exception {
+        Map<String, List<Record>> groups = groupRowsByCountry(table, template, start, end);
+        int fileIndex = 0;
+        int totalRows = 0;
+        LOGGER.info("[SNAPSHOT] Writing rows {} → {}", start, end);
+        for (Map.Entry<String, List<Record>> entry : groups.entrySet()) {
+            String country = entry.getKey();
+            List<Record> rows = entry.getValue();
+            totalRows += rows.size();
+            PartitionData pd = partition(table, country);
+            String path = table.location() + "/data/" + start + "_" + end + "_p" + (fileIndex++) + ".parquet";
+            DataFile df = writeDataFile(table, rows, path, pd);
+            table.newAppend().appendFile(df).commit();
+            Snapshot snap = table.currentSnapshot();
+            LOGGER.info("[APPEND] snapshotId={} snapshotTimestamp={} country={} rows={} file={} sizeBytes={}",
+                    snap.snapshotId(), snap.timestampMillis(), country, rows.size(), df.path(), df.fileSizeInBytes());
+        }
+        LOGGER.info("[SNAPSHOT] Done. snapshotId={} totalRows={}", table.currentSnapshot().snapshotId(), totalRows);
+        return table.currentSnapshot().snapshotId();
+    }
+
+    private static Map<String, List<Record>> groupRowsByCountry(Table table, GenericRecord template, int start,
+            int end) {
+        Map<String, List<Record>> groups = new HashMap<>();
+        OffsetDateTime base = OffsetDateTime.now(ZoneOffset.UTC);
+        for (int i = start; i <= end; i++) {
+            Record row = generateRow(table, i, template, base);
+            String country = (String) row.getField("country");
+            groups.computeIfAbsent(country, k -> new ArrayList<>()).add(row);
+        }
+        for (Map.Entry<String, List<Record>> entry : groups.entrySet()) {
+            LOGGER.info("[GROUP] country={} rows={}", entry.getKey(), entry.getValue().size());
+        }
+        return groups;
+    }
+
+    private static Record generateRow(Table table, int i, GenericRecord template, OffsetDateTime baseTs) {
+        Record r = template.copy();
+        r.setField("id", i);
+        r.setField("name", "User" + i);
+        r.setField("country", countryForId(i));
+        r.setField("event_date", LocalDate.now());
+        r.setField("event_time", LocalTime.now());
+        r.setField("booleanValue", i % 2 == 0);
+        r.setField("longValue", i * 1000L);
+        r.setField("floatValue", i * 0.1f);
+        r.setField("doubleValue", i * 0.12345d);
+        r.setField("uuidValue", UUID.randomUUID());
+        r.setField("fixed16", new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 });
+        r.setField("binary_value", ByteBuffer.wrap(new byte[] { 1, 2, 3, 4 }));
+        r.setField("price", new BigDecimal("123.45600"));
+        GenericRecord struct =
+                GenericRecord.create(((Types.StructType) table.schema().findField("info_struct").type()));
+        struct.setField("x", i);
+        struct.setField("y", "value-" + i);
+        r.setField("info_struct", struct);
+        r.setField("tags", Arrays.asList("tag1", "tag" + i));
+        Map<String, Integer> metrics = new HashMap<>();
+        metrics.put("count", i);
+        metrics.put("val", i * 2);
+        r.setField("metrics", metrics);
+        return r;
+    }
+
+    private static DataFile writeDataFile(Table table, List<Record> rows, String path, PartitionData pd)
+            throws Exception {
+        OutputFile out = table.io().newOutputFile(path);
+        DataFile dataFile;
+        try (FileAppender<Record> writer =
+                Parquet.write(out).schema(table.schema()).createWriterFunc(GenericParquetWriter::create).build()) {
+            for (Record r : rows) {
+                writer.add(r);
             }
         }
+        long bytes = out.toInputFile().getLength();
+        LOGGER.info("[APPEND] file={} sizeBytes={} rows={}", path, bytes, rows.size());
+        dataFile = DataFiles.builder(table.spec()).withPath(path).withPartition(pd).withRecordCount(rows.size())
+                .withFileSizeInBytes(bytes).withFormat(FileFormat.PARQUET).build();
+        return dataFile;
+    }
 
-        return body;
+    private static DeleteFile writePartitionedEqualityDelete(Table table, GenericRecord template, int idToDelete,
+            String country) throws Exception {
+        PartitionData pd = partition(table, country);
+        String delPath = table.location() + "/deletes/delete-eq-" + idToDelete + ".parquet";
+        OutputFile delOut = table.io().newOutputFile(delPath);
+        EqualityDeleteWriter<Record> delWriter = Parquet.writeDeletes(delOut).forTable(table).rowSchema(table.schema())
+                .withSpec(table.spec()).withPartition(pd).equalityFieldIds(Collections.singletonList(1))
+                .createWriterFunc(GenericParquetWriter::create).buildEqualityWriter();
+        try (delWriter) {
+            Record d = template.copy();
+            d.setField("id", idToDelete);
+            delWriter.write(d);
+        }
+        DeleteFile deleteFile = delWriter.toDeleteFile();
+        LOGGER.info("[DELETE FILE] location={}", deleteFile.location());
+        LOGGER.info("[DELETE FILE] content={}", deleteFile.content());
+        LOGGER.info("[DELETE FILE] specId={}", deleteFile.specId());
+        LOGGER.info("[DELETE FILE] partition={}", deleteFile.partition());
+        LOGGER.info("[DELETE FILE] recordCount={}", deleteFile.recordCount());
+        LOGGER.info("[DELETE FILE] equalityFieldIds={}", deleteFile.equalityFieldIds());
+        return deleteFile;
+    }
+
+    private static PartitionData partition(Table table, String country) {
+        PartitionData pd = new PartitionData(table.spec().partitionType());
+        pd.set(0, country);
+        return pd;
+    }
+
+    private static String countryForId(int id) {
+        String[] countries = { "US", "UK", "DE", "FR", "SA", "JP" };
+        return countries[id % countries.length];
+    }
+
+    private static void evolveSchemaAddColumn(Table table) {
+        LOGGER.info("[SCHEMA EVOLUTION] Adding optional column: evolved_note (string)");
+        table.updateSchema().addColumn("evolved_note", Types.StringType.get()).commit();
+    }
+
+    private static void writeAllTypesData(Table table) throws Exception {
+        LOGGER.info("[WRITE] Writing all_types data from {}", ALL_ICEBERG_TYPES_PATH);
+        String json = Files.readString(Paths.get(ALL_ICEBERG_TYPES_PATH));
+        JsonNode row = OBJECT_MAPPER.readTree(json);
+        GenericRecord template = GenericRecord.create(table.schema());
+        List<Record> records = new ArrayList<>();
+        Record record = template.copy();
+        record.setField("bool_field", row.get("bool_field").asBoolean());
+        record.setField("byte_field", row.get("byte_field").asInt());
+        record.setField("short_field", row.get("short_field").asInt());
+        record.setField("int_field", row.get("int_field").asInt());
+        record.setField("long_field", row.get("long_field").asLong());
+        record.setField("float_field", (float) row.get("float_field").asDouble());
+        record.setField("double_field", row.get("double_field").asDouble());
+        record.setField("decimal_field", new BigDecimal(row.get("decimal_field").asText()));
+        record.setField("string_field", row.get("string_field").asText());
+        record.setField("varchar_field", row.get("varchar_field").asText());
+        record.setField("char_field", row.get("char_field").asText());
+        record.setField("uuid_field", UUID.fromString(row.get("uuid_field").asText()));
+        record.setField("binary_field", ByteBuffer.wrap(Base64.getDecoder().decode(row.get("binary_field").asText())));
+        record.setField("fixed_field", Base64.getDecoder().decode(row.get("fixed_field").asText()));
+        record.setField("date_field", LocalDate.ofEpochDay(row.get("date_field").asInt()));
+        record.setField("time_field", LocalTime.ofNanoOfDay(row.get("time_field").asLong() * 1000));
+        record.setField("timestamp_field", OffsetDateTime
+                .ofInstant(java.time.Instant.ofEpochMilli(row.get("timestamp_field").asLong() / 1000), ZoneOffset.UTC));
+        record.setField("timestamp_ntz_field", java.time.LocalDateTime.parse(row.get("timestamp_ntz_field").asText(),
+                java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+        record.setField("timestamp_nano_field", OffsetDateTime.ofInstant(
+                java.time.Instant.ofEpochSecond(0, row.get("timestamp_nano_field").asLong()), ZoneOffset.UTC));
+        record.setField("interval_ym_field", row.get("interval_ym_field").asInt());
+        record.setField("interval_dt_field", row.get("interval_dt_field").asLong());
+        record.setField("geometry_field",
+                ByteBuffer.wrap(Base64.getDecoder().decode(row.get("geometry_field").asText())));
+        record.setField("geography_field",
+                ByteBuffer.wrap(Base64.getDecoder().decode(row.get("geography_field").asText())));
+
+        GenericRecord struct =
+                GenericRecord.create(((Types.StructType) table.schema().findField("struct_field").type()));
+        struct.setField("name", row.get("struct_field").get("name").asText());
+        struct.setField("age", row.get("struct_field").get("age").asInt());
+        struct.setField("active", row.get("struct_field").get("active").asBoolean());
+        record.setField("struct_field", struct);
+
+        record.setField("list_field", Arrays.asList(row.get("list_field").get(0).asText(),
+                row.get("list_field").get(1).asText(), row.get("list_field").get(2).asText()));
+        Map<String, String> mapValues = new HashMap<>();
+        mapValues.put("key1", row.get("map_field").get("key1").asText());
+        mapValues.put("key2", row.get("map_field").get("key2").asText());
+        record.setField("map_field", mapValues);
+        record.setField("variant_field", row.get("variant_field").asText());
+        record.setField("unknown_field", row.get("unknown_field").isNull() ? null : row.get("unknown_field").asText());
+        records.add(record);
+        String path = table.location() + "/data/all_types.parquet";
+        OutputFile out = table.io().newOutputFile(path);
+        try (FileAppender<Record> writer =
+                Parquet.write(out).schema(table.schema()).createWriterFunc(GenericParquetWriter::create).build()) {
+            for (Record r : records) {
+                writer.add(r);
+            }
+        }
+        long bytes = out.toInputFile().getLength();
+        LOGGER.info("[APPEND] file={} sizeBytes={} rows={}", path, bytes, records.size());
+        DataFile df = DataFiles.builder(table.spec()).withPath(path).withRecordCount(records.size())
+                .withFileSizeInBytes(bytes).withFormat(FileFormat.PARQUET).build();
+        table.newAppend().appendFile(df).commit();
+        LOGGER.info("[WRITE] all_types table committed with {} record(s)", records.size());
+    }
+
+    private static void printSnapshotSummary(Table table) {
+        LOGGER.info("[SNAPSHOT SUMMARY]");
+        Snapshot snap = table.currentSnapshot();
+        LOGGER.info("currentSnapshotId={}", snap.snapshotId());
+        LOGGER.info("schema={}", table.schema());
+        LOGGER.info("spec={}", table.spec());
+        LOGGER.info("plannedDataFiles={}", countFiles(table));
+    }
+
+    private static int countFiles(Table table) {
+        int count = 0;
+        for (FileScanTask ignored : table.newScan().planFiles()) {
+            count++;
+        }
+        return count;
+    }
+
+    private static void validateCountsWithIceberg(Table table) throws Exception {
+        long count = 0;
+        try (CloseableIterable<Record> it = IcebergGenerics.read(table).build()) {
+            for (Record r : it) {
+                count++;
+            }
+        }
+        LOGGER.info("[VALIDATION] IcebergGenerics.read(table) rowCount={} (expected 997)", count);
+    }
+
+    private static void ensureNamespace(org.apache.iceberg.nessie.NessieCatalog catalog, Namespace namespace) {
+        String[] levels = namespace.levels();
+        for (int i = 1; i <= levels.length; i++) {
+            Namespace current = Namespace.of(Arrays.copyOf(levels, i));
+            if (!catalog.namespaceExists(current)) {
+                catalog.createNamespace(current);
+                LOGGER.info("[INIT] Namespace created: {}", current);
+            } else {
+                LOGGER.info("[INIT] Namespace already exists: {}", current);
+            }
+        }
+    }
+
+    @AfterClass
+    public static void tearDown() throws Exception {
+        LangExecutionUtil.tearDown();
+        if (nessie != null) {
+            nessie.stop();
+            nessie = null;
+        }
+        LocalCloudUtilAdobeMock.shutdownSilently();
     }
 }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/all-data-types/test.000.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/all-data-types/test.000.ddl.sqlpp
new file mode 100644
index 0000000..e4a3976
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/all-data-types/test.000.ddl.sqlpp
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+CREATE CATALOG myNessieCatalog
+TYPE Iceberg
+SOURCE NESSIE
+WITH {
+    "uri": "%NESSIE_SERVER_URI%",
+    "warehouse": "s3://iceberg-container/nessie/warehouse"
+};
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/all-data-types/test.010.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/all-data-types/test.010.ddl.sqlpp
new file mode 100644
index 0000000..b434ebb
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/all-data-types/test.010.ddl.sqlpp
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+DROP COLLECTION allTypesTimesConverted IF EXISTS;
+DROP TYPE allTypesTimesConverted IF EXISTS;
+
+CREATE TYPE allTypesTimesConverted AS open {};
+CREATE EXTERNAL COLLECTION allTypesTimesConverted(allTypesTimesConverted)
+USING S3
+(
+    ("table-format"="iceberg"),
+    ("namespace"="my_namespace"),
+    ("tableName"="allTypes"),
+    ("region"="custom-region"),
+    ("serviceEndpoint"="%DOCKER_S3_CONTAINER%"),
+    ("pathStyleAddressing"="true"),
+    ("catalogName"="myNessieCatalog"),
+    ("format"="parquet"),
+    ("decimal-to-double"="true"),
+    ("date-to-int"="true"),
+    ("time-to-int"="true"),
+    ("timestamp-to-long"="true")
+);
+
+DROP COLLECTION allTypesTimesNotConverted IF EXISTS;
+DROP TYPE allTypesTimesNotConverted IF EXISTS;
+
+CREATE TYPE allTypesTimesNotConverted AS open {};
+CREATE EXTERNAL COLLECTION allTypesTimesNotConverted(allTypesTimesNotConverted)
+USING S3
+(
+    ("table-format"="iceberg"),
+    ("namespace"="my_namespace"),
+    ("tableName"="allTypes"),
+    ("region"="custom-region"),
+    ("serviceEndpoint"="%DOCKER_S3_CONTAINER%"),
+    ("pathStyleAddressing"="true"),
+    ("catalogName"="myNessieCatalog"),
+    ("format"="parquet"),
+    ("decimal-to-double"="true"),
+    ("date-to-int"="false"),
+    ("time-to-int"="false"),
+    ("timestamp-to-long"="false")
+);
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/all-data-types/test.020.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/all-data-types/test.020.query.sqlpp
new file mode 100644
index 0000000..a1f2e38
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/all-data-types/test.020.query.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+SELECT
+    bool_field,
+    byte_field,
+    short_field,
+    int_field,
+    long_field,
+    float_field,
+    double_field,
+    decimal_field,
+    string_field,
+    varchar_field,
+    char_field,
+    uuid_field,
+    print_binary(binary_field, "base64") as binary_field,
+    print_binary(fixed_field, "base64") as fixed_field,
+    date_field,
+    time_field,
+    timestamp_field,
+    timestamp_ntz_field,
+    timestamp_nano_field,
+    interval_ym_field,
+    interval_dt_field,
+    print_binary(geometry_field, "base64") as geometry_field,
+    print_binary(geography_field, "base64") as geography_field,
+    struct_field,
+    list_field,
+    map_field,
+    variant_field,
+    unknown_field
+FROM allTypesTimesConverted;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/all-data-types/test.030.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/all-data-types/test.030.query.sqlpp
new file mode 100644
index 0000000..99cf020
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/all-data-types/test.030.query.sqlpp
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+SELECT
+    bool_field,
+    byte_field,
+    short_field,
+    int_field,
+    long_field,
+    float_field,
+    double_field,
+    decimal_field,
+    string_field,
+    varchar_field,
+    char_field,
+    uuid_field,
+    print_binary(binary_field, "base64") as binary_field,
+    print_binary(fixed_field, "base64") as fixed_field,
+    date_field,
+    time_field,
+    timestamp_field,
+    timestamp_ntz_field,
+    timestamp_nano_field,
+    interval_ym_field,
+    interval_dt_field,
+    print_binary(geometry_field, "base64") as geometry_field,
+    print_binary(geography_field, "base64") as geography_field,
+    struct_field,
+    list_field,
+    map_field,
+    variant_field,
+    unknown_field
+FROM allTypesTimesNotConverted;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/all-data-types/test.999.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/all-data-types/test.999.ddl.sqlpp
new file mode 100644
index 0000000..50c1449
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/all-data-types/test.999.ddl.sqlpp
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+//DROP COLLECTION allTypes;
+//DROP TYPE allTypes;
+//DROP CATALOG myNessieCatalog;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/catalog/all-supported-types/test.000.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/all-supported-catalog-types/test.000.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/catalog/all-supported-types/test.000.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/all-supported-catalog-types/test.000.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/catalog/all-supported-types/test.001.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/all-supported-catalog-types/test.001.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/catalog/all-supported-types/test.001.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/all-supported-catalog-types/test.001.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/catalog/check-catalog-record/test.000.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/check-catalog-record/test.000.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/catalog/check-catalog-record/test.000.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/check-catalog-record/test.000.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/catalog/check-catalog-record/test.001.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/check-catalog-record/test.001.query.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/catalog/check-catalog-record/test.001.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/check-catalog-record/test.001.query.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/catalog/check-catalog-record/test.002.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/check-catalog-record/test.002.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/catalog/check-catalog-record/test.002.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/check-catalog-record/test.002.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/catalog/negative/bad-catalog-type/test.000.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/negative/bad-catalog-type/test.000.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/catalog/negative/bad-catalog-type/test.000.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/negative/bad-catalog-type/test.000.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/catalog/negative/bad-source-type/test.000.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/negative/bad-source-type/test.000.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/catalog/negative/bad-source-type/test.000.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/negative/bad-source-type/test.000.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/catalog/negative/catalog-already-exists/test.000.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/negative/catalog-already-exists/test.000.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/catalog/negative/catalog-already-exists/test.000.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/negative/catalog-already-exists/test.000.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/catalog/negative/catalog-already-exists/test.001.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/negative/catalog-already-exists/test.001.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/catalog/negative/catalog-already-exists/test.001.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/negative/catalog-already-exists/test.001.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/catalog/negative/drop-does-not-exist/test.000.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/negative/drop-does-not-exist/test.000.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/catalog/negative/drop-does-not-exist/test.000.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/negative/drop-does-not-exist/test.000.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/catalog/negative/drop-has-dependent-collections/test.000.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/negative/drop-has-dependent-collections/test.000.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/catalog/negative/drop-has-dependent-collections/test.000.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/negative/drop-has-dependent-collections/test.000.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/catalog/negative/drop-has-dependent-collections/test.001.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/negative/drop-has-dependent-collections/test.001.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/catalog/negative/drop-has-dependent-collections/test.001.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/negative/drop-has-dependent-collections/test.001.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/catalog/negative/missing-source-type/test.000.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/negative/missing-source-type/test.000.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/catalog/negative/missing-source-type/test.000.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/iceberg/negative/missing-source-type/test.000.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/iceberg/all-data-types/result.020.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/iceberg/all-data-types/result.020.adm
new file mode 100644
index 0000000..2835651
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/iceberg/all-data-types/result.020.adm
@@ -0,0 +1 @@
+{ "binary_field": "AQIDBAUGBwg=", "fixed_field": "SGVsbG8gV29ybGQ=", "geometry_field": "AQIDBAUGBwgJCg==", "geography_field": "AQIDBAUGBwgJCg0=", "bool_field": true, "byte_field": 42, "short_field": 1000, "int_field": 42, "long_field": 9223372036854775807, "float_field": 3.14, "double_field": 2.718281828459045, "decimal_field": 12345.6789, "string_field": "hello world", "varchar_field": "varchar value one", "char_field": "Hi", "uuid_field": uuid("550e8400-e29b-41d4-a716-446655440000"), "date_field": 19723, "time_field": 37230000, "timestamp_field": 1707000000000, "timestamp_ntz_field": 1707048000000, "timestamp_nano_field": 1707000000000, "interval_ym_field": 14, "interval_dt_field": 37230000000, "struct_field": { "name": "Alice", "age": 30, "active": true }, "list_field": [ "a", "b", "c" ], "map_field": { "key1": "value1", "key2": "100" }, "variant_field": "string value", "unknown_field": null }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/iceberg/all-data-types/result.030.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/iceberg/all-data-types/result.030.adm
new file mode 100644
index 0000000..4dfcb3a
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/iceberg/all-data-types/result.030.adm
@@ -0,0 +1 @@
+{ "binary_field": "AQIDBAUGBwg=", "fixed_field": "SGVsbG8gV29ybGQ=", "geometry_field": "AQIDBAUGBwgJCg==", "geography_field": "AQIDBAUGBwgJCg0=", "bool_field": true, "byte_field": 42, "short_field": 1000, "int_field": 42, "long_field": 9223372036854775807, "float_field": 3.14, "double_field": 2.718281828459045, "decimal_field": 12345.6789, "string_field": "hello world", "varchar_field": "varchar value one", "char_field": "Hi", "uuid_field": uuid("550e8400-e29b-41d4-a716-446655440000"), "date_field": date("2024-01-01"), "time_field": time("10:20:30.000"), "timestamp_field": datetime("2024-02-03T22:40:00.000"), "timestamp_ntz_field": datetime("2024-02-04T12:00:00.000"), "timestamp_nano_field": datetime("2024-02-03T22:40:00.000"), "interval_ym_field": 14, "interval_dt_field": 37230000000, "struct_field": { "name": "Alice", "age": 30, "active": true }, "list_field": [ "a", "b", "c" ], "map_field": { "key1": "value1", "key2": "100" }, "variant_field": "string value", "unknown_field": null }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/iceberg/catalog/check-catalog-record/result.001.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/iceberg/check-catalog-record/result.001.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/iceberg/catalog/check-catalog-record/result.001.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/iceberg/check-catalog-record/result.001.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_iceberg.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_iceberg.xml
index d567e21..4daf513 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_iceberg.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_iceberg.xml
@@ -18,48 +18,56 @@
  ! under the License.
  !-->
 <test-suite xmlns="urn:xml.testframework.asterix.apache.org" ResultOffsetPath="results" QueryOffsetPath="queries_sqlpp" QueryFileExtension=".sqlpp">
-  <test-group name="iceberg">
-    <test-case FilePath="iceberg/catalog/">
-      <compilation-unit name="all-supported-types">
-        <output-dir compare="Text">all-supported-types</output-dir>
+  <test-group name="data">
+    <test-case FilePath="iceberg">
+      <compilation-unit name="all-supported-catalog-types">
+        <output-dir compare="Text">all-supported-catalog-types</output-dir>
       </compilation-unit>
     </test-case>
-    <test-case FilePath="iceberg/catalog/">
+    <test-case FilePath="iceberg">
       <compilation-unit name="check-catalog-record">
         <output-dir compare="Text">check-catalog-record</output-dir>
       </compilation-unit>
     </test-case>
-    <test-case FilePath="iceberg/catalog/negative">
+    <test-case FilePath="iceberg">
+      <compilation-unit name="all-data-types">
+        <placeholder name="adapter" value="S3" />
+        <output-dir compare="Text">all-data-types</output-dir>
+      </compilation-unit>
+    </test-case>
+  </test-group>
+  <test-group name="negative">
+    <test-case FilePath="iceberg/negative">
       <compilation-unit name="bad-catalog-type">
         <output-dir compare="Text">bad-catalog-type</output-dir>
         <expected-error>ASX1228: Unsupported catalog type: 'FakeIcebergCatalog'</expected-error>
       </compilation-unit>
     </test-case>
-    <test-case FilePath="iceberg/catalog/negative">
+    <test-case FilePath="iceberg/negative">
       <compilation-unit name="bad-source-type">
         <output-dir compare="Text">bad-source-type</output-dir>
         <expected-error>ASX1230: Unsupported Iceberg catalog source: 'FAKE_AWS_GLUE'</expected-error>
       </compilation-unit>
     </test-case>
-    <test-case FilePath="iceberg/catalog/negative">
+    <test-case FilePath="iceberg/negative">
       <compilation-unit name="missing-source-type">
         <output-dir compare="Text">missing-source-type</output-dir>
         <expected-error>ASX0049: Parameter(s) catalogSource must be specified</expected-error>
       </compilation-unit>
     </test-case>
-    <test-case FilePath="iceberg/catalog/negative">
+    <test-case FilePath="iceberg/negative">
       <compilation-unit name="catalog-already-exists">
         <output-dir compare="Text">catalog-already-exists</output-dir>
         <expected-error>ASX1226: A catalog with this name myGlueCatalog already exists</expected-error>
       </compilation-unit>
     </test-case>
-    <test-case FilePath="iceberg/catalog/negative">
+    <test-case FilePath="iceberg/negative">
       <compilation-unit name="drop-does-not-exist">
         <output-dir compare="Text">drop-does-not-exist</output-dir>
         <expected-error>ASX1227: Cannot find catalog with name myDoesNotExistGlueCatalog</expected-error>
       </compilation-unit>
     </test-case>
-    <test-case FilePath="iceberg/catalog/negative">
+    <test-case FilePath="iceberg/negative">
       <compilation-unit name="drop-has-dependent-collections">
         <output-dir compare="Text">drop-has-dependent-collections</output-dir>
         <expected-error>ASX1148: Cannot drop catalog myGlueCatalog being used by collection Default.Default.test</expected-error>
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/IcebergParquetDataParser.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/IcebergParquetDataParser.java
index 7266f2c..a01be90 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/IcebergParquetDataParser.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/IcebergParquetDataParser.java
@@ -174,7 +174,7 @@
                 return;
             case TIMESTAMP:
             case TIMESTAMP_NANO:
-                serializeTimestamp(value, out);
+                serializeTimestamp(fieldType, value, out);
                 return;
             case GEOMETRY:
             case GEOGRAPHY:
@@ -212,21 +212,8 @@
             NestedField field = schema.fields().get(i);
             String fieldName = field.name();
             Type fieldType = field.type();
-            Object sourceValue = structLike.get(i, Object.class);
-            ATypeTag typeTag = getTypeTag(fieldType, sourceValue == null, parserContext);
-            IValueReference value;
-            if (valueEmbedder.shouldEmbed(fieldName, typeTag)) {
-                value = valueEmbedder.getEmbeddedValue();
-            } else {
-                valueBuffer.reset();
-                parseValue(fieldType, sourceValue, valueBuffer.getDataOutput());
-                value = valueBuffer;
-            }
-
-            if (value != null) {
-                // Ignore missing values
-                objectBuilder.addField(parserContext.getSerializedFieldName(fieldName), value);
-            }
+            Object fieldValue = structLike.get(i, Object.class);
+            parseValueAndAddObjectField(valueBuffer, objectBuilder, fieldType, fieldName, fieldValue);
         }
 
         embedMissingValues(objectBuilder, parserContext, valueEmbedder);
@@ -236,31 +223,46 @@
     }
 
     private void parseMap(Types.MapType mapSchema, Map<?, ?> map, DataOutput out) throws IOException {
-        final IMutableValueStorage item = parserContext.enterCollection();
-        final IMutableValueStorage valueBuffer = parserContext.enterObject();
+        IMutableValueStorage valueBuffer = parserContext.enterObject();
         IARecordBuilder objectBuilder = parserContext.getObjectBuilder(DefaultOpenFieldType.NESTED_OPEN_RECORD_TYPE);
-        IAsterixListBuilder listBuilder =
-                parserContext.getCollectionBuilder(DefaultOpenFieldType.NESTED_OPEN_AORDERED_LIST_TYPE);
+        valueEmbedder.enterObject();
 
         Type keyType = mapSchema.keyType();
         Type valueType = mapSchema.valueType();
 
-        for (Map.Entry<?, ?> entry : map.entrySet()) {
-            objectBuilder.reset(DefaultOpenFieldType.NESTED_OPEN_RECORD_TYPE);
-            valueBuffer.reset();
-            parseValue(keyType, entry.getKey(), valueBuffer.getDataOutput());
-            objectBuilder.addField(parserContext.getSerializedFieldName("key"), valueBuffer);
-            valueBuffer.reset();
-            parseValue(valueType, entry.getValue(), valueBuffer.getDataOutput());
-            objectBuilder.addField(parserContext.getSerializedFieldName("value"), valueBuffer);
-            item.reset();
-            objectBuilder.write(item.getDataOutput(), true);
-            listBuilder.addItem(item);
+        // TODO: we can't support non-string keys since we map MAP-TYPE to OBJECT-TYPE in AsterixDB
+        if (keyType != Types.StringType.get()) {
+            throw new RuntimeDataException(ErrorCode.TYPE_UNSUPPORTED, "Iceberg Parser", "MAP with non-string keys");
         }
 
-        listBuilder.write(out, true);
+        for (Map.Entry<?, ?> entry : map.entrySet()) {
+            String fieldName = (String) entry.getKey();
+            Object fieldValue = entry.getValue();
+            parseValueAndAddObjectField(valueBuffer, objectBuilder, valueType, fieldName, fieldValue);
+        }
+
+        embedMissingValues(objectBuilder, parserContext, valueEmbedder);
+        objectBuilder.write(out, true);
+        valueEmbedder.exitObject();
         parserContext.exitObject(valueBuffer, null, objectBuilder);
-        parserContext.exitCollection(item, listBuilder);
+    }
+
+    private void parseValueAndAddObjectField(IMutableValueStorage valueBuffer, IARecordBuilder objectBuilder,
+            Type valueType, String fieldName, Object fieldValue) throws IOException {
+        ATypeTag typeTag = getTypeTag(valueType, fieldValue == null, parserContext);
+        IValueReference value;
+        if (valueEmbedder.shouldEmbed(fieldName, typeTag)) {
+            value = valueEmbedder.getEmbeddedValue();
+        } else {
+            valueBuffer.reset();
+            parseValue(valueType, fieldValue, valueBuffer.getDataOutput());
+            value = valueBuffer;
+        }
+
+        if (value != null) {
+            // Ignore missing values
+            objectBuilder.addField(parserContext.getSerializedFieldName(fieldName), value);
+        }
     }
 
     private void serializeInteger(Object value, DataOutput out) throws HyracksDataException {
@@ -276,9 +278,9 @@
     }
 
     private void serializeFloat(Object value, DataOutput out) throws HyracksDataException {
-        float floatValue = (Float) value;
-        aDouble.setValue(floatValue);
-        doubleSerde.serialize(aDouble, out);
+        Float floatValue = (Float) value;
+        aFloat.setValue(floatValue);
+        floatSerde.serialize(aFloat, out);
     }
 
     private void serializeDouble(Object value, DataOutput out) throws HyracksDataException {
@@ -337,21 +339,31 @@
         }
     }
 
-    public void serializeTimestamp(Object value, DataOutput output) throws HyracksDataException {
-        long timeStampInMillis;
-        if (value instanceof OffsetDateTime) {
-            // Timezone aware: Iceberg returns OffsetDateTime
-            timeStampInMillis = ((OffsetDateTime) value).toInstant().toEpochMilli();
-        } else {
-            // No timezone: Iceberg returns LocalDateTime
-            LocalDateTime localDateTime = (LocalDateTime) value;
-            ZoneId zoneId = parserContext.getTimeZoneId();
-            timeStampInMillis = localDateTime.atZone(zoneId).toInstant().toEpochMilli();
+    public void serializeTimestamp(Type type, Object value, DataOutput output) throws HyracksDataException {
+        long timestampInMillis;
+        switch (value) {
+            case OffsetDateTime offsetDateTime ->
+                    timestampInMillis = offsetDateTime.toInstant().toEpochMilli();
+
+            case LocalDateTime localDateTime -> {
+                ZoneId zoneId = parserContext.getTimeZoneId();
+                timestampInMillis = localDateTime.atZone(zoneId).toInstant().toEpochMilli();
+            }
+
+            case null, default -> {
+                throw RuntimeDataException.create(
+                        ErrorCode.EXTERNAL_SOURCE_ERROR,
+                        value == null
+                                ? "unexpected null value for field type (" + type + ")"
+                                : "unexpected value type (" + value.getClass() + ") for field type (" + type + ")");
+            }
         }
+
         if (parserContext.isTimestampAsLong()) {
-            serializeLong(timeStampInMillis, output);
+            serializeLong(timestampInMillis, output);
         } else {
-            parserContext.serializeDateTime(timeStampInMillis, output);
+            aDateTime.setValue(timestampInMillis);
+            datetimeSerde.serialize(aDateTime, output);
         }
     }
 
@@ -376,7 +388,8 @@
         return switch (type.typeId()) {
             case BOOLEAN -> ATypeTag.BOOLEAN;
             case INTEGER, LONG -> ATypeTag.BIGINT;
-            case FLOAT, DOUBLE -> ATypeTag.DOUBLE;
+            case FLOAT -> ATypeTag.FLOAT;
+            case DOUBLE -> ATypeTag.DOUBLE;
             case STRING -> ATypeTag.STRING;
             case UUID -> ATypeTag.UUID;
             case FIXED, BINARY -> ATypeTag.BINARY;
@@ -384,8 +397,8 @@
                 ensureDecimalToDoubleEnabled(type, parserContext);
                 yield ATypeTag.DOUBLE;
             }
-            case STRUCT -> ATypeTag.OBJECT;
-            case LIST, MAP -> ATypeTag.ARRAY;
+            case STRUCT, MAP -> ATypeTag.OBJECT;
+            case LIST -> ATypeTag.ARRAY;
             case DATE -> {
                 if (parserContext.isDateAsInt()) {
                     yield ATypeTag.INTEGER;

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21226?usp=email
To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: asterixdb
Gerrit-Branch: lumina
Gerrit-Change-Id: I968952f850e3e1c88d630566fb764f6b89ca2300
Gerrit-Change-Number: 21226
Gerrit-PatchSet: 1
Gerrit-Owner: Hussain Towaileb <hu...@gmail.com>