You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] addtotals and addcoltotals are O(n²) in the field count: numeric fields are found with a case-insensitive lookup per field #6000
When no fields are given, addtotals and addcoltotals find the numeric fields with getAllNumericFields. For every field, it calls isNumericFieldName, which looks the field up again with a case-insensitive getField(fieldName, false, false). A case-insensitive lookup scans every field, so finding the numeric fields is O(n²).
This is one of two O(n²) costs in these commands. The other is a field(String) lookup per field, tracked in #5969.
Reproduce
The OpenTelemetry log index from #5991, with n attribute keys:
The exact-name lookup in the test was only for measurement. A case-insensitive lookup returns the first field whose name matches ignoring case, so a fix must keep that result, or deliberately change it, for indices with two fields whose names differ only in case.
Reference
Local single node from main (c7e2cea), 4 GB heap. The unit test uses the table from CalcitePPLWideNestedSchemaTest.
Activity