-
Notifications
You must be signed in to change notification settings - Fork 2.3k
[GRPC] Upgrade to protobufs 0.24.0 and fix compilation errors #20059
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
7e50b84
[GRPC] Upgrade to protobufs 0.24.0 and fix compilation errors
karenyrx 0f88fad
[GRPC] Upgrade to protobufs 0.24.0 and fix compilation errors
karenyrx 89487ca
add hasXXX check for fields changed from required to optional, add fo…
karenyrx b393263
replace with ProtobufEnumUtils and add tests
karenyrx c28dcc5
remove changelog entry dup
karenyrx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 4330dd089f853e345aa137708490aec841ffadc0 |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 4330dd089f853e345aa137708490aec841ffadc0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
.../main/java/org/opensearch/transport/grpc/proto/request/search/DerivedFieldProtoUtils.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| /* | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| * | ||
| * The OpenSearch Contributors require contributions made to | ||
| * this file be licensed under the Apache-2.0 license or a | ||
| * compatible open source license. | ||
| */ | ||
| package org.opensearch.transport.grpc.proto.request.search; | ||
|
|
||
| import org.opensearch.index.mapper.DerivedField; | ||
| import org.opensearch.transport.grpc.proto.request.common.ObjectMapProtoUtils; | ||
| import org.opensearch.transport.grpc.proto.request.common.ScriptProtoUtils; | ||
|
|
||
| /** | ||
| * Utility class for converting DerivedField Protocol Buffers to OpenSearch DerivedField objects. | ||
| * This class handles the conversion of Protocol Buffer representations to their | ||
| * corresponding OpenSearch derived field objects, matching the REST side pattern. | ||
| * | ||
| * @see org.opensearch.index.mapper.DerivedFieldMapper.Builder#build(org.opensearch.index.mapper.Mapper.BuilderContext) | ||
| * @see org.opensearch.index.mapper.DefaultDerivedFieldResolver#initDerivedFieldTypes(java.util.Map, java.util.List) | ||
| */ | ||
| public class DerivedFieldProtoUtils { | ||
|
|
||
| private DerivedFieldProtoUtils() { | ||
| // Utility class, no instances | ||
| } | ||
|
|
||
| /** | ||
| * Converts a Protocol Buffer DerivedField to its corresponding OpenSearch DerivedField. | ||
| * Uses the same pattern as REST side: always use simple constructor, then conditionally | ||
| * set optional fields based on presence (matches DerivedFieldMapper.Builder.build() pattern). | ||
| * | ||
| * | ||
| * <p>This matches the REST side's {@code Parameter.isConfigured()} pattern in | ||
| * {@link org.opensearch.index.mapper.DerivedFieldMapper.Builder#build}, where optional | ||
| * fields are only set if they were present in the request.</p> | ||
| * | ||
| * @param name The name of the derived field | ||
| * @param derivedFieldProto The Protocol Buffer DerivedField to convert | ||
| * @return The corresponding OpenSearch DerivedField with optional fields set | ||
| * @see org.opensearch.index.mapper.DerivedFieldMapper.Builder#build(org.opensearch.index.mapper.Mapper.BuilderContext) | ||
| * @see org.opensearch.index.mapper.ParametrizedFieldMapper.Parameter#isConfigured() | ||
| */ | ||
| public static DerivedField fromProto(String name, org.opensearch.protobufs.DerivedField derivedFieldProto) { | ||
| // Always use simple constructor first (matches REST side pattern in DerivedFieldMapper.Builder.build()) | ||
| DerivedField derivedField = new DerivedField( | ||
| name, | ||
| derivedFieldProto.getType(), | ||
| ScriptProtoUtils.parseFromProtoRequest(derivedFieldProto.getScript()) | ||
| ); | ||
|
|
||
| // Conditionally set optional fields based on presence (matches REST side's isConfigured() pattern) | ||
| if (derivedFieldProto.hasProperties()) { | ||
| derivedField.setProperties(ObjectMapProtoUtils.fromProto(derivedFieldProto.getProperties())); | ||
| } | ||
| if (derivedFieldProto.hasPrefilterField()) { | ||
| derivedField.setPrefilterField(derivedFieldProto.getPrefilterField()); | ||
| } | ||
| if (derivedFieldProto.hasFormat()) { | ||
| derivedField.setFormat(derivedFieldProto.getFormat()); | ||
| } | ||
| if (derivedFieldProto.hasIgnoreMalformed()) { | ||
| derivedField.setIgnoreMalformed(derivedFieldProto.getIgnoreMalformed()); | ||
| } | ||
|
|
||
| return derivedField; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.