Skip to content
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

Update doc for dynamic parameters supporting array #16660

Merged
merged 15 commits into from
Aug 7, 2024
23 changes: 23 additions & 0 deletions docs/querying/sql.md
Original file line number Diff line number Diff line change
Expand Up @@ -409,3 +409,26 @@ To solve this issue, explicitly provide the type of the dynamic parameter using
```
SELECT * FROM druid.foo WHERE dim1 like CONCAT('%', CAST (? AS VARCHAR), '%')
```

Dynamic parameters can also replace arrays, reducing the parsing time.

for example:
```json
{
"query": "SELECT doubleArrayColumn from druid.table where ARRAY_CONTAINS(?, doubleArrayColumn)",
"parameters": [
{"type":"ARRAY", "value":[-25.7, null, 36.85]}
]
}
```
sreemanamala marked this conversation as resolved.
Show resolved Hide resolved

Also, an IN filter being supplied with a lot of values, can be replaced by a dynamic parameter passed inside [SCALAR_IN_ARRAY](sql-functions.md#scalar_in_array)
```json
{
"query": "SELECT count(city) from druid.table where SCALAR_IN_ARRAY(city, ?)",
"parameters": [
{"type":"ARRAY", "value":["Vienna", "Seoul", "San Francisco"]}
]
}
```
sreemanamala marked this conversation as resolved.
Show resolved Hide resolved

Loading