soumyava commented on code in PR #14956:
URL: https://github.com/apache/druid/pull/14956#discussion_r1320631513
##########
docs/querying/lookups.md:
##########
@@ -62,6 +62,12 @@ SELECT
FROM sales
GROUP BY 1
```
+Lookup function also accepts the 3rd argument called
`$replaceMissingValueWith` as constant string, if you value is missing given
lookups for queried key then lookup function return result value from
`replaceMissingValueWith`
Review Comment:
nit. The lookup function also accepts the 3rd argument called
`$replaceMissingValueWith` as a constant string. If your value is missing a
lookup for the queried key, the lookup function returns the result value from
`replaceMissingValueWith`
##########
processing/src/main/java/org/apache/druid/query/expression/LookupExprMacro.java:
##########
@@ -116,4 +126,15 @@ public void decorateCacheKeyBuilder(CacheKeyBuilder
builder)
return new LookupExpr(arg);
}
+
+ private String getReplaceMissingValueWith(final List<Expr> args)
+ {
+ if (args.size() > 2) {
+ final Expr missingValExpr = args.get(2);
+ if (missingValExpr.isLiteral()) {
+ return missingValExpr.getLiteralValue().toString();
Review Comment:
Q. when used in sqlCompatibleMode if there is a value like empty string
should it be converted to null ?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]