techdocsmith commented on code in PR #16878:
URL: https://github.com/apache/druid/pull/16878#discussion_r1718792639
##########
docs/querying/sql-functions.md:
##########
@@ -1525,11 +1525,42 @@ Returns the following:
## LOOKUP
-`LOOKUP(<CHARACTER>, <CHARACTER>[, <CHARACTER>])`
+Searches for `expr` in a registered [query-time lookup table](lookups.md)
named `lookupName` and returns the mapped value. If `expr` is null or not
contained in the lookup, returns `replaceMissingValueWith` if supplied,
otherwise returns null.
-**Function type:** [Scalar, string](sql-scalar.md#string-functions)
+* **Syntax:** `LOOKUP(expr, lookupName[, replaceMissingValueWith])`
+* **Function type:** Scalar, string
+
+<details><summary>Example</summary>
+
+The following example uses a `map`-typed lookup table named `acronym_to_name`,
which contains the following key-value pairs:
-Looks up the expression in a registered query-time lookup table.
+```json
+{
+ "SJU": "Luis Munoz Marin International Airport",
+ "IAD": "Dulles International AirportDulles International Airport"
Review Comment:
```suggestion
"IAD": "Dulles International Airport"
```
##########
docs/querying/sql-functions.md:
##########
@@ -1525,11 +1525,42 @@ Returns the following:
## LOOKUP
-`LOOKUP(<CHARACTER>, <CHARACTER>[, <CHARACTER>])`
+Searches for `expr` in a registered [query-time lookup table](lookups.md)
named `lookupName` and returns the mapped value. If `expr` is null or not
contained in the lookup, returns `replaceMissingValueWith` if supplied,
otherwise returns null.
-**Function type:** [Scalar, string](sql-scalar.md#string-functions)
+* **Syntax:** `LOOKUP(expr, lookupName[, replaceMissingValueWith])`
+* **Function type:** Scalar, string
+
+<details><summary>Example</summary>
+
+The following example uses a `map`-typed lookup table named `acronym_to_name`,
which contains the following key-value pairs:
Review Comment:
```suggestion
The following example uses a `map` type lookup table named
`acronym_to_name`, which contains the following key-value pairs:
```
hyphenated construction unnecessary
##########
docs/querying/sql-scalar.md:
##########
@@ -102,7 +102,7 @@ String functions accept strings and return a type
appropriate to the function.
|`CHAR_LENGTH(expr)`|Alias for `LENGTH`.|
|`CHARACTER_LENGTH(expr)`|Alias for `LENGTH`.|
|`STRLEN(expr)`|Alias for `LENGTH`.|
-|`LOOKUP(expr, lookupName[, replaceMissingValueWith])`|Looks up `expr` in an
existing [query-time lookup table](lookups.md) that has the name `lookupName`.
Returns the optional constant `replaceMissingValueWith` when `expr` is null or
when the lookup does not contain a value for `expr`.<br /><br />You can query
lookups directly using the [`lookup` schema](sql.md#from).|
+|`LOOKUP(expr, lookupName[, replaceMissingValueWith])`|Look up `expr` in a
registered [query-time lookup table](lookups.md) named `lookupName` and returns
the mapped value. If `expr` is null or not contained in the lookup, returns
`replaceMissingValueWith` if supplied, otherwise returns null.<br /><br
/>Lookups can also be queried directly using the [`lookup`
schema](sql.md#from).|
Review Comment:
```suggestion
|`LOOKUP(expr, lookupName[, replaceMissingValueWith])`|Look up `expr` in a
registered [query-time lookup table](lookups.md) named `lookupName` and returns
the mapped value. If `expr` is null or not contained in the lookup, returns
`replaceMissingValueWith` if supplied, otherwise returns null.<br /><br />You
can query lookups directly using the [`lookup` schema](sql.md#from).|
```
avoid passive
--
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]