Skip to content

Regression in 482: SELECT on Iceberg $partitions fails with MethodTooLargeException for wide tables #30311

Description

@guyco33

Trino version

482

Please describe the bug

Summary

SELECT * FROM "<table>$partitions" (or any projection that includes the data column) on an Iceberg table with ~120 columns fails on Trino 482 with QUERY_EXCEEDED_COMPILER_LIMIT / MethodTooLargeException. The same query on the same table succeeds on Trino 481.

Environment

  • Trino 482 (fails), Trino 481 (works)
  • Iceberg connector, format-version 2, Parquet
  • The table is unpartitioned; the failure is in projection compilation, so it reproduces on a completely empty table (no INSERT needed)

Steps to reproduce

  1. Create the table below (121 columns; real production schema with column names anonymized).
CREATE TABLE (fails on 482)
CREATE TABLE iceberg.tmp.repro_wide_tbl (
    col_001 bigint,
    col_002 varchar,
    col_003 timestamp(6) with time zone,
    col_004 boolean,
    col_005 timestamp(6) with time zone,
    col_006 boolean,
    col_007 bigint,
    col_008 varchar,
    col_009 varchar,
    col_010 varchar,
    col_011 varchar,
    col_012 varchar,
    col_013 bigint,
    col_014 varchar,
    col_015 varchar,
    col_016 varchar,
    col_017 varchar,
    col_018 bigint,
    col_019 varchar,
    col_020 varchar,
    col_021 varchar,
    col_022 bigint,
    col_023 varchar,
    col_024 varchar,
    col_025 varchar,
    col_026 boolean,
    col_027 boolean,
    col_028 boolean,
    col_029 varchar,
    col_030 timestamp(6) with time zone,
    col_031 varchar,
    col_032 integer,
    col_033 varchar,
    col_034 bigint,
    col_035 varchar,
    col_036 varchar,
    col_037 bigint,
    col_038 timestamp(6) with time zone,
    col_039 timestamp(6) with time zone,
    col_040 timestamp(6) with time zone,
    col_041 varchar,
    col_042 varchar,
    col_043 varchar,
    col_044 varchar,
    col_045 varchar,
    col_046 varchar,
    col_047 varchar,
    col_048 varchar,
    col_049 varchar,
    col_050 double,
    col_051 double,
    col_052 timestamp(6) with time zone,
    col_053 varchar,
    col_054 timestamp(6) with time zone,
    col_055 timestamp(6) with time zone,
    col_056 array(bigint),
    col_057 varchar,
    col_058 varchar,
    col_059 double,
    col_060 double,
    col_061 timestamp(6) with time zone,
    col_062 varchar,
    col_063 varchar,
    col_064 varchar,
    col_065 varchar,
    col_066 varchar,
    col_067 varchar,
    col_068 varchar,
    col_069 double,
    col_070 double,
    col_071 timestamp(6) with time zone,
    col_072 varchar,
    col_073 timestamp(6) with time zone,
    col_074 timestamp(6) with time zone,
    col_075 array(bigint),
    col_076 varchar,
    col_077 varchar,
    col_078 double,
    col_079 double,
    col_080 timestamp(6) with time zone,
    col_081 decimal(12, 2),
    col_082 timestamp(6) with time zone,
    col_083 timestamp(6) with time zone,
    col_084 decimal(15, 2),
    col_085 decimal(15, 2),
    col_086 decimal(13, 2),
    col_087 decimal(14, 2),
    col_088 decimal(13, 2),
    col_089 decimal(13, 2),
    col_090 varchar,
    col_091 decimal(14, 2),
    col_092 decimal(14, 2),
    col_093 decimal(13, 2),
    col_094 decimal(13, 2),
    col_095 decimal(13, 2),
    col_096 decimal(13, 2),
    col_097 decimal(13, 2),
    col_098 decimal(13, 2),
    col_099 decimal(14, 2),
    col_100 decimal(13, 2),
    col_101 varchar,
    col_102 varchar,
    col_103 decimal(13, 2),
    col_104 decimal(13, 2),
    col_105 decimal(13, 2),
    col_106 decimal(13, 2),
    col_107 decimal(13, 2),
    col_108 decimal(13, 2),
    col_109 decimal(13, 2),
    col_110 decimal(13, 2),
    col_111 decimal(13, 2),
    col_112 decimal(13, 2),
    col_113 decimal(13, 2),
    col_114 decimal(13, 2),
    col_115 decimal(13, 2),
    col_116 decimal(13, 2),
    col_117 decimal(13, 2),
    col_118 decimal(13, 2),
    col_119 decimal(13, 2),
    col_120 decimal(13, 2),
    col_121 decimal(13, 2)
)
WITH (
    format = 'PARQUET',
    format_version = 2
);
  1. Query the partitions metadata table (the table can stay empty):
