JoshRosen opened a new issue, #17208:
URL: https://github.com/apache/iceberg/issues/17208

   ### Apache Iceberg version
   
   1.11.0 (latest release)
   
   ### Query engine
   
   Spark
   
   ### Please describe the bug 🐞
   
   As of version 1.11.0, Iceberg under-reports Hadoop read metrics due to 
pre-existing uninstrumented read paths in multiple FileIO implementations plus 
a "vectored read" change that routes more reads onto those paths.
   
   S3InputStream only increments its readBytes/readOperations counters in the 
sequential read methods:
   
   - 
[read()](https://github.com/apache/iceberg/blob/f2875fdccecfdc0e8ca6b09b248deb1b66bccb08/aws/src/main/java/org/apache/iceberg/aws/s3/S3InputStream.java#L131-L132)
   - [read(byte[], int, 
int)](https://github.com/apache/iceberg/blob/f2875fdccecfdc0e8ca6b09b248deb1b66bccb08/aws/src/main/java/org/apache/iceberg/aws/s3/S3InputStream.java#L157-L158)
   
   The positioned-read methods are not instrumented: `readFully(long, byte[], 
int, int)` and `readTail(byte[], int, int)` go through `readRange()`, which 
issues its own GetObject and never touches the counters. This has been true for 
as long as the counters have existed, but historically positioned reads carried 
little traffic (footers, tails), so the gap was hard to notice.
   
   As of 1.11.0, most Parquet data reads use these uninstrumented paths: 
`ParquetIO` now wraps `RangeReadable` streams in 
`ParquetRangeReadableInputStreamAdapter` (added in #13997), which advertises 
vectored-read support to `parquet-java`. Parquet data-page reads then flow 
through `RangeReadable.readVectored()`, whose default implementation delegates 
to the uninstrumented `readFully`.
   
   Since `HadoopMetricsContext` maps `READ_BYTES` → 
`FileSystem.Statistics.incrementBytesRead`, which Spark consumes for task input 
metrics, the effect is that nearly all data bytes read from an 
Iceberg/Parquet/S3 table are missing from Spark's input-byte metrics in 1.11.0. 
   
   The same pattern exists in the other `RangeReadable` FileIO streams: 
`GCSInputStream` and `ADLSInputStream` also increment 
`readBytes`/`readOperations` only in their sequential read methods (with 
`readFully`/`readTail` uninstrumented), so GCS and ADLS reads are affected the 
same way in 1.11.0. OSSInputStream does not implement `RangeReadable` and is 
currently unaffected, although it would be if #16865 lands.
   
   ### Willingness to contribute
   
   - [ ] I can contribute a fix for this bug independently
   - [ ] I would be willing to contribute a fix for this bug with guidance from 
the Iceberg community
   - [x] I cannot contribute a fix for this bug at this time


-- 
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