Skip to content

feat: add udf function locate#3940

Closed
howdb wants to merge 1 commit into4paradigm:mainfrom
howdb:feat-locate
Closed

feat: add udf function locate#3940
howdb wants to merge 1 commit into4paradigm:mainfrom
howdb:feat-locate

Conversation

@howdb
Copy link
Copy Markdown
Contributor

@howdb howdb commented May 28, 2024

  • feature

  • What is the current behavior? (You can also link to an open issue here)

issue

  • add a new udf locate

@github-actions github-actions bot added the execute-engine hybridse sql engine label May 28, 2024
@github-actions
Copy link
Copy Markdown
Contributor

SDK Test Report

101 files   -  1  101 suites   - 1   2m 9s ⏱️ -22s
341 tests  - 18  328 ✅  - 17  12 💤  - 2  1 ❌ +1 
469 runs   - 18  456 ✅  - 17  12 💤  - 2  1 ❌ +1 

For more details on these failures, see this check.

Results for commit 2519798. ± Comparison against base commit 59d79f6.

This pull request removes 48 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)

@github-actions
Copy link
Copy Markdown
Contributor

HybridSE Mac Test Report

0 tests  ±0   0 ✅ ±0   0s ⏱️ ±0s
0 suites ±0   0 💤 ±0 
0 files   ±0   0 ❌ ±0 

Results for commit 2519798. ± Comparison against base commit 59d79f6.

@github-actions
Copy link
Copy Markdown
Contributor

HybridSE Linux Test Report

20 377 tests  +2   20 375 ✅ +2   6m 22s ⏱️ -1s
   262 suites ±0        2 💤 ±0 
    69 files   ±0        0 ❌ ±0 

Results for commit 2519798. ± Comparison against base commit 59d79f6.

@codecov
Copy link
Copy Markdown

codecov bot commented May 28, 2024

Codecov Report

Attention: Patch coverage is 95.45455% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 78.42%. Comparing base (59d79f6) to head (2519798).

Files Patch % Lines
hybridse/src/udf/udf.cc 90.47% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #3940      +/-   ##
============================================
+ Coverage     75.22%   78.42%   +3.19%     
============================================
  Files           754      558     -196     
  Lines        135575   123827   -11748     
  Branches       2072        0    -2072     
============================================
- Hits         101991    97110    -4881     
+ Misses        33281    26717    -6564     
+ Partials        303        0     -303     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-actions
Copy link
Copy Markdown
Contributor

Linux Test Report

    59 files  +     4     252 suites  +190   1h 43m 40s ⏱️ + 1h 14m 11s
13 520 tests +12 841  13 513 ✅ +12 842  7 💤 ±0  0 ❌  - 1 
19 197 runs  +18 517  19 190 ✅ +18 518  7 💤 ±0  0 ❌  - 1 

Results for commit 2519798. ± Comparison against base commit 59d79f6.


@code{.sql}

select locate("wo", "hello world", 2);
Copy link
Copy Markdown
Collaborator

@vagetablechicken vagetablechicken May 29, 2024

Choose a reason for hiding this comment

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

Thx for contributing~
Could we give a more representative example? e.g. locate("o", "hello world", 5), it will be 5, locate("o", "hello world", 6), it will be 8. Or the examples in #820.

@howdb howdb closed this May 30, 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants