You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2021/01/26 19:24:57 UTC

[GitHub] [druid] a2l007 opened a new pull request #10801: Document type inference issues with dynamic params in SQL

a2l007 opened a new pull request #10801:
URL: https://github.com/apache/druid/pull/10801


   This documentation fix attempts at clarifying type inference based query failures that happen while using dynamic parameters in a SQL query.
   <hr>
   
   This PR has:
   - [x] been self-reviewed.
   <!-- Check the items by putting "x" in the brackets for the done things. Not all of these items apply to every PR. Remove the items which are not done or not relevant to the PR. None of the items from the checklist above are strictly necessary, but it would be very helpful if you at least self-review the PR. -->
   
   <hr>
   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] techdocsmith commented on a change in pull request #10801: Document type inference issues with dynamic params in SQL

Posted by GitBox <gi...@apache.org>.
techdocsmith commented on a change in pull request #10801:
URL: https://github.com/apache/druid/pull/10801#discussion_r568217140



##########
File path: docs/querying/sql.md
##########
@@ -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.
 
+Please note that in certain cases, dynamic parameters used in expressions can cause type inference issues which can cause the query to fail. The following query is one such case:

Review comment:
       ```suggestion
   In certain cases, using dynamic parameters in expressions can cause type inference issues which cause your query to fail, for example:
   ```
   Avoid "please note". Also does the type interface issue result in a specific error? If so might be nice to include it.

##########
File path: docs/querying/sql.md
##########
@@ -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.
 
+Please note that in certain cases, dynamic parameters used in expressions can cause type inference issues which can cause the query to fail. The following query is one such case:
+
+```sql
+SELECT * FROM druid.foo WHERE dim1 like CONCAT('%', ?, '%')
+```
+
+In these cases, the solution would be to explicitly provide the type of the dynamic parameter using the `CAST` keyword. The above example can be fixed as:

Review comment:
       ```suggestion
   To solve this issue, explicitly provide the type of the dynamic parameter using the `CAST` keyword. Consider the fix for the preceding example:
   ```




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] clintropolis merged pull request #10801: Document type inference issues with dynamic params in SQL

Posted by GitBox <gi...@apache.org>.
clintropolis merged pull request #10801:
URL: https://github.com/apache/druid/pull/10801


   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] clintropolis commented on pull request #10801: Document type inference issues with dynamic params in SQL

Posted by GitBox <gi...@apache.org>.
clintropolis commented on pull request #10801:
URL: https://github.com/apache/druid/pull/10801#issuecomment-790556634


   skipping run through integration tests portion of CI since docs test passes and this is doc only change


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] techdocsmith commented on a change in pull request #10801: Document type inference issues with dynamic params in SQL

Posted by GitBox <gi...@apache.org>.
techdocsmith commented on a change in pull request #10801:
URL: https://github.com/apache/druid/pull/10801#discussion_r568217140



##########
File path: docs/querying/sql.md
##########
@@ -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.
 
+Please note that in certain cases, dynamic parameters used in expressions can cause type inference issues which can cause the query to fail. The following query is one such case:

Review comment:
       ```suggestion
   In certain cases, using dynamic parameters in expressions can cause type inference issues which cause your query to fail, for example:
   ```
   Avoid "please note". Also does the type interface issue result in a specific error? If so might be nice to include it.

##########
File path: docs/querying/sql.md
##########
@@ -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.
 
+Please note that in certain cases, dynamic parameters used in expressions can cause type inference issues which can cause the query to fail. The following query is one such case:
+
+```sql
+SELECT * FROM druid.foo WHERE dim1 like CONCAT('%', ?, '%')
+```
+
+In these cases, the solution would be to explicitly provide the type of the dynamic parameter using the `CAST` keyword. The above example can be fixed as:

Review comment:
       ```suggestion
   To solve this issue, explicitly provide the type of the dynamic parameter using the `CAST` keyword. Consider the fix for the preceding example:
   ```




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org