Skip to content

Comments

feat: request mode in raw SQL#3874

Merged
aceforeverd merged 4 commits into4paradigm:mainfrom
aceforeverd:feat-sql-request-mode
Apr 17, 2024
Merged

feat: request mode in raw SQL#3874
aceforeverd merged 4 commits into4paradigm:mainfrom
aceforeverd:feat-sql-request-mode

Conversation

@aceforeverd
Copy link
Collaborator

@aceforeverd aceforeverd commented Apr 14, 2024

request mode in RAW SQL

SELECT ....
CONFIG ( execute_mode = 'request', values = (expr1, expr2 , ...) )

SELECT ....
CONFIG ( execute_mode = 'request', values = [(expr1, expr2 , ...), (....)] )

call procedure

call dp (expr1, expr2, ...)

TODOs

  • docs
  • support request value in system variable execute_mode
  • take care const query

@github-actions github-actions bot added execute-engine hybridse sql engine storage-engine openmldb storage engine. nameserver & tablet labels Apr 14, 2024
@github-actions
Copy link
Contributor

github-actions bot commented Apr 14, 2024

SDK Test Report

102 files  ±0  102 suites  ±0   2m 22s ⏱️ +9s
357 tests ±0  343 ✅ ±0  14 💤 ±0  0 ❌ ±0 
483 runs  ±0  469 ✅ ±0  14 💤 ±0  0 ❌ ±0 

Results for commit 4c05826. ± Comparison against base commit d33e2c3.

