{"record":{"id":"84eb9b1939398345","repo":"apache/iceberg","slug":"batch-reading-is-not-supported-in-non-vectorized-r-84eb9b","errorCode":null,"errorMessage":"Batch reading is not supported in non-vectorized reader","messagePattern":"Batch reading is not supported in non-vectorized reader","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"parquet/src/main/java/org/apache/iceberg/parquet/ParquetFormatModel.java","lineNumber":391,"sourceCode":"      return this;\n    }\n\n    @Override\n    public ReadBuilder<D, S> set(String key, String value) {\n      internal.set(key, value);\n      return this;\n    }\n\n    @Override\n    public ReadBuilder<D, S> reuseContainers() {\n      internal.reuseContainers();\n      return this;\n    }\n\n    @Override\n    public ReadBuilder<D, S> recordsPerBatch(int numRowsPerBatch) {\n      if (!isBatchReader) {\n        throw new UnsupportedOperationException(\n            \"Batch reading is not supported in non-vectorized reader\");\n      }\n\n      internal.recordsPerBatch(numRowsPerBatch);\n      return this;\n    }\n\n    @Override\n    public ReadBuilder<D, S> idToConstant(Map<Integer, ?> newIdToConstant) {\n      this.idToConstant = newIdToConstant;\n      return this;\n    }\n\n    @Override\n    public ReadBuilder<D, S> withNameMapping(NameMapping nameMapping) {\n      internal.withNameMapping(nameMapping);\n      return this;\n    }","sourceCodeStart":373,"sourceCodeEnd":409,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/parquet/src/main/java/org/apache/iceberg/parquet/ParquetFormatModel.java#L373-L409","documentation":"ParquetFormatModel's ReadBuilder supports batch (vectorized) reading only when the reader was configured as a batch/vectorized reader. Calling recordsPerBatch(int) on a non-vectorized reader throws this UnsupportedOperationException because row-based readers cannot emit batches.","triggerScenarios":"Calling ReadBuilder.recordsPerBatch(numRowsPerBatch) without first calling the option that enables batch/vectorized reading (isBatchReader is false).","commonSituations":"Configuring record batching for a plain row-oriented record reader; forgetting to enable vectorization (e.g. via a 'batch-format' or vectorization option) before setting batch size.","solutions":["Enable the vectorized/batch reader option before calling recordsPerBatch (e.g. set the appropriate ReadBuilder option such as batch format/vectorization)","Remove the recordsPerBatch call when using the non-vectorized reader","Verify reader type: only vectorized readers support batch sizing"],"exampleFix":"// before\nReadBuilder rb = io.newReadBuilder().project(schema).recordsPerBatch(1024); // non-vectorized\n// after\nReadBuilder rb = io.newReadBuilder()\n    .option(\"batch-format\", \"arrow\") // enables batch reader\n    .project(schema)\n    .recordsPerBatch(1024);","handlingStrategy":"validation","validationCode":"if (!isBatchReader) {\n  throw new IllegalStateException(\"recordsPerBatch requires the vectorized/batch reader\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  rb.recordsPerBatch(1024);\n} catch (UnsupportedOperationException e) {\n  // enable batch reader option or drop the recordsPerBatch call\n}","preventionTips":["Enable the vectorized/batch reader option before setting batch size","Only call recordsPerBatch when batch reading is configured","Document reader-type requirements in scan builders"],"tags":["parquet","reader","batch","unsupported-operation"],"backgroundTag":"feature-not-enabled","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}