Skip to content
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

Support common format geo point #2801

Merged
merged 4 commits into from
Aug 1, 2024

Conversation

bugmakerrrrrr
Copy link
Contributor

Description

Currently, we only support geo point in the format of an object with a latitude and longitude, this PR aims to expand our support to all common formats that are described in OpenSearch doc.

Issues Resolved

#1432

Check List

  • New functionality includes testing.
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented.
    • New functionality has javadoc added
    • New functionality has user manual doc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@bugmakerrrrrr
Copy link
Contributor Author

@dai-chen you might be interested in this :) Could you please take a look when you get a chance?

* @param supportArrays Parsing the whole array or not
* @return Geo point value parsed from content.
*/
private ExprValue parseGeoPoint(Content content, boolean supportArrays) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

From the doc, there seems 6 ways to represent a geo point. Could you clarify in comment which code block is handling which format?

@LantaoJin
Copy link
Member

The build failures contains low code test coverage: Execution failed for task ':opensearch:jacocoTestCoverageVerification'. Please run ./gradlew build in local and check the jacoco report file.


var elements = content.array();
var first = elements.next();
// an array in the [longitude, latitude] format.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dai-chen Actually, I have commented on one format. The other formats are handled by GeoUtils#parseGeoPoint.

@LantaoJin
Copy link
Member

LantaoJin commented Jul 16, 2024

Seems the workflows were not triggered correctly. @bugmakerrrrrr Could u merge latest change from main and re-run test? (try to avoid force-push)

Signed-off-by: panguixin <panguixin@bytedance.com>
Signed-off-by: panguixin <panguixin@bytedance.com>
Signed-off-by: panguixin <panguixin@bytedance.com>
@bugmakerrrrrr
Copy link
Contributor Author

Seems the workflows were not triggered correctly. @bugmakerrrrrr Could u merge latest change from main and re-run test? (try to avoid force-push)

After rebasing the main branch, it appears that I have to perform a force push.

@LantaoJin
Copy link
Member

You can git merge latest upstream/main to your local dev branch then push to your origin/[dev branch].

@LantaoJin
Copy link
Member

LantaoJin commented Jul 17, 2024

Unit tests passed, fundamentally LGTM, @bugmakerrrrrr could you add a new IT similar to integ-test/src/test/java/org/opensearch/sql/sql/DateTimeFormatsIT.java?

Now only one geo_point format case used in IT, ref

{"boolean_value": true, "keyword_value": "keyword", "text_value": "text", "binary_value": "U29tZSBiaW5hcnkgYmxvYg==", "date_value": "2020-10-13 13:00:00", "date_nanos_value": "2019-03-23T21:34:46.123456789-04:00", "ip_value": "127.0.0.1", "object_value": {"first": "Dale", "last": "Dale"}, "nested_value": [{"first" : "John", "last" : "Smith"}, {"first" : "Alice", "last" : "White"}], "geo_point_value": { "lat": 40.71, "lon": 74.00 }}
, you can add more rows in this file or add a new json file.

Signed-off-by: panguixin <panguixin@bytedance.com>
Copy link
Member

@LantaoJin LantaoJin left a comment

Choose a reason for hiding this comment

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

Thanks for the changes!
cc @dai-chen

@bugmakerrrrrr
Copy link
Contributor Author

@LantaoJin @dai-chen can we merge this?

@LantaoJin
Copy link
Member

@penghuo do you have a chance to review this?

Copy link
Collaborator

@penghuo penghuo left a comment

Choose a reason for hiding this comment

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

Thanks for the change!

@penghuo penghuo merged commit 82ef68e into opensearch-project:main Aug 1, 2024
14 of 15 checks passed
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 128

To backport manually, run these commands in your terminal:

# Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/sql/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/sql/backport-2.x
# Create a new branch
git switch --create backport/backport-2801-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 82ef68e2b25c7c10740e74968bbe960c000c1cee
# Push it to GitHub
git push --set-upstream origin backport/backport-2801-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/sql/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-2801-to-2.x.

@penghuo
Copy link
Collaborator

penghuo commented Aug 1, 2024

@bugmakerrrrrr could u help resolve conflict and submit backport PR to 2.x. #2801 (comment)

bugmakerrrrrr added a commit to bugmakerrrrrr/sql that referenced this pull request Aug 5, 2024
---------
Signed-off-by: panguixin <panguixin@bytedance.com>
(cherry picked from commit 82ef68e)
@bugmakerrrrrr
Copy link
Contributor Author

@bugmakerrrrrr could u help resolve conflict and submit backport PR to 2.x. #2801 (comment)

#2896

LantaoJin pushed a commit that referenced this pull request Aug 6, 2024
---------
Signed-off-by: panguixin <panguixin@bytedance.com>
(cherry picked from commit 82ef68e)
manasvinibs pushed a commit to manasvinibs/sql that referenced this pull request Aug 14, 2024
---------
Signed-off-by: panguixin <panguixin@bytedance.com>
jzonthemtn pushed a commit to jzonthemtn/sql that referenced this pull request Aug 28, 2024
---------
Signed-off-by: panguixin <panguixin@bytedance.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants