Skip to content

Commit

Permalink
resolve conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
dl239 committed Nov 15, 2023
2 parents 089e781 + 5d0d638 commit eef8494
Show file tree
Hide file tree
Showing 249 changed files with 10,120 additions and 5,789 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ jobs:
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('java/**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-

- name: prepare release
if: github.event_name == 'push'
Expand Down Expand Up @@ -124,6 +122,7 @@ jobs:
- name: maven coverage
working-directory: java
run: |
rm -rfv ~/.m2/repository/com/4paradigm/
./mvnw --batch-mode prepare-package
./mvnw --batch-mode scoverage:report
Expand Down Expand Up @@ -160,8 +159,6 @@ jobs:
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('java/**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-

- name: Cache thirdparty
uses: actions/cache@v3
Expand Down Expand Up @@ -236,6 +233,10 @@ jobs:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_TOKEN: ${{ secrets.OSSRH_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: cleanup
run: |
rm -rfv ~/.m2/repository/com/4paradigm/
python-sdk:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -351,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
44 changes: 27 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -139,29 +139,39 @@ THIRD_PARTY_BUILD_DIR ?= $(MAKEFILE_DIR)/.deps
THIRD_PARTY_SRC_DIR ?= $(MAKEFILE_DIR)/thirdsrc
THIRD_PARTY_DIR ?= $(THIRD_PARTY_BUILD_DIR)/usr

# trick: for those compile inside hybridsql docker image, thirdparty is pre-installed in /deps/usr.
# we check this by asserting if the environment variable '$THIRD_PARTY_DIR' is defined to '/deps/usr',
# if true, thirdparty download is skipped
# zetasql check separately since it update more frequently:
# it will updated if the variable '$ZETASQL_VERSION' (defined in docker) not equal to that defined in current code
override GREP_PATTERN = "set(ZETASQL_VERSION"
override ZETASQL_PATTERN = "set(ZETASQL_VERSION"
override THIRD_PATTERN = "set(HYBRIDSQL_ASSERTS_VERSION"
new_zetasql_version := $(shell grep $(ZETASQL_PATTERN) third-party/cmake/FetchZetasql.cmake | sed 's/[^0-9.]*\([0-9.]*\).*/\1/')
new_third_version := $(shell grep $(THIRD_PATTERN) third-party/CMakeLists.txt | sed 's/[^0-9.]*\([0-9.]*\).*/\1/')

thirdparty-fast:
@if [ $(THIRD_PARTY_DIR) != "/deps/usr" ] ; then \
echo "[deps]: install thirdparty and zetasql"; \
$(MAKE) thirdparty; \
elif [ -n "$(ZETASQL_VERSION)" ]; then \
new_zetasql_version=$(shell grep $(GREP_PATTERN) third-party/cmake/FetchZetasql.cmake | sed 's/[^0-9.]*\([0-9.]*\).*/\1/'); \
if [ "$$new_zetasql_version" != "$(ZETASQL_VERSION)" ] ; then \
echo "[deps]: thirdparty up-to-date. reinstall zetasql from $(ZETASQL_VERSION) to $$new_zetasql_version"; \
$(MAKE) thirdparty-configure; \
$(CMAKE_PRG) --build $(THIRD_PARTY_BUILD_DIR) --target zetasql; \
else \
echo "[deps]: all up-to-date. zetasql already installed with version: $(ZETASQL_VERSION)"; \
fi; \
else \
echo "[deps]: install zetasql only"; \
$(MAKE) thirdparty-configure; \
$(CMAKE_PRG) --build $(THIRD_PARTY_BUILD_DIR) --target zetasql; \
if [ -n "$(ZETASQL_VERSION)" ] ; then \
if [ "$(new_zetasql_version)" != "$(ZETASQL_VERSION)" ] ; then \
echo "[deps]: installing zetasql from $(ZETASQL_VERSION) to $(new_zetasql_version)"; \
$(CMAKE_PRG) --build $(THIRD_PARTY_BUILD_DIR) --target zetasql; \
else \
echo "[deps]: zetasql up-to-date with version: $(ZETASQL_VERSION)"; \
fi; \
else \
echo "[deps]: installing latest zetasql"; \
$(CMAKE_PRG) --build $(THIRD_PARTY_BUILD_DIR) --target zetasql; \
fi; \
if [ -n "$(THIRDPARTY_VERSION)" ]; then \
if [ "$(new_third_version)" != "$(THIRDPARTY_VERSION)" ] ; then \
echo "[deps]: installing thirdparty from $(THIRDPARTY_VERSION) to $(new_third_version)"; \
$(CMAKE_PRG) --build $(THIRD_PARTY_BUILD_DIR) --target hybridsql-asserts; \
else \
echo "[deps]: thirdparty up-to-date: $(THIRDPARTY_VERSION)"; \
fi ; \
else \
echo "[deps]: installing latest thirdparty"; \
$(CMAKE_PRG) --build $(THIRD_PARTY_BUILD_DIR) --target hybridsql-asserts; \
fi ; \
fi

# third party compiled code install to 'OpenMLDB/.deps/usr', source code install to 'OpenMLDB/thirdsrc'
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
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 eef8494

Please sign in to comment.