This pull request removes 30 and adds 9 tests. Note that renamed tests count towards both.
  PARTITION BY db1.t1.col2 ORDER BY db1.t1.col1
  PARTITION BY t1.col2 ORDER BY t1.col1
  ROWS_RANGE BETWEEN 3 PRECEDING AND CURRENT ROW
 ) limit 10;](1)
 ) limit 10;](2)
 ) limit 10;](3)
 FROM db1.t1
 FROM t1
 WINDOW w1 AS (
 last join db2.t2 order by db2.t2.col1
…
com._4paradigm.hybridse.sdk.SqlEngineTest ‑ sqlLastJoinWithMultipleDB[,  SELECT sum(db1.t1.col1) over w1 as sum_t1_col1, db2.t2.str1 as t2_str1
 FROM db1.t1
 last join db2.t2 order by db2.t2.col1
 on db1.t1.col1 = db2.t2.col1 and db1.t1.col2 = db2.t2.col0
 WINDOW w1 AS (
  PARTITION BY db1.t1.col2 ORDER BY db1.t1.col1
  ROWS_RANGE BETWEEN 3 PRECEDING AND CURRENT ROW
 ) limit 10;](2)
com._4paradigm.hybridse.sdk.SqlEngineTest ‑ sqlLastJoinWithMultipleDB[db1,  SELECT sum(t1.col1) over w1 as sum_t1_col1, db2.t2.str1 as t2_str1
 FROM t1
 last join db2.t2 order by db2.t2.col1
 on t1.col1 = db2.t2.col1 and t1.col2 = db2.t2.col0
 WINDOW w1 AS (
  PARTITION BY t1.col2 ORDER BY t1.col1
  ROWS_RANGE BETWEEN 3 PRECEDING AND CURRENT ROW
 ) limit 10;](1)
com._4paradigm.hybridse.sdk.SqlEngineTest ‑ sqlLastJoinWithMultipleDB[null,  SELECT sum(db1.t1.col1) over w1 as sum_t1_col1, db2.t2.str1 as t2_str1
 FROM db1.t1
 last join db2.t2 order by db2.t2.col1
 on db1.t1.col1 = db2.t2.col1 and db1.t1.col2 = db2.t2.col0
 WINDOW w1 AS (
  PARTITION BY db1.t1.col2 ORDER BY db1.t1.col1
  ROWS_RANGE BETWEEN 3 PRECEDING AND CURRENT ROW
 ) limit 10;](3)
com._4paradigm.hybridse.sdk.SqlEngineTest ‑ sqlMultipleDBErrorTest[, SELECT db2.t2.str1 as t2_str1
 FROM t1
 last join db2.t2 order by db2.t2.col1
 on t1.col1 = db2.t2.col1 and t1.col2 = db2.t2.col0;
, SQL parse error: Fail to transform data provider op: table t1 not exists in database []](4)
com._4paradigm.hybridse.sdk.SqlEngineTest ‑ sqlMultipleDBErrorTest[db1, SELECT db1.t2.str1 as t2_str1
 FROM t1
 last join db2.t2 order by db2.t2.col1
 on t1.col1 = db2.t2.col1 and t1.col2 = db2.t2.col0;
, SQL parse error: Column Not found: db1.t2.str1](2)
com._4paradigm.hybridse.sdk.SqlEngineTest ‑ sqlMultipleDBErrorTest[db1, SELECT db2.t2.str1 as t2_str1
 FROM t1
 last join db2.t2 order by db2.t2.col1
 on t1.col1 = t2.col1 and t1.col2 = db2.t2.col0;
, SQL parse error: Column Not found: .t2.col1](3)
com._4paradigm.hybridse.sdk.SqlEngineTest ‑ sqlMultipleDBErrorTest[db1, SELECT t2.str1 as t2_str1
 FROM t1
 last join db2.t2 order by db2.t2.col1
 on t1.col1 = db2.t2.col1 and t1.col2 = db2.t2.col0;
, SQL parse error: Column Not found: .t2.str1](1)
com._4paradigm.hybridse.sdk.SqlEngineTest ‑ sqlMultipleDBErrorTest[null, SELECT db2.t2.str1 as t2_str1
 FROM t1
 last join db2.t2 order by db2.t2.col1
 on t1.col1 = db2.t2.col1 and t1.col2 = db2.t2.col0;
, SQL parse error: Fail to transform data provider op: table t1 not exists in database []](5)
com._4paradigm.hybridse.sdk.SqlEngineTest ‑ sqlWindowLastJoin[ SELECT sum(t1.col1) over w1 as sum_t1_col1, t2.str1 as t2_str1
 FROM t1
 last join t2 order by t2.col1
 on t1.col1 = t2.col1 and t1.col2 = t2.col0
 WINDOW w1 AS (
  PARTITION BY t1.col2 ORDER BY t1.col1
  ROWS_RANGE BETWEEN 3 PRECEDING AND CURRENT ROW
 ) limit 10;](1)

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 14, 2024

HybridSE Mac Test Report

20 146 tests   20 144 ✅  9m 15s ⏱️
   256 suites       2 💤
    68 files         0 ❌

Results for commit 4c05826.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 14, 2024

HybridSE Linux Test Report

20 146 tests   20 144 ✅  6m 20s ⏱️
   256 suites       2 💤
    68 files         0 ❌

Results for commit 4c05826.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 14, 2024

Linux Test Report

    57 files  +     5     247 suites  +190   1h 45m 54s ⏱️ + 1h 20m 27s
13 229 tests +12 675  13 222 ✅ +12 672  7 💤 +3  0 ❌ ±0 
18 776 runs  +18 221  18 769 ✅ +18 218  7 💤 +3  0 ❌ ±0 

Results for commit 4c05826. ± Comparison against base commit d33e2c3.

♻️ This comment has been updated with latest results.

@aceforeverd aceforeverd force-pushed the feat-sql-request-mode branch from bae96c8 to be2dfe9 Compare April 14, 2024 15:52
@aceforeverd

This comment was marked as outdated.

@aceforeverd
Copy link
Collaborator Author

aceforeverd commented Apr 16, 2024

execute_mode rules

Values

execute_mode in SQL CONFIG clause can be

  • online
  • request
  • offline
  • batchrequest (hidden, may removed in later release when 'request' feature complete. Users are generally aware about the three options above )

values option in SQL CONFIG clause can be

  • StructConstructorWithParens ( e.g ( expr1, expr2, ...) )
  • Array [ StructConstructorWithParens ] ( e.g [ (expr1, expr2, ...), ( ...), ... ] )

execute_mode in system variable can be

  • online
  • offline
  • request ( TODO later, won't support in this PR)

Rules

  • determine execute_mode
    • take execute_mode in CONFIG clause IF EXISTS
    • OTHERWISE take execute_mode from system variable execute_mode (pass in from sql_cluster_router client)
  • execute_mode to engine_mode in SQL compiler
    • online -> batch
    • offline -> offline
    • request ->
      • values defines single row: request
      • values defines multiple row: batchrequest
    • batchrequest -> batchrequest
  • Special cases
    • engine_mode = 'request' | 'batchrequest' and request table not empty
      • COMPILE ERROR: when CONFIG values does not match expected schema of request table
      • COMPILE ERROR: when CONFIG values is empty array
    • engine_mode = 'request' | 'batchrequest' and request table is empty (a const query without table)
      • CONFIG values can be empty struct or empty array.
      • This PR won't take care of this case, TODO later
  • CONFIG values ignored if engine_mode is batch or offline

@aceforeverd aceforeverd force-pushed the feat-sql-request-mode branch from 29920a2 to 34ca5ce Compare April 16, 2024 13:42
Copy link
Collaborator

@tobegit3hub tobegit3hub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@aceforeverd aceforeverd merged commit 90e1425 into 4paradigm:main Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

execute-engine hybridse sql engine storage-engine openmldb storage engine. nameserver & tablet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants