You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2021/10/22 22:35:15 UTC
[GitHub] [druid] clintropolis commented on a change in pull request #11634: Add IPAddress java library as dependency and migrate IPv4 functions to use the new library.
clintropolis commented on a change in pull request #11634:
URL: https://github.com/apache/druid/pull/11634#discussion_r734872503
##########
File path: processing/src/main/java/org/apache/druid/query/expression/IPv4AddressMatchExprMacro.java
##########
@@ -70,17 +71,17 @@ public Expr apply(final List<Expr> args)
throw new IAE(ExprUtils.createErrMsg(name(), "must have 2 arguments"));
}
- SubnetUtils.SubnetInfo subnetInfo = getSubnetInfo(args);
+ IPAddressString subnetInfo = getSubnetInfo(args);
Expr arg = args.get(0);
class IPv4AddressMatchExpr extends ExprMacroTable.BaseScalarUnivariateMacroFunctionExpr
{
- private final SubnetUtils.SubnetInfo subnetInfo;
+ private final IPAddressString subnetString;
Review comment:
since this will be checked every row, should we maybe store both `IPAddressString` and `IPv4Address` so we can do whichever `contains` check is more efficient? (assuming we split long and string handling to not both convert to `IPv4Address`).
##########
File path: processing/src/main/java/org/apache/druid/query/expression/IPv4AddressMatchExprMacro.java
##########
@@ -104,19 +105,21 @@ public ExprEval eval(final ObjectBinding bindings)
private boolean isStringMatch(String stringValue)
{
- return IPv4AddressExprUtils.isValidAddress(stringValue) && subnetInfo.isInRange(stringValue);
+ IPv4Address iPv4Address = IPv4AddressExprUtils.parse(stringValue);
Review comment:
should this parse to an `IPAddressString` instead of an `IPv4Address` so it can be checked against the `subnetString` directly?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org