Skip to content

Rebase keyed JSON ordinals to start from zero.#41282

Merged
jtibshirani merged 5 commits intoelastic:object-fieldsfrom
jtibshirani:rebase-global-ords
Apr 17, 2019
Merged

Rebase keyed JSON ordinals to start from zero.#41282
jtibshirani merged 5 commits intoelastic:object-fieldsfrom
jtibshirani:rebase-global-ords

Conversation

@jtibshirani
Copy link
Copy Markdown
Contributor

This PR updates KeyedJsonAtomicFieldData to always return ordinals in the
range [0, (maxOrd - minOrd)], which is necessary for certain aggregations and
sorting options to be supported.

As discussed in #41220, I opted not to support
KeyedIndexFieldData#getOrdinalMap, as it would add substantial complexity.
The one place this affects is the 'low cardinality' optimization for terms
aggregations, which now needs to be disabled for keyed JSON fields.

It was fairly difficult to incorporate this change, and I have a couple
follow-up refactors in mind to help simplify the global ordinals code. (I will
likely wait until this feature branch is merged though before opening PRs on
master).

@jtibshirani jtibshirani added >enhancement :Search Foundations/Mapping Index mappings, including merging and defining field types labels Apr 17, 2019
@jtibshirani jtibshirani requested review from jimczi and jpountz April 17, 2019 00:41
@elasticmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-search

Copy link
Copy Markdown
Contributor

@jimczi jimczi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks great, thanks for iterating @jtibshirani

public OrdinalMap getOrdinalMap() {
return delegate.getOrdinalMap();
throw new UnsupportedOperationException("Keyed JSON field data does not allow access to the" +
" underlying ordinal map.");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add the field name to the error message to make it easier to debug?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


/**
* Whether this values source is able to provide a mapping between global and segment ordinals,
* by returning the underlying {@link OrdinalMap}. If this method returnns false, then calling
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/returnns/returns/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@jtibshirani
Copy link
Copy Markdown
Contributor Author

@elasticmachine run elasticsearch-ci/1

@jtibshirani jtibshirani merged commit a62bf1e into elastic:object-fields Apr 17, 2019
@jtibshirani jtibshirani deleted the rebase-global-ords branch April 17, 2019 18:43
jtibshirani added a commit that referenced this pull request May 1, 2019
This PR updates `KeyedJsonAtomicFieldData` to always return ordinals in the
range `[0, (maxOrd - minOrd)]`, which is necessary for certain aggregations and
sorting options to be supported.

As discussed in #41220, I opted not to support
`KeyedIndexFieldData#getOrdinalMap`, as it would add substantial complexity.
The one place this affects is the 'low cardinality' optimization for terms
aggregations, which now needs to be disabled for keyed JSON fields.

It was fairly difficult to incorporate this change, and I have a couple
follow-up refactors in mind to help simplify the global ordinals code. (I will
likely wait until this feature branch is merged though before opening PRs on
master).
jtibshirani added a commit that referenced this pull request May 24, 2019
This PR updates `KeyedJsonAtomicFieldData` to always return ordinals in the
range `[0, (maxOrd - minOrd)]`, which is necessary for certain aggregations and
sorting options to be supported.

As discussed in #41220, I opted not to support
`KeyedIndexFieldData#getOrdinalMap`, as it would add substantial complexity.
The one place this affects is the 'low cardinality' optimization for terms
aggregations, which now needs to be disabled for keyed JSON fields.

It was fairly difficult to incorporate this change, and I have a couple
follow-up refactors in mind to help simplify the global ordinals code. (I will
likely wait until this feature branch is merged though before opening PRs on
master).
jtibshirani added a commit that referenced this pull request May 29, 2019
This PR updates `KeyedJsonAtomicFieldData` to always return ordinals in the
range `[0, (maxOrd - minOrd)]`, which is necessary for certain aggregations and
sorting options to be supported.

As discussed in #41220, I opted not to support
`KeyedIndexFieldData#getOrdinalMap`, as it would add substantial complexity.
The one place this affects is the 'low cardinality' optimization for terms
aggregations, which now needs to be disabled for keyed JSON fields.

It was fairly difficult to incorporate this change, and I have a couple
follow-up refactors in mind to help simplify the global ordinals code. (I will
likely wait until this feature branch is merged though before opening PRs on
master).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>enhancement :Search Foundations/Mapping Index mappings, including merging and defining field types

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants