vtlim commented on code in PR #17593:
URL: https://github.com/apache/druid/pull/17593#discussion_r1894344368
##########
docs/api-reference/sql-api.md:
##########
@@ -85,20 +85,15 @@ The request body takes the following properties:
* `context`: JSON object containing optional [SQL query context
parameters](../querying/sql-query-context.md), such as to set the query ID,
time zone, and whether to use an approximation algorithm for distinct count.
-* `parameters`: List of query parameters for parameterized queries. Each
parameter in the array should be a JSON object containing the parameter's SQL
data type and parameter value. For a list of supported SQL types, see [Data
types](../querying/sql-data-types.md).
+* `parameters`: List of query parameters for parameterized queries. Each
parameter in the array should be a JSON object containing the parameter's SQL
data type and parameter value. For more information on using dynamic
parameters, see [Dynamic parameters](../querying/sql.md#dynamic-parameters).
For a list of supported SQL types, see [Data
types](../querying/sql-data-types.md).
For example:
+
```json
- "parameters": [
- {
- "type": "VARCHAR",
- "value": "bar"
- },
- {
- "type": "ARRAY",
- "value": [-25.7, null, 36.85]
- }
- ]
+ {
+ "query": "SELECT \"arrayDouble\" FROM \"array_example\" WHERE
ARRAY_CONTAINS(\"arrayDouble\", ?)",
+ "parameters": [{"type": "ARRAY", "value": [999, null, 5.5]}]
+ }
Review Comment:
I think we should keep the prior example since it includes parameters for
both a string and an array. If it's easier, we can break them up into two
examples. But we shouldn't only include one more complicated example. Good call
on including the query.
##########
docs/querying/sql.md:
##########
@@ -428,17 +428,16 @@ SELECT * FROM druid.foo WHERE dim1 like CONCAT('%', CAST
(? AS VARCHAR), '%')
Dynamic parameters can even replace arrays, reducing the parsing time. Refer
to the parameters in the [API request
body](../api-reference/sql-api.md#request-body) for usage.
```sql
-SELECT arrayColumn from druid.table where ARRAY_CONTAINS(?, arrayColumn)
+SELECT arrayColumn from druid.table where ARRAY_CONTAINS(arrayColumn, ?)
```
-With this, 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)
+You can replace an IN filter with many values by dynamically passing a
parameter into [SCALAR_IN_ARRAY](sql-functions.md#scalar_in_array).
+For sample java queries, see [Dynamic
parameters](../api-reference/sql-jdbc.md#dynamic-parameters).
Review Comment:
```suggestion
For example Java queries, see [Dynamic
parameters](../api-reference/sql-jdbc.md#dynamic-parameters).
```
--
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]