mirror of https://github.com/apache/druid.git
Document type inference issues with dynamic params in SQL (#10801)
* Clarify docs * Apply suggestions from code review Co-authored-by: Charles Smith <38529548+techdocsmith@users.noreply.github.com> Co-authored-by: Charles Smith <38529548+techdocsmith@users.noreply.github.com>
This commit is contained in:
parent
87a2abff79
commit
be2ac8d6ce
|
@ -219,6 +219,18 @@ at execution time. To use dynamic parameters, replace any literal in the query w
|
|||
corresponding parameter value when you execute the query. Parameters are bound to the placeholders in the order in
|
||||
which they are passed. Parameters are supported in both the [HTTP POST](#http-post) and [JDBC](#jdbc) APIs.
|
||||
|
||||
In certain cases, using dynamic parameters in expressions can cause type inference issues which cause your query to fail, for example:
|
||||
|
||||
```sql
|
||||
SELECT * FROM druid.foo WHERE dim1 like CONCAT('%', ?, '%')
|
||||
```
|
||||
|
||||
To solve this issue, explicitly provide the type of the dynamic parameter using the `CAST` keyword. Consider the fix for the preceding example:
|
||||
|
||||
```
|
||||
SELECT * FROM druid.foo WHERE dim1 like CONCAT('%', CAST (? AS VARCHAR), '%')
|
||||
```
|
||||
|
||||
## Data types
|
||||
|
||||
### Standard types
|
||||
|
|
Loading…
Reference in New Issue