{"record":{"id":"c60d561d1112302e","repo":"apache/iceberg","slug":"seektonewsource-not-supported","errorCode":null,"errorMessage":"seekToNewSource not supported","messagePattern":"seekToNewSource not supported","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"info","filePath":"core/src/main/java/org/apache/iceberg/hadoop/HadoopStreams.java","lineNumber":231,"sourceCode":"    private final SeekableInputStream inputStream;\n\n    private WrappedSeekableInputStream(SeekableInputStream inputStream) {\n      this.inputStream = inputStream;\n    }\n\n    @Override\n    public void seek(long pos) throws IOException {\n      inputStream.seek(pos);\n    }\n\n    @Override\n    public long getPos() throws IOException {\n      return inputStream.getPos();\n    }\n\n    @Override\n    public boolean seekToNewSource(long targetPos) throws IOException {\n      throw new UnsupportedOperationException(\"seekToNewSource not supported\");\n    }\n\n    @Override\n    public int read() throws IOException {\n      return inputStream.read();\n    }\n\n    @Override\n    public int read(byte[] b, int off, int len) throws IOException {\n      return inputStream.read(b, off, len);\n    }\n\n    @Override\n    public void close() throws IOException {\n      inputStream.close();\n    }\n\n    @Override","sourceCodeStart":213,"sourceCodeEnd":249,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/hadoop/HadoopStreams.java#L213-L249","documentation":"HadoopStreams' SeekableInputStream wrapper does not implement seekToNewSource and always throws UnsupportedOperationException. seekToNewSource (HDFS locality re-read from a different replica) is not part of the abstraction this wrapper provides.","triggerScenarios":"Any code path calling seekToNewSource(targetPos) on a stream obtained from HadoopStreams.wrap(...) — typically Hadoop/HDFS reader internals or checksum-retry logic falling back to a new source.","commonSituations":"HDFS ReadCallbacks or FileSystem-level retry code invoking seekToNewSource after block read failures; generic code written against org.apache.hadoop.fs.Seekable assuming full Seekable support.","solutions":["Avoid calling seekToNewSource; use seek(pos) and read() instead","Handle UnsupportedOperationException and retry reads via seek(0)/re-open the file rather than seeking to a new source","If HDFS-locality fallback is required, use the raw HDFS FSDataInputStream instead of the wrapped Iceberg stream"],"exampleFix":"// before\nin.seekToNewSource(targetPos); // throws\n// after\ntry { in.seekToNewSource(targetPos); }\ncatch (UnsupportedOperationException e) { in.seek(0); /* re-read from start */ }","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { in.seekToNewSource(pos); }\ncatch (UnsupportedOperationException e) {\n  in.seek(0); // or re-open the file and re-read\n}","preventionTips":["Design readers around seek()/read() only, never seekToNewSource","Use the raw FSDataInputStream when HDFS replica fallback is required","Add a recovery path that re-opens the input file on read failures"],"tags":["hadoop","streaming","unsupported"],"backgroundTag":"method-not-implemented","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}