- Notifications
You must be signed in to change notification settings - Fork 25.6k
Fix a bug with flattened fields in terms aggregations #87392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix a bug with flattened fields in terms aggregations #87392
Conversation
| Hi @not-napoleon, I've created a changelog YAML for you. |
…on/elasticsearch into flattened-field-terms-agg-bug
👍 |
| public class TermsAggregatorFactory extends ValuesSourceAggregatorFactory { | ||
| static Boolean REMAP_GLOBAL_ORDS, COLLECT_SEGMENT_ORDS; | ||
| | ||
| protected static final Logger logger = LogManager.getLogger(TermsAggregatorFactory.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd go with private just for a bit of paranoia.
For what it's worth LogManger.getLogger() is very very fast. I still use the getLogger(class) mostly though.
| } | ||
| | ||
| // TODO: [Zach] we might want refactor and remove ExecutionMode#create(), moving that logic outside the enum | ||
| logger.info("Creating bytes terms aggregator with execution mode [" + execution + "]"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These'd probably be fine to keep with debug if you like. Though you should do the [{}]` substitution thing.
| @Override | ||
| public boolean supportsGlobalOrdinalsMapping() { | ||
| return valuesSource.supportsGlobalOrdinalsMapping(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💥
| Pinging @elastic/es-analytics-geo (Team:Analytics) |
| Pinging @elastic/clients-team (Team:Clients) |
The root cause here was that missing did not correctly delegate `supportsGlobalOrdinalsMappnig` to the wrapped values source, instead falling back to the default. I've added the delegation, and made the base method abstract so this doesn't happen again.
The root cause here was that missing did not correctly delegate `supportsGlobalOrdinalsMappnig` to the wrapped values source, instead falling back to the default. I've added the delegation, and made the base method abstract so this doesn't happen again.
…87507) The root cause here was that missing did not correctly delegate `supportsGlobalOrdinalsMappnig` to the wrapped values source, instead falling back to the default. I've added the delegation, and made the base method abstract so this doesn't happen again.
…#87506) * Fix a bug with flattened fields in terms aggregations (#87392) The root cause here was that missing did not correctly delegate `supportsGlobalOrdinalsMappnig` to the wrapped values source, instead falling back to the default. I've added the delegation, and made the base method abstract so this doesn't happen again. * BWC version dance, part one * Fix flattened object format
The bug occurs when terms incorrectly chooses the
LowCardinalityoptimization with a flattened field. This can only happen ifsupportsGlobalOrdinalsMappingis true, which it usually is not for flattened fields. But, when we wrap theValuesSourceto add in the missing value, we weren't delegating that method, which led to this bug.Draft because I still need to do some more testing, and probably
supportsGlobalOrdinalsMappingshould be abstract so this doesn't happen anywhere else.