SELECT data FROM iceberg.tmp."repro_wide_tbl$partitions";

Expected behavior

The query compiles and runs, as it does on Trino 481 (zero rows for an empty table, or one row with the data stats for a populated one).

Actual behavior on 482

QUERY_EXCEEDED_COMPILER_LIMIT: Failed to execute query; there may be too many columns used or expressions are too complex

Worker-side stack trace (truncated):

io.trino.spi.TrinoException: Failed to execute query; there may be too many columns used or expressions are too complex
	at io.trino.sql.gen.PageFunctionCompiler.compileProjectionClass(PageFunctionCompiler.java:226)
	at io.trino.sql.gen.PageFunctionCompiler.lambda$compileProjection$2(PageFunctionCompiler.java:192)
	...
	at io.trino.sql.gen.ExpressionCompiler.compilePageProcessor(ExpressionCompiler.java:70)
	at io.trino.sql.planner.LocalExecutionPlanner$Visitor.visitScanFilterAndProject(LocalExecutionPlanner.java:2108)
	...
Caused by: io.airlift.bytecode.CompilationException: Error compiling class: io/trino/$gen/PageProjectionWork_20260713_143223_4377
	...
Caused by: org.objectweb.asm.MethodTooLargeException: Method too large: io/trino/$gen/PageProjectionWork_20260713_143223_4377.partialRowConstructor1926752054_0 (Lio/trino/spi/connector/ConnectorSession;I[Lio/trino/spi/block/BlockBuilder;)V
	at org.objectweb.asm.MethodWriter.computeMethodInfoSize(MethodWriter.java:2088)
	at org.objectweb.asm.ClassWriter.toByteArray(ClassWriter.java:506)
	at io.airlift.bytecode.ByteCodeGenerator.generateByteCode(ByteCodeGenerator.java:103)

Workarounds that succeed on 482: selecting only the scalar columns (record_count, file_count, total_size), or dereferencing a few fields of data (data.col_003.min).

Observations

The failure depends on the type mix of the stats row, not the raw column count. On the same 482 cluster, SELECT data on the $partitions table of a wider table (157 columns) succeeds. The difference:

failing table passing table
Columns with stats in data 119 (2 array columns excluded) 157
timestamp(6) with time zone 16 9
varchar ~46 ~44
long-backed types (decimal(p<=18), bigint, ...) ~44 ~100

The passing table is dominated by decimal(13,2)/bigint (single long per value, compact codegen), while the failing table carries more timestamp(6) with time zone (LongTimestampWithTimeZone, 128-bit object type) and varchar min/max fields, which generate much bulkier bytecode. This suggests the partialRowConstructor split introduced for large row constructors chunks by field count rather than by estimated bytecode size, so a chunk of heavyweight fields can still exceed the JVM 64KB method limit. Since 481 handles the identical schema, something in 482 changed the generated-code size or the split boundaries.

CREATE TABLE for the 157-column table that passes on 482 (counter-example)
CREATE TABLE iceberg.tmp.repro_wide_tbl_2 (
    col_001 bigint,
    col_002 varchar,
    col_003 varchar,
    col_004 bigint,
    col_005 varchar,
    col_006 bigint,
    col_007 bigint,
    col_008 bigint,
    col_009 bigint,
    col_010 bigint,
    col_011 bigint,
    col_012 timestamp(6) with time zone,
    col_013 varchar,
    col_014 timestamp(6) with time zone,
    col_015 timestamp(6) with time zone,
    col_016 timestamp(6) with time zone,
    col_017 timestamp(6) with time zone,
    col_018 timestamp(6) with time zone,
    col_019 timestamp(6) with time zone,
    col_020 integer,
    col_021 varchar,
    col_022 varchar,
    col_023 varchar,
    col_024 integer,
    col_025 integer,
    col_026 varchar,
    col_027 varchar,
    col_028 varchar,
    col_029 bigint,
    col_030 varchar,
    col_031 bigint,
    col_032 bigint,
    col_033 bigint,
    col_034 varchar,
    col_035 varchar,
    col_036 varchar,
    col_037 varchar,
    col_038 varchar,
    col_039 decimal(13, 2),
    col_040 decimal(13, 2),
    col_041 decimal(13, 2),
    col_042 decimal(13, 2),
    col_043 decimal(15, 4),
    col_044 double,
    col_045 decimal(13, 2),
    col_046 decimal(13, 2),
    col_047 decimal(13, 2),
    col_048 decimal(13, 2),
    col_049 decimal(13, 2),
    col_050 decimal(13, 2),
    col_051 decimal(13, 2),
    col_052 decimal(13, 2),
    col_053 decimal(13, 2),
    col_054 decimal(13, 2),
    col_055 decimal(13, 2),
    col_056 decimal(13, 2),
    col_057 decimal(13, 2),
    col_058 decimal(13, 2),
    col_059 decimal(13, 2),
    col_060 decimal(13, 2),
    col_061 decimal(13, 2),
    col_062 decimal(13, 2),
    col_063 decimal(13, 2),
    col_064 decimal(13, 2),
    col_065 decimal(13, 2),
    col_066 decimal(13, 2),
    col_067 decimal(13, 2),
    col_068 decimal(13, 2),
    col_069 decimal(13, 2),
    col_070 decimal(13, 2),
    col_071 boolean,
    col_072 varchar,
    col_073 decimal(13, 2),
    col_074 decimal(13, 2),
    col_075 decimal(13, 2),
    col_076 varchar,
    col_077 decimal(13, 2),
    col_078 decimal(13, 2),
    col_079 decimal(13, 2),
    col_080 decimal(13, 2),
    col_081 decimal(13, 2),
    col_082 decimal(13, 2),
    col_083 decimal(13, 2),
    col_084 decimal(13, 2),
    col_085 decimal(13, 2),
    col_086 varchar,
    col_087 varchar,
    col_088 varchar,
    col_089 varchar,
    col_090 bigint,
    col_091 bigint,
    col_092 decimal(13, 2),
    col_093 varchar,
    col_094 varchar,
    col_095 varchar,
    col_096 decimal(13, 2),
    col_097 decimal(13, 2),
    col_098 bigint,
    col_099 decimal(13, 2),
    col_100 decimal(13, 2),
    col_101 decimal(13, 2),
    col_102 decimal(13, 2),
    col_103 decimal(13, 2),
    col_104 decimal(13, 2),
    col_105 varchar,
    col_106 decimal(13, 2),
    col_107 varchar,
    col_108 varchar,
    col_109 decimal(13, 2),
    col_110 decimal(13, 2),
    col_111 decimal(13, 2),
    col_112 varchar,
    col_113 decimal(13, 2),
    col_114 decimal(13, 2),
    col_115 decimal(13, 2),
    col_116 decimal(13, 2),
    col_117 varchar,
    col_118 decimal(13, 2),
    col_119 decimal(13, 2),
    col_120 decimal(13, 2),
    col_121 varchar,
    col_122 varchar,
    col_123 varchar,
    col_124 decimal(13, 3),
    col_125 decimal(13, 3),
    col_126 varchar,
    col_127 bigint,
    col_128 varchar,
    col_129 varchar,
    col_130 decimal(13, 2),
    col_131 varchar,
    col_132 varchar,
    col_133 varchar,
    col_134 decimal(13, 2),
    col_135 decimal(13, 2),
    col_136 decimal(13, 2),
    col_137 decimal(13, 2),
    col_138 decimal(13, 2),
    col_139 decimal(13, 2),
    col_140 decimal(13, 2),
    col_141 double,
    col_142 decimal(13, 2),
    col_143 decimal(13, 2),
    col_144 decimal(13, 2),
    col_145 varchar,
    col_146 varchar,
    col_147 decimal(13, 2),
    col_148 decimal(13, 2),
    col_149 decimal(13, 2),
    col_150 decimal(13, 2),
    col_151 decimal(13, 2),
    col_152 decimal(13, 2),
    col_153 decimal(13, 2),
    col_154 decimal(13, 2),
    col_155 timestamp(6) with time zone,
    col_156 bigint,
    col_157 timestamp(6) with time zone
)
WITH (
    format = 'PARQUET',
    format_version = 2
);

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions