-
Notifications
You must be signed in to change notification settings - Fork 33
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
PPL geoip function - old reference PR #781
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
## geoip syntax proposal | ||
|
||
geoip function to add information about the geographical location of an IPv4 or IPv6 address | ||
|
||
1. **Proposed syntax** | ||
- `... | eval geoinfo = geoip([datasource,] ipAddress [,properties])` | ||
- generic syntax | ||
- `... | eval geoinfo = geoip(ipAddress)` | ||
- use the default geoip datasource | ||
- `... | eval geoinfo = geoip("abc", ipAddress)` | ||
- use the "abc" geoip datasource | ||
- `... | eval geoinfo = geoip(ipAddress, "city,lat,lon")` | ||
- use the default geoip datasource, retrieve only city, lat and lon | ||
- `... | eval geoinfo = geoip("abc", ipAddress, "city,lat,lon")` | ||
- use the "abc" geoip datasource, retrieve only city, lat and lon | ||
|
||
|
||
2. **Proposed wiring with the geoip database** | ||
- Leverage the functionality of the ip2geo processor | ||
- ip2geo processor configuration, functionality and code will be used | ||
- Prerequisite for the geoip is that ip2geo processor is configured properly | ||
- See https://opensearch.org/docs/latest/ingest-pipelines/processors/ip2geo/ | ||
|
||
|
||
### New syntax definition in ANTLR | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As a user doc, could we remove the ANTLR related information, what here needs is just a user readable syntax definition. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, the file is located ppl-lang/planning folder. I think we need an user doc instead of design doc. We can copy this design information to the PR description or issue description. And you can easily update your design without any code changes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @YANG-DB I did unterstand that the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought it was for roadmap. I prefer to using GitHub PR description and comments. It's fine to add design docs in code if you prefer to. But these docs are not for users, we need to write a new one later. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @salyh yes - once design doc is approved we will move it with necessary updates to the regular commands folder |
||
|
||
```ANTLR | ||
|
||
// functions | ||
evalFunctionCall | ||
: evalFunctionName LT_PRTHS functionArgs RT_PRTHS | ||
| geoipFunction | ||
; | ||
|
||
geoipFunction | ||
: GEOIP LT_PRTHS (datasource = functionArg COMMA)? ipAddress = functionArg (COMMA properties = stringLiteral)? RT_PRTHS | ||
; | ||
``` | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -465,6 +465,7 @@ wcFieldExpression | |
// functions | ||
evalFunctionCall | ||
: evalFunctionName LT_PRTHS functionArgs RT_PRTHS | ||
| geoipFunction | ||
; | ||
|
||
// cast function | ||
|
@@ -781,6 +782,10 @@ coalesceFunctionName | |
: COALESCE | ||
; | ||
|
||
geoipFunction | ||
: GEOIP LT_PRTHS (datasource = functionArg COMMA)? ipAddress = functionArg (COMMA properties = stringLiteral)? RT_PRTHS | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Any case for supporting There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no particular case for datasource refers to the datasources provided by the ip2geo processor, see #781 (comment) |
||
; | ||
|
||
// operators | ||
comparisonOperator | ||
: EQUAL | ||
|
@@ -1051,4 +1056,5 @@ keywordsCanBeId | |
| FULL | ||
| SEMI | ||
| ANTI | ||
| GEOIP | ||
; |
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.
what does
datasource
mean? Could you use other meaningful usage rather thatabc
?abc
is not straightforward user case.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.
datasource refers to the datasources provided by the ip2geo processor, see #781 (comment)