-
Notifications
You must be signed in to change notification settings - Fork 140
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
[FEATURE] Add Support for IP Data Type #3145
Comments
we really need this feature, we can't even do basic IP lookups right now! query SELECT *
FROM logs-vpc
WHERE dstaddr = "10.100.138.82"
LIMIT 10; log
|
Hi @currantw - this is a great idea Can we explicitly use an This should be applicable for any
|
…ort for IP address type). Signed-off-by: currantw <[email protected]>
PROPOSED SOLUTION
Additional notes:
|
@currantw I think that comparisons should support both IPv4 and IPv6 addresses. For example an IPv4 address could be compared to an IPv6 address. To implement this, I think it makes sense to have all IPv6 addresses be greater than all IPv4 addresses. Consider an index that has an IP field. The field contains both IPv4 and IPv6 addresses. We should be able to sort based on that column. Sorting needs to be able to compare values. For IPv6, |
Another thing to consider is IPv4 address in IPv6 representation. This could mean that some IPv6 addresses are equal to some IPv4 addresses, such as:
|
Thanks @normanj-bitquill for the comments and suggestions. I think it makes sense to try (to the extent possible) to model the SQL plugin's IP address data type behaviour on the existing core OpenSearch behaviour.
|
Is your feature request related to a problem?
OpenSearch SQL plugin does not support the IP address field type.
🚫 IP address fields are converted to strings:
search=weblog | fields host
returns
host
with field typestring
.🚫 IP address fields cannot be correctly for equality:
search=weblog | where host = "2001:0db7::ff00:42:8329" | fields host
will not return the value
2001:0db7:0000:0000:0000:ff00:0042:8329
, even though both strings represent the same IP address.What solution would you like?
Outcomes:
=
and!=
).<
,<=
,>
, and>
) if they are both IPv4 or IPv6.cidrmatch
- see Add CIDR function to PPL (#3036) #3110).Proposed Solution:
IP
type toExprCoreType
.OpenSearchExprIpValue
withExprIpValue
, and update implementation.OpenSearchDataType.MappingType
to map"ip"
fields toExprCoreType.IP
.OpenSearchExprValueFactory
.What alternatives have you considered?
None
Do you have any additional context?
This is closely related to #3110. This issue added a new
cidrmatch(ip, cidr)
function that returns whether the given IP address is within the specified CIDR IP address range. As part of this work, the SQL plugin was updated to cast IP addresses to strings - previously, it would raise an exception.The text was updated successfully, but these errors were encountered: