-
Notifications
You must be signed in to change notification settings - Fork 190
[BUG] Script Size Exceeded for Wide-Schema Indices #4597
Copy link
Copy link
Closed
Labels
PPLPiped processing languagePiped processing languagebugSomething isn't workingSomething isn't working
Description
Summary
Queries against wide-schema indices (100+ fields) fail with script size exceeded even when the query references only a few fields. The Calcite engine appears to serialize all index fields into the execution script, causing the generated script to exceed OpenSearch’s 64 KB inline script limit (script.max_size_in_bytes).
Error (example):
java.lang.IllegalArgumentException: exceeded max allowed inline script size in bytes [65535] with size [130362] for script
Steps to Reproduce
- Create a wide-schema index (example with 600+ fields):
PUT /wide_schema_index
{
"mappings": {
"properties": {
"@timestamp": { "type": "date" },
"message": { "type": "text" }
// ... 600+ additional fields (attributes.*, metrics.*, tags.*, resource.*)
}
}
}- Run a simple PPL query referencing 1–2 fields:
POST /_plugins/_ppl
{
"query": "source=wide_schema_index | bin @timestamp span=1minute | stats count() by `@timestamp`"
}- Observe the failure:
{
"error": {
"reason": "Error occurred in OpenSearch engine: all shards failed",
"details": "java.lang.IllegalArgumentException: exceeded max allowed inline script size in bytes [65535] with size [130362]"
}
}Expected Result
- Query succeeds, since it references only a small subset of fields.
Actual Result
- Query fails with
script size exceededbecause the generated script includes all fields from the index mapping.
Suspected Root Cause
In CalciteLogicalIndexScan.java:
// Current behavior (collects ALL fields)
private Map<String, Map<String, ExprType>> getAllFieldTypes() {
return table.getRowType().getFieldList().stream() // returns ALL fields
.collect(Collectors.toMap(
field -> field.getName(),
field -> extractNestedTypes(field.getType())
));
}getFieldList()returns the entire schema; all fields are serialized into the execution script, making script size scale with total schema width rather than referenced fields.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
PPLPiped processing languagePiped processing languagebugSomething isn't workingSomething isn't working
Type
Projects
Status
Done