Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into docs/release_0.8.4
Browse files Browse the repository at this point in the history
  • Loading branch information
dl239 committed Nov 16, 2023
2 parents 84a05e1 + 5731b2b commit cb7d195
Show file tree
Hide file tree
Showing 211 changed files with 9,046 additions and 5,143 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/cicd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,11 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: linux-ut-result-cpp-${{ github.sha }}
# exclude _deps xml
path: |
build/**/*.xml
reports/*.xml
!build/_deps/*
- name: install
if: ${{ github.event_name == 'push' }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ jobs:
image: ghcr.io/4paradigm/hybridsql:latest
env:
OPENMLDB_BUILD_TARGET: "openmldb"
OPENMLDB_MODE: standalone
steps:
- uses: actions/checkout@v2

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/udf-doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ jobs:
if: github.event_name != 'pull_request'
with:
add-paths: |
docs/en/reference/sql/functions_and_operators/Files/udfs_8h.md
docs/zh/openmldb_sql/functions_and_operators/Files/udfs_8h.md
docs/en/reference/sql/udfs_8h.md
docs/zh/openmldb_sql/udfs_8h.md
labels: |
udf
branch: docs-udf-patch
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ endif()
include(FetchContent)
set(FETCHCONTENT_QUIET OFF)
include(farmhash)
include(rapidjson)

# contrib libs
add_subdirectory(contrib EXCLUDE_FROM_ALL)
Expand Down
4 changes: 2 additions & 2 deletions benchmark/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xs
<dependency>
<groupId>com.4paradigm.openmldb</groupId>
<artifactId>openmldb-jdbc</artifactId>
<version>0.7.0</version>
<version>0.8.3</version>
</dependency>
<dependency>
<groupId>com.4paradigm.openmldb</groupId>
<artifactId>openmldb-native</artifactId>
<version>0.7.0-allinone</version>
<version>0.8.3-allinone</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class BenchmarkConfig {
public static long TS_BASE = System.currentTimeMillis();
public static String DEPLOY_NAME;
public static String CSV_PATH;
public static int PUT_BACH_SIZE = 1;

private static SqlExecutor executor = null;
private static SdkOption option = null;
Expand All @@ -58,6 +59,7 @@ public class BenchmarkConfig {
// if(!CSV_PATH.startsWith("/")){
// CSV_PATH=Util.getRootPath()+CSV_PATH;
// }
PUT_BACH_SIZE = Integer.valueOf(prop.getProperty("PUT_BACH_SIZE", "1"));
} catch (Exception e) {
e.printStackTrace();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
package com._4paradigm.openmldb.benchmark;

import com._4paradigm.openmldb.sdk.SqlExecutor;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;

import java.sql.Timestamp;
import java.util.Random;
import java.util.concurrent.TimeUnit;

@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
@State(Scope.Benchmark)
@Threads(10)
@Fork(value = 1, jvmArgs = {"-Xms8G", "-Xmx8G"})
@Warmup(iterations = 2)
@Measurement(iterations = 5, time = 60)

public class OpenMLDBInsertBenchmark {
private SqlExecutor executor;
private String database = "test_put_db";
private String tableName = "test_put_t1";
private int indexNum;
private String placeholderSQL;
private Random random;
int stringNum = 15;
int doubleNum= 5;
int timestampNum = 5;
int bigintNum = 5;

public OpenMLDBInsertBenchmark() {
executor = BenchmarkConfig.GetSqlExecutor(false);
indexNum = BenchmarkConfig.WINDOW_NUM;
random = new Random();
StringBuilder builder = new StringBuilder();
builder.append("insert into ");
builder.append(tableName);
builder.append(" values (");
for (int i = 0; i < stringNum + doubleNum + timestampNum + bigintNum; i++) {
if (i > 0) {
builder.append(", ");
}
builder.append("?");
}
builder.append(");");
placeholderSQL = builder.toString();
}

@Setup
public void initEnv() {
Util.executeSQL("CREATE DATABASE IF NOT EXISTS " + database + ";", executor);
Util.executeSQL("USE " + database + ";", executor);
String ddl = Util.genDDL(tableName, indexNum);
Util.executeSQL(ddl, executor);
}

@Benchmark
public void executePut() {
java.sql.PreparedStatement pstmt = null;
try {
pstmt = executor.getInsertPreparedStmt(database, placeholderSQL);
for (int num = 0; num < BenchmarkConfig.PUT_BACH_SIZE; num++) {
int idx = 1;
for (int i = 0; i < stringNum; i++) {
if (i < indexNum) {
pstmt.setString(idx, String.valueOf(BenchmarkConfig.PK_BASE + random.nextInt(BenchmarkConfig.PK_NUM)));
} else {
pstmt.setString(idx, "v" + String.valueOf(100000 + random.nextInt(100000)));
}
idx++;
}
for (int i = 0; i < doubleNum; i++) {
pstmt.setDouble(idx, random.nextDouble());
idx++;
}
for (int i = 0; i < timestampNum; i++) {
pstmt.setTimestamp(idx, new Timestamp(System.currentTimeMillis()));
idx++;
}
for (int i = 0; i < bigintNum; i++) {
pstmt.setLong(idx, random.nextLong());
idx++;
}
if (BenchmarkConfig.PUT_BACH_SIZE > 1) {
pstmt.addBatch();
}
}
if (BenchmarkConfig.PUT_BACH_SIZE > 1) {
pstmt.executeBatch();
} else {
pstmt.execute();
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (pstmt != null) {
try {
pstmt.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
}

@TearDown
public void cleanEnv() {
Util.executeSQL("USE " + database + ";", executor);
Util.executeSQL("DROP TABLE " + tableName + ";", executor);
Util.executeSQL("DROP DATABASE " + database + ";", executor);
}

public static void main(String[] args) {
/* OpenMLDBPutBenchmark benchmark = new OpenMLDBPutBenchmark();
benchmark.initEnv();
benchmark.executePut();
benchmark.cleanEnv();*/

