generated from amazon-archives/__template_Custom
-
Notifications
You must be signed in to change notification settings - Fork 178
PPL command expression implementation for geoip
#3228
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
acarbonetto
merged 78 commits into
opensearch-project:main
from
Bit-Quill:ft-ak-iplocation-cmd
Jan 30, 2025
Merged
Changes from 67 commits
Commits
Show all changes
78 commits
Select commit
Hold shift + click to select a range
de5f3a5
Update grammar structure
andy-k-improving b0ff56e
Inteception points
andy-k-improving 6533e21
Update dummy map values
andy-k-improving 90ef4eb
Test
andy-k-improving e46a3c9
Geo integration
andy-k-improving 0677050
Read ipString from user
andy-k-improving 1f7f507
Read option from user input
andy-k-improving f7b6fed
Update changes
andy-k-improving bb6b672
Support multiple method signature
andy-k-improving 9f3051d
Update result map format
andy-k-improving 039c8c2
Code cleanup
andy-k-improving 7341606
Spotless
andy-k-improving f1294b1
JavaDoc
andy-k-improving d68bdd0
Spotless
andy-k-improving 151afd6
Update unit test
andy-k-improving 8647055
Update unit-test wording
andy-k-improving 6338b87
Update unit test for eval
andy-k-improving a59b6a7
Update doc
andy-k-improving 5e72d0a
Unit test
andy-k-improving fe0c363
Unit-test 1
andy-k-improving a166f13
Update ipenrichment test-case
andy-k-improving 7fa70fa
Update test-cases
andy-k-improving 4826e69
Update gradle
andy-k-improving 4bf98a3
Geo plugin test case
andy-k-improving ab80496
Comment out security plugin
andy-k-improving 9e6f2b9
Geo ip index load
andy-k-improving 53896cf
Update integ with data content assert
andy-k-improving e4ec572
Integ test for geoip
andy-k-improving 675ebc9
Remove debug
andy-k-improving 4cdd458
Gradle task refactor
andy-k-improving 307c000
Remove duplicated urlDownload
andy-k-improving 204b8b1
Refactor gradle script
andy-k-improving ab46a91
Refactor integ test
andy-k-improving 8503176
Separate sscurity plugin test
andy-k-improving 2ecd20c
Refactor gradle file
andy-k-improving 03c5df6
Infer type
andy-k-improving 1488034
Update java doc
andy-k-improving 185ab9a
Simplifier provider
andy-k-improving ad9764c
Update test cases
andy-k-improving aa8abe5
Spotless check
andy-k-improving 6c193de
Github action for GeoSpatial build
andy-k-improving 3276f1f
Execlude geoip doc test
andy-k-improving 02da983
Fix test
andy-k-improving 15a196b
Test coverage
andy-k-improving ba8c1fc
Style fix
andy-k-improving f31b8c8
Update test caess
andy-k-improving b2bd6b0
Minimise diff
andy-k-improving cd4c5ea
Fix spot
andy-k-improving 8bd98e8
Rebase
andy-k-improving eeefc50
Update test-cases
andy-k-improving 058eaab
Update diff
andy-k-improving 68396d9
Typo
andy-k-improving e5407bd
Update spotless
andy-k-improving 738602e
Minimise diff
andy-k-improving cfd9970
Minimise diff
andy-k-improving e92ba96
Remove duplicated method
andy-k-improving 43b3c93
Separate logic
andy-k-improving 180822c
Spotless
andy-k-improving ccac16e
Update Java doc
andy-k-improving 7019452
Doc fix
andy-k-improving 41e99c6
Simplify Integtest
andy-k-improving a826375
Update doc
andy-k-improving 11f8bad
Spotless
andy-k-improving 9b735aa
Update comment
andy-k-improving c74f3fd
Update unitTest
andy-k-improving d981332
Update existing integTest
andy-k-improving 241ea63
Spotless
andy-k-improving 66e17ce
Doc fix
andy-k-improving 3d79741
Address code reivews
andy-k-improving c3a9348
Update diff
andy-k-improving 89f33e5
Minimise diff
andy-k-improving 11abfd6
Update test-cases
andy-k-improving b77d557
Update docs/user/ppl/functions/ip.rst
andy-k-improving 1b41d5f
Update opensearch/src/main/java/org/opensearch/sql/opensearch/planner…
andy-k-improving 694b08c
Update spotless
andy-k-improving ebc451a
Update coverage
andy-k-improving fbcaf0d
Spotless
andy-k-improving 96cc6f6
Update log
andy-k-improving 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 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
51 changes: 51 additions & 0 deletions
51
core/src/test/java/org/opensearch/sql/expression/ip/GeoIPFunctionTest.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,51 @@ | ||
| /* | ||
| * Copyright OpenSearch Contributors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| package org.opensearch.sql.expression.ip; | ||
|
|
||
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||
| import static org.junit.jupiter.api.Assertions.assertThrows; | ||
| import static org.junit.jupiter.api.Assertions.assertTrue; | ||
| import static org.opensearch.sql.data.type.ExprCoreType.BOOLEAN; | ||
| import static org.opensearch.sql.data.type.ExprCoreType.STRING; | ||
|
|
||
| import org.junit.jupiter.api.Test; | ||
| import org.junit.jupiter.api.extension.ExtendWith; | ||
| import org.mockito.Mock; | ||
| import org.mockito.junit.jupiter.MockitoExtension; | ||
| import org.opensearch.sql.data.model.ExprValue; | ||
| import org.opensearch.sql.expression.DSL; | ||
| import org.opensearch.sql.expression.Expression; | ||
| import org.opensearch.sql.expression.env.Environment; | ||
|
|
||
| @ExtendWith(MockitoExtension.class) | ||
| public class GeoIPFunctionTest { | ||
|
|
||
| // Mock value environment for testing. | ||
| @Mock private Environment<Expression, ExprValue> env; | ||
|
|
||
| @Test | ||
| public void testGeoipFunctionSignature() { | ||
| var geoip = DSL.geoip(DSL.literal("HARDCODED_DATASOURCE_NAME"), DSL.ref("ip_address", STRING)); | ||
| assertEquals(BOOLEAN, geoip.type()); | ||
| } | ||
|
|
||
| /** To make sure no logic being evaluated when no environment being passed. */ | ||
| @Test | ||
| public void testDefaultValueOf() { | ||
| UnsupportedOperationException exception = | ||
| assertThrows( | ||
| UnsupportedOperationException.class, | ||
| () -> | ||
| DSL.geoip(DSL.literal("HARDCODED_DATASOURCE_NAME"), DSL.ref("ip_address", STRING)) | ||
| .valueOf(env)); | ||
| assertTrue( | ||
| exception | ||
| .getMessage() | ||
| .contains( | ||
| "OpenSearch defined function [geoip] is only supported in WHERE clause, HAVING" | ||
| + " clause and Eval operation.")); | ||
| } | ||
| } |
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.