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 2022/01/10 13:07:46 UTC

[GitHub] [druid] LakshSingla opened a new pull request #12136: Set plannerContext error when cannot query external datasources and when insert is not supported.

LakshSingla opened a new pull request #12136:
URL: https://github.com/apache/druid/pull/12136


   ### Description
   
   This PR aims to add `plannerContext.setPlanningError` whenever external table scan rule is invoked, without the queryMaker having the ability to do so. 
   
   <hr>
   
   This PR has:
   - [x] been self-reviewed.
      - [ ] using the [concurrency checklist](https://github.com/apache/druid/blob/master/dev/code-review/concurrency.md) (Remove this item if the PR doesn't have any relation to concurrency.)
   - [ ] added documentation for new or modified features or behaviors.
   - [ ] added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
   - [ ] added or updated version, license, or notice information in [licenses.yaml](https://github.com/apache/druid/blob/master/dev/license.md)
   - [ ] added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
   - [ ] added unit tests or modified existing tests to cover new code paths, ensuring the threshold for [code coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md) is met.
   - [ ] added integration tests.
   - [ ] been tested in a test Druid cluster.
   


-- 
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: commits-unsubscribe@druid.apache.org

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] abhishekagarwal87 commented on pull request #12136: Set plannerContext error when cannot query external datasources and when insert is not supported.

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


   Thank you @LakshSingla. can you also add a test case for this 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.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

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] abhishekagarwal87 commented on a change in pull request #12136: Set plannerContext error when cannot query external datasources and when insert is not supported.

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



##########
File path: sql/src/main/java/org/apache/druid/sql/calcite/planner/DruidPlanner.java
##########
@@ -215,7 +215,9 @@ public PlannerResult plan() throws SqlParseException, ValidationException, RelCo
       }
       if (parsed.getInsertNode() != null) {
         // Cannot INSERT with BINDABLE.
-        throw e;
+        plannerContext.setPlanningError("Cannot use insert keyword with bindable convention.");

Review comment:
       hmm. this is not even the actual error. The actual error should have been set somewhere already. The fact that we don't use the bindable convention to parse select queries but not insert query, is an internal detail. this particular line should be removed. 




-- 
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: commits-unsubscribe@druid.apache.org

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] LakshSingla commented on a change in pull request #12136: Set plannerContext error when cannot query external datasources and when insert is not supported.

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



##########
File path: sql/src/main/java/org/apache/druid/sql/calcite/planner/DruidPlanner.java
##########
@@ -215,7 +215,9 @@ public PlannerResult plan() throws SqlParseException, ValidationException, RelCo
       }
       if (parsed.getInsertNode() != null) {
         // Cannot INSERT with BINDABLE.
-        throw e;
+        plannerContext.setPlanningError("Cannot use insert keyword with bindable convention.");

Review comment:
       Thanks, I was planning to use system tables but the comment here [L320](https://github.com/apache/druid/blob/master/sql/src/main/java/org/apache/druid/sql/calcite/planner/DruidPlanner.java#L320) made me think that bindable convention is used for other stuff as well, therefore I was unsure. 




-- 
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: commits-unsubscribe@druid.apache.org

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] abhishekagarwal87 merged pull request #12136: Set plannerContext error when cannot query external datasources and when insert is not supported.

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


   


-- 
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: commits-unsubscribe@druid.apache.org

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] abhishekagarwal87 commented on pull request #12136: Set plannerContext error when cannot query external datasources and when insert is not supported.

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


   Failures are unrelated and due to the docker pull rate limit exceeding. FYI @jihoonson 


-- 
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: commits-unsubscribe@druid.apache.org

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] rohangarg commented on a change in pull request #12136: Set plannerContext error when cannot query external datasources and when insert is not supported.

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



##########
File path: sql/src/main/java/org/apache/druid/sql/calcite/planner/DruidPlanner.java
##########
@@ -215,7 +215,9 @@ public PlannerResult plan() throws SqlParseException, ValidationException, RelCo
       }
       if (parsed.getInsertNode() != null) {
         // Cannot INSERT with BINDABLE.
-        throw e;
+        plannerContext.setPlanningError("Cannot use insert keyword with bindable convention.");

Review comment:
       I think 'bindable convention' is not a user friendly term




-- 
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: commits-unsubscribe@druid.apache.org

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] abhishekagarwal87 commented on a change in pull request #12136: Set plannerContext error when cannot query external datasources and when insert is not supported.

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



##########
File path: sql/src/main/java/org/apache/druid/sql/calcite/external/ExternalTableScanRule.java
##########
@@ -46,6 +46,7 @@ public boolean matches(RelOptRuleCall call)
     if (plannerContext.getQueryMaker().feature(QueryFeature.CAN_READ_EXTERNAL_DATA)) {
       return super.matches(call);
     } else {
+      plannerContext.setPlanningError("Scanning external datasources is not suported.");

Review comment:
       Typically since the planning errors are hints, we follow this convention 
   Instead of "Feature X is not supported", we say "SQL query requires feature X that is not supported." The reason for this is that the actual error user will see. This is what they see
   "Possible error: SQL query requires feature X that is not supported" 
   we prepend "Possible error: " to all the planning error messages. When the error is phrased as "SQL query requires.. ", we are being explicit that we think SQL query being executed needs feature X but can't say for sure. Though it is for certain that feature X is not supported. It's a bit of a nitpick but since the error message is seen by the end-user, we should address it. 
   
   




-- 
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: commits-unsubscribe@druid.apache.org

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] LakshSingla commented on a change in pull request #12136: Set plannerContext error when cannot query external datasources and when insert is not supported.

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



##########
File path: sql/src/main/java/org/apache/druid/sql/calcite/external/ExternalTableScanRule.java
##########
@@ -46,6 +46,7 @@ public boolean matches(RelOptRuleCall call)
     if (plannerContext.getQueryMaker().feature(QueryFeature.CAN_READ_EXTERNAL_DATA)) {
       return super.matches(call);
     } else {
+      plannerContext.setPlanningError("Scanning external datasources is not suported.");

Review comment:
       Thanks for the explanation. I will make the changes so that it points the user towards the correct error, rather than being definitive (as it might be incorrect). 




-- 
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: commits-unsubscribe@druid.apache.org

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