venkata91 opened a new pull request, #19089:
URL: https://github.com/apache/iceberg/pull/19089

   ## Intent
   
   Address https://github.com/apache/iceberg/pull/17562#issuecomment-7069609240 
by backporting the scanDuration metric to Spark 4.0 and 3.5. This task is the 
Spark 4.0 backport. Base it on main rather than stacking it on the open 
read-metrics backport PRs.
   
   Context: PR #17562 ("Spark 4.1: Add per-task scanDuration metric", merged as 
commit cbfabba93) added a `scanDuration` custom read metric to Spark 4.1: the 
wall time a task spends in `BaseReader.next()`, covering split open and 
iteration, accumulated in a `finally` so a failing task still reports it. 
`TaskScanDuration` is reported from `BatchDataReader` and `RowDataReader` and 
aggregated by `ScanDuration`, mirroring the `TotalPlanningDuration` pair. It is 
in nanoseconds and the aggregate renders as `total (min, med, max)`. The PR 
said "Happy to backport to 4.0 and 3.5 in a follow-up." Reviewer gerashegalov 
replied: "Thank you for the ScanDuration metric. We are interested in seeing 
backported within 1.13 across all Spark shims". Spark 4.1 (#17562) and 4.2 
(#18751) already have it, while spark/v4.0 and spark/v3.5 do not.
   
   ## What Changed
   
   - Backports the `scanDuration` custom read metric from Spark 4.1 (#17562) to 
`spark/v4.0`. `BaseReader.next()` records the task's wall time in nanoseconds 
inside a `finally`, so it covers split open and iteration and is still counted 
when the task fails.
   - `BatchDataReader` and `RowDataReader` report the time as 
`TaskScanDuration`. `SparkScan` registers the new `ScanDuration` metric, which 
sums the per-task values and shows them as `total (min, med, max)` in units 
scaled from ns up to s.
   - Adds `TestScanDuration` to check the aggregation and formatting, and adds 
`scanDuration` cases to `TestSparkReadMetrics`.
   
   ## Risk Assessment
   
   ✅ Low: This is a faithful backport. ScanDuration, TaskScanDuration and 
TestScanDuration are byte-identical to the merged Spark 4.1 commit cbfabba93, 
and the BaseReader, BatchDataReader, RowDataReader, SparkScan and 
TestSparkReadMetrics changes match 4.1's additions apart from pre-existing 
differences between the 4.0 and 4.1 code; the base is main and no read-metrics 
backport is stacked in.
   
   ## Testing
   
   I ran the targeted Spark 4.0 tests: TestSparkReadMetrics and 
TestScanDuration. TestSparkReadMetrics runs real SQL SELECTs on Iceberg tables 
in a local Spark 4.0 session with a hadoop catalog. It checks the scanDuration 
SQLMetric on the scan node, and it checks the rendered `total (min, med, max)` 
string in the SQL status store. Both the vectorized and the non-vectorized read 
paths were covered. All 13 tests passed. One scenario was not driven: the 
`finally` accumulation when a task fails partway through. I checked it only by 
reading the code.
   
   - Live validation: ✅ go - 5 of 6 scenarios driven live against the product
   
   | Scenario | Result | Live | Evidence |
   | --- | --- | --- | --- |
   | Vectorized SELECT on an Iceberg table in local Spark 4.0 reports 
scanDuration > 0 on the scan node | ✅ pass | live | TestSparkReadMetrics 
(existing metric tests plus scanDuration assertions) in gradle-test.log / JUnit 
XML |
   | Multi-file scan sums scanDuration across tasks and the SQL UI store shows 
it as 'total (min, med, max)' with time units | ✅ pass | live | 
TestSparkReadMetrics.scanDurationAggregatedAcrossTasks |
   | Non-vectorized (RowDataReader) SELECT reports scanDuration > 0 | ✅ pass 
| live | TestSparkReadMetrics.scanDurationForNonVectorizedRead (also asserts 
supportsColumnar()==false) |
   | Read with delete files still reports scanDuration alongside the delete 
metrics | ✅ pass | live | TestSparkReadMetrics.testDeleteMetrics |
   | ScanDuration aggregate formatting: units, stragglers, empty input, locale 
independence, no input mutation | ✅ pass | live | TestScanDuration (5 tests) |
   | A task that fails mid-iteration still accumulates scanDuration (finally 
block) | ⏸️ untested | no | A real Spark read has no public hook for injecting 
a mid-iteration reader failure without adding test-only fault-injection code. 
This behavior matches the already-merged Spark 4.1 implementation. |
   
   
   <details>
   <summary>Evidence: Gradle test run log</summary>
   
   ```text
     % Total    % Received % Xferd  Average Speed   Time    Time     Time  
Current
                                    Dload  Upload   Total   Spent    Left  Speed
      0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--    
 0   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     
0 100 43764  100 43764    0     0   326k      0 --:--:-- --:--:-- --:--:--  326k
   Starting a Gradle Daemon, 1 busy and 1 stopped Daemons could not be reused, 
use --status for details
   Configuration on demand is an incubating feature.
   > Task :iceberg-azure:processResources NO-SOURCE
   > Task :iceberg-common:processResources NO-SOURCE
   > Task :iceberg-core:processResources NO-SOURCE
   > Task :iceberg-data:processResources NO-SOURCE
   > Task :iceberg-api:processResources NO-SOURCE
   > Task :iceberg-azure-bundle:compileJava NO-SOURCE
   > Task :iceberg-aws-bundle:compileJava NO-SOURCE
   > Task :iceberg-arrow:processResources NO-SOURCE
   > Task :iceberg-gcp:processResources NO-SOURCE
   > Task :iceberg-orc:processResources NO-SOURCE
   > Task :iceberg-gcp-bundle:compileJava NO-SOURCE
   > Task :iceberg-hive-metastore:processResources NO-SOURCE
   > Task :iceberg-parquet:processResources NO-SOURCE
   > Task :iceberg-orc:processTestResources NO-SOURCE
   > Task :iceberg-gcp-bundle:processResources NO-SOURCE
   > Task :iceberg-aws-bundle:processResources NO-SOURCE
   > Task :iceberg-data:processTestResources NO-SOURCE
   > Task :iceberg-aws-bundle:classes UP-TO-DATE
   > Task :iceberg-gcp-bundle:classes UP-TO-DATE
   > Task :iceberg-azure-bundle:processResources NO-SOURCE
   > Task :iceberg-azure-bundle:classes UP-TO-DATE
   > Task :iceberg-hive-metastore:processTestResources
   > Task :iceberg-aws:processResources
   > Task :iceberg-open-api:processTestFixturesResources
   > Task :iceberg-spark:iceberg-spark-4.0_2.13:processResources
   > Task :iceberg-spark:iceberg-spark-4.0_2.13:processTestResources
   > Task :iceberg-core:processTestResources
   > Task :iceberg-parquet:processTestFixturesResources
   > Task :iceberg-bundled-guava:compileJava FROM-CACHE
   > Task :iceberg-bundled-guava:processResources NO-SOURCE
   > Task :iceberg-bundled-guava:classes UP-TO-DATE
   > Task :iceberg-bundled-guava:compileTestJava NO-SOURCE
   > Task :iceberg-bundled-guava:shadowJar FROM-CACHE
   > Task :iceberg-azure-bundle:shadowJar FROM-CACHE
   > Task :iceberg-aws-bundle:shadowJar FROM-CACHE
   > Task :generateGitProperties
   > Task :buildInfo
   > Task :iceberg-aws-bundle:jar SKIPPED
   > Task :iceberg-azure-bundle:jar SKIPPED
   > Task :iceberg-common:compileJava FROM-CACHE
   > Task :iceberg-common:classes UP-TO-DATE
   > Task :iceberg-common:jar
   > Task :iceberg-api:compileJava FROM-CACHE
   > Task :iceberg-api:classes UP-TO-DATE
   > Task :iceberg-api:jar
   > Task :iceberg-gcp-bundle:shadowJar FROM-CACHE
   > Task :iceberg-gcp-bundle:jar SKIPPED
   > Task :iceberg-api:compileTestJava FROM-CACHE
   > Task :iceberg-api:processTestResources
   > Task :iceberg-api:testClasses
   
   > Task :iceberg-api:testJar
   file '{run-worktree}/build/iceberg-build.properties' will be copied to 
'iceberg-build.properties', overwriting file 
'{run-worktree}/api/build/resources/test/iceberg-build.properties', which has 
already been copied there.
   
   > Task :iceberg-core:compileJava FROM-CACHE
   > Task :iceberg-core:classes UP-TO-DATE
   > Task :iceberg-gcp:compileJava FROM-CACHE
   > Task :iceberg-gcp:classes UP-TO-DATE
   > Task :iceberg-azure:compileJava FROM-CACHE
   > Task :iceberg-azure:classes UP-TO-DATE
   > Task :iceberg-hive-metastore:compileJava FROM-CACHE
   > Task :iceberg-hive-metastore:classes UP-TO-DATE
   > Task :iceberg-aws:compileJava FROM-CACHE
   > Task :iceberg-aws:classes
   > Task :iceberg-orc:compileJava FROM-CACHE
   > Task :iceberg-orc:classes UP-TO-DATE
   > Task :iceberg-gcp:jar
   > Task :iceberg-parquet:compileJava FROM-CACHE
   > Task :iceberg-azure:jar
   > Task :iceberg-hive-metastore:jar
   > Task :iceberg-aws:jar
   > Task :iceberg-orc:jar
   > Task :iceberg-parquet:compileTestFixturesJava FROM-CACHE
   > Task :iceberg-parquet:classes UP-TO-DATE
   > Task :iceberg-arrow:compileJava FROM-CACHE
   > Task :iceberg-arrow:classes UP-TO-DATE
   > Task :iceberg-core:jar
   > Task :iceberg-data:compileJava FROM-CACHE
   > Task :iceberg-data:classes UP-TO-DATE
   > Task :iceberg-spark:iceberg-spark-4.0_2.13:compileJava NO-SOURCE
   > Task :iceberg-data:jar
   > Task :iceberg-arrow:jar
   > Task :iceberg-parquet:jar
   > Task :iceberg-parquet:testFixturesClasses
   > Task :iceberg-parquet:testFixturesJar
   > Task :iceberg-core:compileTestJava FROM-CACHE
   > Task :iceberg-core:testClasses
   > Task :iceberg-core:testJar
   > Task :iceberg-orc:compileTestJava FROM-CACHE
   > Task :iceberg-orc:testClasses UP-TO-DATE
   > Task :iceberg-hive-metastore:compileTestJava FROM-CACHE
   > Task :iceberg-hive-metastore:testClasses
   > Task :iceberg-open-api:compileTestFixturesJava FROM-CACHE
   > Task :iceberg-open-api:testFixturesClasses
   > Task :iceberg-open-api:testFixturesJar
   > Task :iceberg-orc:testJar
   > Task :iceberg-hive-metastore:testJar
   > Task :iceberg-data:compileTestJava FROM-CACHE
   > Task :iceberg-data:testClasses UP-TO-DATE
   > Task :iceberg-data:testJar
   
   > Task :iceberg-spark:iceberg-spark-4.0_2.13:compileScala
   Could not determine source for class 
org.apache.iceberg.spark.ImmutableParquetBatchReadConf$Builder
   Could not determine source for class 
org.apache.iceberg.spark.ImmutableParquetBatchReadConf
   Could not determine source for class 
org.apache.iceberg.spark.ImmutableOrcBatchReadConf
   Could not determine source for class 
org.apache.iceberg.spark.ImmutableOrcBatchReadConf$Builder
   
   > Task :iceberg-spark:iceberg-spark-4.0_2.13:classes
   > Task :iceberg-spark:iceberg-spark-4.0_2.13:compileTestJava FROM-CACHE
   > Task :iceberg-spark:iceberg-spark-4.0_2.13:compileTestScala NO-SOURCE
   > Task :iceberg-spark:iceberg-spark-4.0_2.13:testClasses
   > Task :iceberg-spark:iceberg-spark-4.0_2.13:test
   
   [shutdown-hook-0] INFO org.apache.spark.util.ShutdownHookManager - Shutdown 
hook called
   [shutdown-hook-0] INFO org.apache.spark.util.ShutdownHookManager - Deleting 
directory /tmp/spark-fae933ac-0a1e-4fc4-b5ed-bd4112adefb9
   [shutdown-hook-0] INFO org.apache.spark.util.ShutdownHookManager - Deleting 
directory /tmp/artifacts-2304b1b0-7407-4897-8601-e4c5e6ce2820
   
   [Incubating] Problems report is available at: 
file://{run-worktree}/build/reports/problems/problems-report.html
   
   Deprecated Gradle features were used in this build, making it incompatible 
with Gradle 9.0.
   
   You can use '--warning-mode all' to show the individual deprecation warnings 
and determine if they come from your own scripts or plugins.
   
   For more on this, please refer to 
https://docs.gradle.org/8.14.6/userguide/command_line_interface.html#sec:command_line_warnings
 in the Gradle documentation.
   
   BUILD SUCCESSFUL in 1m 9s
   53 actionable tasks: 29 executed, 24 from cache
   ```
   </details>
   <details>
   <summary>Evidence: Test results summary</summary>
   
   `TestSparkReadMetrics tests=8 failures=0 errors=0; TestScanDuration tests=5 
failures=0 errors=0`
   
   ```text
   <testsuite name="org.apache.iceberg.spark.source.TestSparkReadMetrics" 
tests="8" skipped="0" failures="0" errors="0" 
timestamp="2026-11-22T04:27:06.313Z" 
hostname="vsowrirajan-microsoft-devbox-vsowrirajan-dev-6b698f4977-zvfhg" 
time="11.86">
   testcase name="catalogName = testhadoop, implementation = 
org.apache.iceberg.spark.SparkCatalog, config = {type=hadoop, 
cache-enabled=false}"
   testcase name="catalogName = testhadoop, implementation = 
org.apache.iceberg.spark.SparkCatalog, config = {type=hadoop, 
cache-enabled=false}"
   testcase name="catalogName = testhadoop, implementation = 
org.apache.iceberg.spark.SparkCatalog, config = {type=hadoop, 
cache-enabled=false}"
   testcase name="catalogName = testhadoop, implementation = 
org.apache.iceberg.spark.SparkCatalog, config = {type=hadoop, 
cache-enabled=false}"
   testcase name="catalogName = testhadoop, implementation = 
org.apache.iceberg.spark.SparkCatalog, config = {type=hadoop, 
cache-enabled=false}"
   testcase name="catalogName = testhadoop, implementation = 
org.apache.iceberg.spark.SparkCatalog, config = {type=hadoop, 
cache-enabled=false}"
   testcase name="catalogName = testhadoop, implementation = 
org.apache.iceberg.spark.SparkCatalog, config = {type=hadoop, 
cache-enabled=false}"
   testcase name="catalogName = testhadoop, implementation = 
org.apache.iceberg.spark.SparkCatalog, config = {type=hadoop, 
cache-enabled=false}"
   <testsuite name="org.apache.iceberg.spark.source.metrics.TestScanDuration" 
tests="5" skipped="0" failures="0" errors="0" 
timestamp="2026-11-22T04:27:18.287Z" 
hostname="vsowrirajan-microsoft-devbox-vsowrirajan-dev-6b698f4977-zvfhg" 
time="0.008">
   testcase name="aggregateTaskMetricsDoesNotMutateInput()"
   testcase name="aggregateTaskMetricsSurfacesStragglers()"
   testcase name="aggregateTaskMetricsIsLocaleIndependent()"
   testcase name="aggregateTaskMetrics()"
   testcase name="aggregateTaskMetricsWithNoTasks()"
   ```
   </details>
   <details>
   <summary>Evidence: JUnit XML TestSparkReadMetrics</summary>
   
   ```text
   <?xml version="1.0" encoding="UTF-8"?>
   <testsuite name="org.apache.iceberg.spark.source.TestSparkReadMetrics" 
tests="8" skipped="0" failures="0" errors="0" 
timestamp="2026-11-22T04:27:06.313Z" 
hostname="vsowrirajan-microsoft-devbox-vsowrirajan-dev-6b698f4977-zvfhg" 
time="11.86">
     <properties/>
     <testcase name="catalogName = testhadoop, implementation = 
org.apache.iceberg.spark.SparkCatalog, config = {type=hadoop, 
cache-enabled=false}" 
classname="org.apache.iceberg.spark.source.TestSparkReadMetrics" time="4.996"/>
     <testcase name="catalogName = testhadoop, implementation = 
org.apache.iceberg.spark.SparkCatalog, config = {type=hadoop, 
cache-enabled=false}" 
classname="org.apache.iceberg.spark.source.TestSparkReadMetrics" time="1.228"/>
     <testcase name="catalogName = testhadoop, implementation = 
org.apache.iceberg.spark.SparkCatalog, config = {type=hadoop, 
cache-enabled=false}" 
classname="org.apache.iceberg.spark.source.TestSparkReadMetrics" time="0.409"/>
     <testcase name="catalogName = testhadoop, implementation = 
org.apache.iceberg.spark.SparkCatalog, config = {type=hadoop, 
cache-enabled=false}" 
classname="org.apache.iceberg.spark.source.TestSparkReadMetrics" time="2.95"/>
     <testcase name="catalogName = testhadoop, implementation = 
org.apache.iceberg.spark.SparkCatalog, config = {type=hadoop, 
cache-enabled=false}" 
classname="org.apache.iceberg.spark.source.TestSparkReadMetrics" time="0.669"/>
     <testcase name="catalogName = testhadoop, implementation = 
org.apache.iceberg.spark.SparkCatalog, config = {type=hadoop, 
cache-enabled=false}" 
classname="org.apache.iceberg.spark.source.TestSparkReadMetrics" time="0.618"/>
     <testcase name="catalogName = testhadoop, implementation = 
org.apache.iceberg.spark.SparkCatalog, config = {type=hadoop, 
cache-enabled=false}" 
classname="org.apache.iceberg.spark.source.TestSparkReadMetrics" time="0.508"/>
     <testcase name="catalogName = testhadoop, implementation = 
org.apache.iceberg.spark.SparkCatalog, config = {type=hadoop, 
cache-enabled=false}" 
classname="org.apache.iceberg.spark.source.TestSparkReadMetrics" time="0.471"/>
     <system-out><![CDATA[--
   -- 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.
   --
   -- This file was copied from Apache Hive, at:
   -- 
https://github.com/apache/hive/blob/master/standalone-metastore/metastore-server/src/main/sql/derby/hive-schema-3.1.0.derby.sql
   --
   -- This has been modified slightly for compatibility with older Hive 
versions.
   --
   -- Timestamp: 2011-09-22 15:32:02.024
   -- Source database is: ~/Work/repos/hive1/metastore/scripts/upgrade/derby/mdb
   -- Connection URL is: 
jdbc:derby:~/Work/repos/hive1/metastore/scripts/upgrade/derby/mdb
   -- Specified schema is: APP
   -- appendLogs: false
   -- ----------------------------------------------
   -- DDL Statements for functions
   -- ----------------------------------------------
   CREATE FUNCTION "APP"."NUCLEUS_ASCII" (C CHAR(1)) RETURNS INTEGER LANGUAGE 
JAVA PARAMETER STYLE JAVA READS SQL DATA CALLED ON NULL INPUT EXTERNAL NAME 
'org.datanucleus.store.rdbms.adapter.DerbySQLFunction.ascii'  
   CREATE FUNCTION "APP"."NUCLEUS_MATCHES" (TEXT VARCHAR(8000),PATTERN 
VARCHAR(8000)) RETURNS INTEGER LANGUAGE JAVA PARAMETER STYLE JAVA READS SQL 
DATA CALLED ON NULL INPUT EXTERNAL NAME 
'org.datanucleus.store.rdbms.adapter.DerbySQLFunction.matches'  
   -- ----------------------------------------------
   -- DDL Statements for tables
   -- ----------------------------------------------
   CREATE TABLE "APP"."DBS" (   "DB_ID" BIGINT NOT NULL,   "DESC" 
VARCHAR(4000),   "DB_LOCATION_URI" VARCHAR(4000) NOT NULL,   "NAME" 
VARCHAR(128),   "OWNER_NAME" VARCHAR(128),   "OWNER_TYPE" VARCHAR(10),   
"CTLG_NAME" VARCHAR(256) ) 
   CREATE TABLE "APP"."TBL_PRIVS" ("TBL_GRANT_ID" BIGINT NOT NULL, 
"CREATE_TIME" INTEGER NOT NULL, "GRANT_OPTION" SMALLINT NOT NULL, "GRANTOR" 
VARCHAR(128), "GRANTOR_TYPE" VARCHAR(128), "PRINCIPAL_NAME" VARCHAR(128), 
"PRINCIPAL_TYPE" VARCHAR(128), "TBL_PRIV" VARCHAR(128), "TBL_ID" BIGINT, 
"AUTHORIZER" VARCHAR(128)) 
   CREATE TABLE "APP"."DATABASE_PARAMS" ("DB_ID" BIGINT NOT NULL, "PARAM_KEY" 
VARCHAR(180) NOT NULL, "PARAM_VALUE" VARCHAR(4000)) 
   CREATE TABLE "APP"."TBL_COL_PRIVS" ("TBL_COLUMN_GRANT_ID" BIGINT NOT NULL, 
"COLUMN_NAME" VARCHAR(767), "CREATE_TIME" INTEGER NOT NULL, "GRANT_OPTION" 
SMALLINT NOT NULL, "GRANTOR" VARCHAR(128), "GRANTOR_TYPE" VARCHAR(128), 
"PRINCIPAL_NAME" VARCHAR(128), "PRINCIPAL_TYPE" VARCHAR(128), "TBL_COL_PRIV" 
VARCHAR(128), "TBL_ID" BIGINT, "AUTHORIZER" VARCHAR(128)) 
   CREATE TABLE "APP"."SERDE_PARAMS" ("SERDE_ID" BIGINT NOT NULL, "PARAM_KEY" 
VARCHAR(256) NOT NULL, "PARAM_VALUE" VARCHAR(32672)) 
   CREATE TABLE "APP"."COLUMNS_V2" ("CD_ID" BIGINT NOT NULL, "COMMENT" 
VARCHAR(4000), "COLUMN_NAME" VARCHAR(767) NOT NULL, "TYPE_NAME" VARCHAR(32672), 
"INTEGER_IDX" INTEGER NOT NULL) 
   CREATE TABLE "APP"."SORT_COLS" ("SD_ID" BIGINT NOT NULL, "COLUMN_NAME" 
VARCHAR(767), "ORDER" INTEGER NOT NULL, "INTEGER_IDX" INTEGER NOT NULL) 
   CREATE TABLE "APP"."CDS" ("CD_ID" BIGINT NOT NULL) 
   CREATE TABLE "APP"."PARTITION_KEY_VALS" ("PART_ID" BIGINT NOT NULL, 
"PART_KEY_VAL" VARCHAR(256), "INTEGER_IDX" INTEGER NOT NULL) 
   CREATE TABLE "APP"."DB_PRIVS" ("DB_GRANT_ID" BIGINT NOT NULL, "CREATE_TIME" 
INTEGER NOT NULL, "DB_ID" BIGINT, "GRANT_OPTION" SMALLINT NOT NULL, "GRANTOR" 
VARCHAR(128), "GRANTOR_TYPE" VARCHAR(128), "PRINCIPAL_NAME" VARCHAR(128), 
"PRINCIPAL_TYPE" VARCHAR(128), "DB_PRIV" VARCHAR(128), "AUTHORIZER" 
VARCHAR(128)) 
   CREATE TABLE "APP"."IDXS" ("INDEX_ID" BIGINT NOT NULL, "CREATE_TIME" INTEGER 
NOT NULL, "DEFERRED_REBUILD" CHAR(1) NOT NULL, "INDEX_HANDLER_CLASS" 
VARCHAR(4000), "INDEX_NAME" VARCHAR(128), "INDEX_TBL_ID" BIGINT, 
"LAST_ACCESS_TIME" INTEGER NOT NULL, "ORIG_TBL_ID" BIGINT, "SD_ID" BIGINT) 
   CREATE TABLE "APP"."INDEX_PARAMS" ("INDEX_ID" BIGINT NOT NULL, "PARAM_KEY" 
VARCHAR(256) NOT NULL, "PARAM_VALUE" VARCHAR(4000)) 
   CREATE TABLE "APP"."PARTITIONS" ("PART_ID" BIGINT NOT NULL, "CREATE_TIME" 
INTEGER NOT NULL, "LAST_ACCESS_TIME" INTEGER NOT NULL, "PART_NAME" 
VARCHAR(767), "SD_ID" BIGINT, "TBL_ID" BIGINT) 
   CREATE TABLE "APP"."SERDES" ("SERDE_ID" BIGINT NOT NULL, "NAME" 
VARCHAR(128), "SLIB" VARCHAR(4000), "DESCRIPTION" VARCHAR(4000), 
"SERIALIZER_CLASS" VARCHAR(4000), "DESERIALIZER_CLASS" VARCHAR(4000), 
SERDE_TYPE INTEGER) 
   CREATE TABLE "APP"."PART_PRIVS" ("PART_GRANT_ID" BIGINT NOT NULL, 
"CREATE_TIME" INTEGER NOT NULL, "GRANT_OPTION" SMALLINT NOT NULL, "GRANTOR" 
VARCHAR(128), "GRANTOR_TYPE" VARCHAR(128), "PART_ID" BIGINT, "PRINCIPAL_NAME" 
VARCHAR(128), "PRINCIPAL_TYPE" VARCHAR(128), "PART_PRIV" VARCHAR(128), 
"AUTHORIZER" VARCHAR(128)) 
   CREATE TABLE "APP"."ROLE_MAP" ("ROLE_GRANT_ID" BIGINT NOT NULL, "ADD_TIME" 
INTEGER NOT NULL, "GRANT_OPTION" SMALLINT NOT NULL, "GRANTOR" VARCHAR(128), 
"GRANTOR_TYPE" VARCHAR(128), "PRINCIPAL_NAME" VARCHAR(128), "PRINCIPAL_TYPE" 
VARCHAR(128), "ROLE_ID" BIGINT) 
   CREATE TABLE "APP"."TYPES" ("TYPES_ID" BIGINT NOT NULL, "TYPE_NAME" 
VARCHAR(128), "TYPE1" VARCHAR(767), "TYPE2" VARCHAR(767)) 
   CREATE TABLE "APP"."GLOBAL_PRIVS" ("USER_GRANT_ID" BIGINT NOT NULL, 
"CREATE_TIME" INTEGER NOT NULL, "GRANT_OPTION" SMALLINT NOT NULL, "GRANTOR" 
VARCHAR(128), "GRANTOR_TYPE" VARCHAR(128), "PRINCIPAL_NAME" VARCHAR(128), 
"PRINCIPAL_TYPE" VARCHAR(128), "USER_PRIV" VARCHAR(128), "AUTHORIZER" 
VARCHAR(128)) 
   CREATE TABLE "APP"."PARTITION_PARAMS" ("PART_ID" BIGINT NOT NULL, 
"PARAM_KEY" VARCHAR(256) NOT NULL, "PARAM_VALUE" VARCHAR(4000)) 
   CREATE TABLE "APP"."PARTITION_EVENTS" (     "PART_NAME_ID" BIGINT NOT NUL
   
   ... [280055 bytes truncated] ...
   
   hadoop.default.table
   [block-manager-storage-async-thread-pool-52] INFO 
org.apache.iceberg.spark.SparkExecutorCache - Current cache stats 
CacheStats{hitCount=0, missCount=1, loadSuccessCount=1, loadFailureCount=0, 
totalLoadTime=17884132, evictionCount=0, evictionWeight=0}
   [block-manager-storage-async-thread-pool-54] INFO 
org.apache.iceberg.spark.SparkExecutorCache - Invalidating 0 keys associated 
with testhadoop.default.table
   [block-manager-storage-async-thread-pool-54] INFO 
org.apache.iceberg.spark.SparkExecutorCache - Current cache stats 
CacheStats{hitCount=0, missCount=1, loadSuccessCount=1, loadFailureCount=0, 
totalLoadTime=17884132, evictionCount=0, evictionWeight=0}
   [Executor task launch worker for task 0.0 in stage 29.0 (TID 26)] INFO 
org.apache.spark.executor.Executor - Finished task 0.0 in stage 29.0 (TID 26). 
55528 bytes result sent to driver
   [block-manager-storage-async-thread-pool-60] INFO 
org.apache.iceberg.spark.SparkExecutorCache - Invalidating 0 keys associated 
with testhadoop.default.table
   [block-manager-storage-async-thread-pool-60] INFO 
org.apache.iceberg.spark.SparkExecutorCache - Current cache stats 
CacheStats{hitCount=0, missCount=1, loadSuccessCount=1, loadFailureCount=0, 
totalLoadTime=17884132, evictionCount=0, evictionWeight=0}
   [task-result-getter-2] INFO org.apache.spark.scheduler.TaskSetManager - 
Finished task 0.0 in stage 29.0 (TID 26) in 17 ms on 
vsowrirajan-microsoft-devbox-vsowrirajan-dev-6b698f4977-zvfhg (executor driver) 
(1/1)
   [task-result-getter-2] INFO org.apache.spark.scheduler.TaskSchedulerImpl - 
Removed TaskSet 29.0 whose tasks have all completed, from pool 
   [dag-scheduler-event-loop] INFO org.apache.spark.scheduler.DAGScheduler - 
ResultStage 29 (collect at TestSparkReadMetrics.java:356) finished in 20 ms
   [dag-scheduler-event-loop] INFO org.apache.spark.scheduler.DAGScheduler - 
Job 29 is finished. Cancelling potential speculative or zombie tasks for this 
job
   [dag-scheduler-event-loop] INFO org.apache.spark.scheduler.TaskSchedulerImpl 
- Canceling stage 29
   [dag-scheduler-event-loop] INFO org.apache.spark.scheduler.TaskSchedulerImpl 
- Killing all running tasks in stage 29: Stage finished
   [block-manager-storage-async-thread-pool-62] INFO 
org.apache.iceberg.spark.SparkExecutorCache - Invalidating 0 keys associated 
with testhadoop.default.table
   [Test worker] INFO org.apache.spark.scheduler.DAGScheduler - Job 29 
finished: collect at TestSparkReadMetrics.java:356, took 20.981198 ms
   [block-manager-storage-async-thread-pool-62] INFO 
org.apache.iceberg.spark.SparkExecutorCache - Current cache stats 
CacheStats{hitCount=0, missCount=1, loadSuccessCount=1, loadFailureCount=0, 
totalLoadTime=17884132, evictionCount=0, evictionWeight=0}
   [block-manager-storage-async-thread-pool-67] INFO 
org.apache.iceberg.spark.SparkExecutorCache - Invalidating 0 keys associated 
with testhadoop.default.table
   [block-manager-storage-async-thread-pool-67] INFO 
org.apache.iceberg.spark.SparkExecutorCache - Current cache stats 
CacheStats{hitCount=0, missCount=1, loadSuccessCount=1, loadFailureCount=0, 
totalLoadTime=17884132, evictionCount=0, evictionWeight=0}
   [Test worker] INFO org.apache.iceberg.BaseMetastoreCatalog - Table loaded by 
catalog: testhadoop.default.table
   [TThreadPoolServer WorkerProcess-3] INFO 
org.apache.hadoop.hive.metastore.HiveMetaStore - 4: source:127.0.0.1 
get_database: default
   [TThreadPoolServer WorkerProcess-3] INFO 
org.apache.hadoop.hive.metastore.HiveMetaStore.audit - ugi=coder    
ip=127.0.0.1    cmd=source:127.0.0.1 get_database: default      
   [TThreadPoolServer WorkerProcess-3] INFO 
org.apache.hadoop.hive.metastore.HiveMetaStore - 4: source:127.0.0.1 get_table 
: db=default tbl=dim
   [TThreadPoolServer WorkerProcess-3] INFO 
org.apache.hadoop.hive.metastore.HiveMetaStore.audit - ugi=coder    
ip=127.0.0.1    cmd=source:127.0.0.1 get_table : db=default tbl=dim     
   [Test worker] INFO hive.metastore - Trying to connect to metastore with URI 
thrift://localhost:41495
   [Test worker] INFO hive.metastore - Opened a connection to metastore, 
current connections: 4
   [Test worker] INFO hive.metastore - Connected to metastore.
   [TThreadPoolServer WorkerProcess-4] INFO 
org.apache.hadoop.hive.metastore.HiveMetaStore - 5: source:127.0.0.1 
get_all_databases
   [TThreadPoolServer WorkerProcess-4] INFO 
org.apache.hadoop.hive.metastore.HiveMetaStore.audit - ugi=coder    
ip=127.0.0.1    cmd=source:127.0.0.1 get_all_databases  
   [TThreadPoolServer WorkerProcess-4] INFO 
org.apache.hadoop.hive.metastore.HiveMetaStore - 5: Opening raw store with 
implementation class:org.apache.hadoop.hive.metastore.ObjectStore
   [TThreadPoolServer WorkerProcess-4] INFO 
org.apache.hadoop.hive.metastore.ObjectStore - ObjectStore, initialize called
   [TThreadPoolServer WorkerProcess-4] INFO 
org.apache.hadoop.hive.metastore.ObjectStore - Initialized ObjectStore
   [TThreadPoolServer WorkerProcess-4] INFO 
org.apache.hadoop.hive.metastore.HiveMetaStore - 5: source:127.0.0.1 
get_all_tables: db=default
   [TThreadPoolServer WorkerProcess-4] INFO 
org.apache.hadoop.hive.metastore.HiveMetaStore.audit - ugi=coder    
ip=127.0.0.1    cmd=source:127.0.0.1 get_all_tables: db=default 
   [Test worker] INFO hive.metastore - Closed a connection to metastore, 
current connections: 3
   [TThreadPoolServer WorkerProcess-4] INFO 
org.apache.hadoop.hive.metastore.HiveMetaStore - 5: Cleaning up thread local 
RawStore...
   [TThreadPoolServer WorkerProcess-4] INFO 
org.apache.hadoop.hive.metastore.HiveMetaStore.audit - ugi=coder    
ip=127.0.0.1    cmd=Cleaning up thread local RawStore...        
   [TThreadPoolServer WorkerProcess-4] INFO 
org.apache.hadoop.hive.metastore.HiveMetaStore - 5: Done cleaning up thread 
local RawStore
   [TThreadPoolServer WorkerProcess-4] INFO 
org.apache.hadoop.hive.metastore.HiveMetaStore.audit - ugi=coder    
ip=127.0.0.1    cmd=Done cleaning up thread local RawStore      
   [Test worker] INFO org.apache.hadoop.hive.metastore.HiveMetaStore - 0: 
Cleaning up thread local RawStore...
   [Test worker] INFO org.apache.hadoop.hive.metastore.HiveMetaStore.audit - 
ugi=coder  ip=unknown-ip-addr      cmd=Cleaning up thread local RawStore...     
   
   [Test worker] INFO org.apache.hadoop.hive.metastore.HiveMetaStore - 0: Done 
cleaning up thread local RawStore
   [Test worker] INFO org.apache.hadoop.hive.metastore.HiveMetaStore.audit - 
ugi=coder  ip=unknown-ip-addr      cmd=Done cleaning up thread local RawStore   
   
   [Test worker] INFO org.apache.spark.SparkContext - SparkContext is stopping 
with exitCode 0 from stop at TestBase.java:115.
   [dispatcher-event-loop-1] INFO 
org.apache.spark.MapOutputTrackerMasterEndpoint - 
MapOutputTrackerMasterEndpoint stopped!
   [Test worker] INFO org.apache.iceberg.spark.SparkExecutorCache - 
Invalidating 0 keys associated with testhadoop.default.table
   [Test worker] INFO org.apache.iceberg.spark.SparkExecutorCache - Current 
cache stats CacheStats{hitCount=0, missCount=1, loadSuccessCount=1, 
loadFailureCount=0, totalLoadTime=17884132, evictionCount=0, evictionWeight=0}
   [Test worker] INFO org.apache.iceberg.spark.SparkExecutorCache - 
Invalidating 0 keys associated with testhadoop.default.table
   [Test worker] INFO org.apache.iceberg.spark.SparkExecutorCache - Current 
cache stats CacheStats{hitCount=0, missCount=1, loadSuccessCount=1, 
loadFailureCount=0, totalLoadTime=17884132, evictionCount=0, evictionWeight=0}
   [Test worker] INFO org.apache.spark.storage.memory.MemoryStore - MemoryStore 
cleared
   [Test worker] INFO org.apache.spark.storage.BlockManager - BlockManager 
stopped
   [Test worker] INFO org.apache.spark.storage.BlockManagerMaster - 
BlockManagerMaster stopped
   [dispatcher-event-loop-1] INFO 
org.apache.spark.scheduler.OutputCommitCoordinator$OutputCommitCoordinatorEndpoint
 - OutputCommitCoordinator stopped!
   [Test worker] INFO org.apache.spark.SparkContext - Successfully stopped 
SparkContext
   [Test worker] INFO org.eclipse.jetty.server.Server - Stopped 
oejs.Server@7abe27bf{STOPPING}[12.1.14,sto=0]
   [Test worker] INFO org.eclipse.jetty.server.AbstractConnector - Stopped 
oejs.ServerConnector@3b7b05a8{HTTP/1.1, (http/1.1)}{0.0.0.0:42645}
   [Test worker] INFO org.eclipse.jetty.ee10.servlet.ServletContextHandler - 
Stopped 
oeje10s.ServletContextHandler@7573e12f{ROOT,/,b=null,a=AVAILABLE,h=oejcs.CompressionHandler@51b1a8f6{STOPPED,supported=gzip}}
   ]]></system-err>
   </testsuite>
   ```
   </details>
   <details>
   <summary>Evidence: JUnit XML TestScanDuration</summary>
   
   ```text
   <?xml version="1.0" encoding="UTF-8"?>
   <testsuite name="org.apache.iceberg.spark.source.metrics.TestScanDuration" 
tests="5" skipped="0" failures="0" errors="0" 
timestamp="2026-11-22T04:27:18.287Z" 
hostname="vsowrirajan-microsoft-devbox-vsowrirajan-dev-6b698f4977-zvfhg" 
time="0.008">
     <properties/>
     <testcase name="aggregateTaskMetricsDoesNotMutateInput()" 
classname="org.apache.iceberg.spark.source.metrics.TestScanDuration" 
time="0.005"/>
     <testcase name="aggregateTaskMetricsSurfacesStragglers()" 
classname="org.apache.iceberg.spark.source.metrics.TestScanDuration" 
time="0.001"/>
     <testcase name="aggregateTaskMetricsIsLocaleIndependent()" 
classname="org.apache.iceberg.spark.source.metrics.TestScanDuration" 
time="0.001"/>
     <testcase name="aggregateTaskMetrics()" 
classname="org.apache.iceberg.spark.source.metrics.TestScanDuration" 
time="0.001"/>
     <testcase name="aggregateTaskMetricsWithNoTasks()" 
classname="org.apache.iceberg.spark.source.metrics.TestScanDuration" 
time="0.0"/>
     <system-out><![CDATA[]]></system-out>
     <system-err><![CDATA[]]></system-err>
   </testsuite>
   ```
   </details>
   
   ## Pipeline
   
   Updates from [git push 
no-mistakes](https://github.com/kunchenguid/no-mistakes)
   
   <!-- no-mistakes-pipeline-attestation:v1 
{"head_sha":"cabb935d3c171f79bc79ba4085768c8230e15a11","steps":[{"step":"intent","status":"completed"},{"step":"rebase","status":"completed"},{"step":"review","status":"completed"},{"step":"test","status":"completed"},{"step":"document","status":"completed"},{"step":"lint","status":"completed"},{"step":"push","status":"completed"},{"step":"pr","status":"running"},{"step":"ci","status":"pending"}],"live_validation":{"verdict":"go","live":5,"total":6}}
 -->
   
   <details>
   <summary>✅ **Intent** - passed</summary>
   
   ✅ No issues found.
   </details>
   
   <details>
   <summary>✅ **Rebase** - passed</summary>
   
   ✅ No issues found.
   </details>
   
   <details>
   <summary>✅ **Review** - passed</summary>
   
   ✅ No issues found.
   </details>
   
   <details>
   <summary>✅ **Test** - passed</summary>
   
   ✅ No issues found.
   - Live validation: ✅ go - 5 of 6 scenarios driven live against the product
   
   | Scenario | Result | Live | Evidence |
   | --- | --- | --- | --- |
   | Vectorized SELECT on an Iceberg table in local Spark 4.0 reports 
scanDuration &gt; 0 on the scan node | ✅ pass | live | TestSparkReadMetrics 
(existing metric tests plus scanDuration assertions) in gradle-test.log / JUnit 
XML |
   | Multi-file scan sums scanDuration across tasks and the SQL UI store shows 
it as &#39;total (min, med, max)&#39; with time units | ✅ pass | live | 
TestSparkReadMetrics.scanDurationAggregatedAcrossTasks |
   | Non-vectorized (RowDataReader) SELECT reports scanDuration &gt; 0 | ✅ pass 
| live | TestSparkReadMetrics.scanDurationForNonVectorizedRead (also asserts 
supportsColumnar()==false) |
   | Read with delete files still reports scanDuration alongside the delete 
metrics | ✅ pass | live | TestSparkReadMetrics.testDeleteMetrics |
   | ScanDuration aggregate formatting: units, stragglers, empty input, locale 
independence, no input mutation | ✅ pass | live | TestScanDuration (5 tests) |
   | A task that fails mid-iteration still accumulates scanDuration (finally 
block) | ⏸️ untested | no | A real Spark read has no public hook for injecting 
a mid-iteration reader failure without adding test-only fault-injection code. 
This behavior matches the already-merged Spark 4.1 implementation. |
   
   - <code>`./gradlew -DsparkVersions=4.0 
:iceberg-spark:iceberg-spark-4.0_2.13:test --tests 
org.apache.iceberg.spark.source.TestSparkReadMetrics --tests 
org.apache.iceberg.spark.source.metrics.TestScanDuration` (BUILD SUCCESSFUL; 
8/8 and 5/5 tests passed)</code>
   - `Diffed spark/v4.0 BaseReader/BatchDataReader/RowDataReader against 
spark/v4.1 to confirm parity of the scanDuration wiring`
   </details>
   
   <details>
   <summary>✅ **Document** - passed</summary>
   
   ✅ No issues found.
   </details>
   
   <details>
   <summary>✅ **Lint** - passed</summary>
   
   ✅ No issues found.
   </details>
   
   <details>
   <summary>✅ **Push** - passed</summary>
   
   ✅ No issues found.
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to