You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "abhishekrb19 (via GitHub)" <gi...@apache.org> on 2024/09/20 22:35:41 UTC

[PR] Rewrite SQL node early in the planning phase to support parameterization of MSQ DML queries (druid)

abhishekrb19 opened a new pull request, #17126:
URL: https://github.com/apache/druid/pull/17126

   Previously, only MSQ SQL queries can be parameterized. A MSQ REPLACE query with the following dynamic parameters will throw an exception:
   ```sql
   REPLACE INTO foo
   OVERWRITE WHERE __time >= ? AND __time < ?
   SELECT TIME_PARSE(ts) AS __time, c1
   FROM (VALUES('2023-01-01', 'day1_1'), ('2023-01-01', 'day2')) AS t(ts, c1)
   WHERE c1 = 'day2'
   PARTITIONED BY DAY
   ```
   ```
   Invalid OVERWRITE WHERE clause [`__time` >= ?]: Cannot get a timestamp from sql expression [?]
   ```
   
   This is because there is a bunch of validation in the `IngestHandler` code during the planning stage, which runs on the node where the rewrite hasn’t happened yet. This change moves the call to `rewriteParameters()` earlier in the planning stage so any validations will run on the rewritten root node.
   
   This PR has:
   
   - [x] been self-reviewed.
   - [x] added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
   - [x] 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.
   - [x] 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


Re: [PR] Rewrite SQL node early in the planning phase to support parameterization of MSQ DML queries (druid)

Posted by "abhishekrb19 (via GitHub)" <gi...@apache.org>.
abhishekrb19 merged PR #17126:
URL: https://github.com/apache/druid/pull/17126


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


Re: [PR] Rewrite SQL node early in the planning phase to support parameterization of MSQ DML queries (druid)

Posted by "github-advanced-security[bot] (via GitHub)" <gi...@apache.org>.
github-advanced-security[bot] commented on code in PR #17126:
URL: https://github.com/apache/druid/pull/17126#discussion_r1769343413


##########
extensions-core/multi-stage-query/src/test/java/org/apache/druid/msq/exec/MSQReplaceTest.java:
##########
@@ -704,6 +706,71 @@
                      .verifyResults();
   }
 
+  @MethodSource("data")
+  @ParameterizedTest(name = "{index}:with context {0}")
+  public void testReplaceWithDynamicParameters(String contextName, Map<String, Object> context)

Review Comment:
   ## Useless parameter
   
   The parameter 'contextName' is never used.
   
   [Show more details](https://github.com/apache/druid/security/code-scanning/8339)



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