try {
Options opt = new OptionsBuilder()
.include(OpenMLDBInsertBenchmark.class.getSimpleName())
.forks(1)
.build();
new Runner(opt).run();
} catch (Exception e) {
e.printStackTrace();
}
}
}
6 changes: 4 additions & 2 deletions benchmark/src/main/resources/conf.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ZK_CLUSTER=172.24.4.55:30008
ZK_PATH=/openmldb
ZK_CLUSTER=172.24.4.55:32200
ZK_PATH=/openmldb_test

WINDOW_NUM=2
WINDOW_SIZE=1000
Expand All @@ -12,3 +12,5 @@ PK_BASE=1000000
DATABASE=bank_perf
DEPLOY_NAME=deploy_bank
CSV_PATH=data/bank_flattenRequest.csv

PUT_BACH_SIZE=100
32 changes: 30 additions & 2 deletions cases/function/window/error_window.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,17 @@ debugs: []
version: 0.5.0
cases:
- id: 0
desc: no order by
desc: RANGE-type WINDOW with offset PRECEDING/FOLLOWING requires ORDER BY
inputs:
- columns: [ "id int","c1 string","c3 int","c4 bigint","c5 float","c6 double","c7 timestamp","c8 date" ]
indexs: [ "index1:c8:c4" ]
rows:
- [1,"aa",20,30,1.1,2.1,1590738990000,"2020-05-01"]
sql: |
SELECT id, c1, c4, count(c4) OVER w1 as w1_c4_count FROM {0} WINDOW w1 AS (PARTITION BY {0}.c8 ROWS BETWEEN 2 PRECEDING AND CURRENT ROW);
SELECT id, c1, c4, count(c4) OVER w1 as w1_c4_count FROM {0}
WINDOW w1 AS (PARTITION BY {0}.c8 ROWS_RANGE BETWEEN 2 PRECEDING AND CURRENT ROW);
expect:
msg: RANGE/ROWS_RANGE-type FRAME with offset PRECEDING/FOLLOWING requires exactly one ORDER BY column
success: false
- id: 1
desc: no partition by
Expand Down Expand Up @@ -301,3 +303,29 @@ cases:
SELECT id, c1, c3, sum(c4) OVER w1 as w1_c4_sum FROM {0} WINDOW w1 AS (PARTITION BY {0}.c33 ORDER BY {0}.c7 ROWS_RANGE BETWEEN 2s PRECEDING AND CURRENT ROW);
expect:
success: false
- id: 17
desc: ROWS WINDOW + EXCLUDE CURRENT_TIME requires order by
inputs:
- columns: [ "id int","c1 string","c3 int","c4 bigint","c5 float","c6 double","c7 timestamp","c8 date" ]
indexs: [ "index1:c8:c4" ]
rows:
- [1,"aa",20,30,1.1,2.1,1590738990000,"2020-05-01"]
sql: |
SELECT id, c1, c4, count(c4) OVER w1 as w1_c4_count FROM {0}
WINDOW w1 AS (PARTITION BY {0}.c8 ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW EXCLUDE CURRENT_TIME);
expect:
msg: WINDOW with EXCLUDE CURRENT_TIME requires exactly one ORDER BY column
success: false
- id: 18
desc: RANGE WINDOW + EXCLUDE CURRENT_TIME requires order by
inputs:
- columns: [ "id int","c1 string","c3 int","c4 bigint","c5 float","c6 double","c7 timestamp","c8 date" ]
indexs: [ "index1:c8:c4" ]
rows:
- [1,"aa",20,30,1.1,2.1,1590738990000,"2020-05-01"]
sql: |
SELECT id, c1, c4, count(c4) OVER w1 as w1_c4_count FROM {0}
WINDOW w1 AS (PARTITION BY {0}.c8 ROWS_RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW EXCLUDE CURRENT_TIME);
expect:
msg: WINDOW with EXCLUDE CURRENT_TIME requires exactly one ORDER BY column
success: false
16 changes: 16 additions & 0 deletions cases/plan/cmd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,22 @@ cases:
+-cmd_type: drop function
+-if_exists: true
+-args: [func1]
- id: truncate_stmt
desc: truncate
sql: TRUNCATE TABLE t1;
expect:
node_tree_str: |
+-node[CMD]
+-cmd_type: truncate table
+-args: [t1]
- id: truncate_stmt_db
desc: truncate
sql: TRUNCATE TABLE db1.t1;
expect:
node_tree_str: |
+-node[CMD]
+-cmd_type: truncate table
+-args: [db1, t1]
- id: exit_stmt
desc: exit statement
sql: EXIT;
Expand Down
37 changes: 37 additions & 0 deletions cases/plan/create.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1035,3 +1035,40 @@ cases:
+-kind: HIVE
+-path: hdfs://path
+-table_option_list: []
- id: 34
desc: Create 指定压缩
sql: |
create table t1(
column1 int,
column2 timestamp,
index(key=column1, ts=column2)) OPTIONS (compress_type="snappy");
expect:
node_tree_str: |
+-node[CREATE]
+-table: t1
+-IF NOT EXIST: 0
+-column_desc_list[list]:
| +-0:
| | +-node[kColumnDesc]
| | +-column_name: column1
| | +-column_type: int32
| | +-NOT NULL: 0
| +-1:
| | +-node[kColumnDesc]
| | +-column_name: column2
| | +-column_type: timestamp
| | +-NOT NULL: 0
| +-2:
| +-node[kColumnIndex]
| +-keys: [column1]
| +-ts_col: column2
| +-abs_ttl: -2
| +-lat_ttl: -2
| +-ttl_type: <nil>
| +-version_column: <nil>
| +-version_count: 0
+-table_option_list[list]:
+-0:
+-node[kCompressType]
+-compress_type: snappy
Loading

0 comments on commit cb7d195

Please sign in to comment.