Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into 3562-tablet-client-lo…
Browse files Browse the repository at this point in the history
…adtable-should-show-error-msg
  • Loading branch information
vagetablechicken committed Nov 10, 2023
2 parents c1973b7 + 23d7c50 commit ad0cdaf
Show file tree
Hide file tree
Showing 194 changed files with 5,391 additions and 1,396 deletions.
46 changes: 32 additions & 14 deletions .github/workflows/other-os-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,41 +78,60 @@ jobs:
shell: bash
run: |
cd /root/OpenMLDB
# centos6_build.sh will try build zetasql even cache hit, just ignore the failure
IN_WORKFLOW=true bash steps/centos6_build.sh
# bazel bin
export PATH=$PATH:`pwd`
source /opt/rh/devtoolset-8/enable
if [[ "${USE_DEPS_CACHE}" != "true" ]]; then
echo "build thirdparty"
make thirdparty CMAKE_INSTALL_PREFIX=${OPENMLDB_PREFIX} BUILD_BUNDLE=ON NPROC=8
echo "build thirdparty, make opt is better than nproc?"
make thirdparty CMAKE_INSTALL_PREFIX=${OPENMLDB_PREFIX} BUILD_BUNDLE=ON THIRD_PARTY_CMAKE_FLAGS=-DMAKEOPTS=-j8
# 5.8G ./.deps, avail 8G
rm -rf .deps/build # GitHub runner disk space is limited
fi
echo "build"
# 1.4G ./.deps, avail 13G
# will failed if openmldb_sdk is on
cmake -S . -B `pwd`/build -DCMAKE_PREFIX_PATH=`pwd`/.deps/usr -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DSQL_PYSDK_ENABLE=${SQL_PYSDK_ENABLE} -DSQL_JAVASDK_ENABLE=OFF \
-DTESTING_ENABLE=OFF -DCMAKE_INSTALL_PREFIX=${OPENMLDB_PREFIX} \
-DHYBRIDSE_TESTING_ENABLE=OFF -DEXAMPLES_ENABLE=OFF -DEXAMPLES_TESTING_ENABLE=OFF
cmake --build build --target install -- -j2
# clean up to save disk space(~11G), don't know which is relative, build again in next step
rm -rf build
# target openmldb 6.7G ./build(no py/java), avail 5.2G
# openmldb+cp_python_sdk_so 7.7G ./build(has py), python just ~180M
# target 'install' cost more, preinstall/fast won't build all, so use install/fast if needed
# or https://cmake.org/cmake/help/latest/variable/CMAKE_SKIP_INSTALL_ALL_DEPENDENCY.html
cmake --build build --target openmldb cp_python_sdk_so -- -j2
du -h --max-depth=1
df -h
# if target above cost too much disk, make java build failed, try to rm build cache
# don't rm cache now cuz build java from emtpy will cost 20min
# rm build/hybridse build/src -rf
if [[ "${SQL_JAVASDK_ENABLE}" == "ON" ]]; then
echo "build java sdk"
cmake -S . -B `pwd`/build -DCMAKE_PREFIX_PATH=`pwd`/.deps/usr -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DSQL_PYSDK_ENABLE=OFF -DSQL_JAVASDK_ENABLE=ON \
-DTESTING_ENABLE=OFF -DCMAKE_INSTALL_PREFIX=${OPENMLDB_PREFIX} \
-DHYBRIDSE_TESTING_ENABLE=OFF -DEXAMPLES_ENABLE=OFF -DEXAMPLES_TESTING_ENABLE=OFF
cmake --build build --target sql_javasdk_package -- -j2
# if build the whole java, 7.6G ./build, 5.7G ./java, avail 331M
# so split it and build native only
# 7.6G ./build, 1.8G ./java, avail 5.2G
cmake --build build --target cp_native_so -- -j2
du -h --max-depth=1
df -h
rm build/hybridse build/src -rf
cd java
./mvnw -pl openmldb-native clean package -DskipTests=true -Dscalatest.skip=true -Dwagon.skip=true -Dmaven.test.skip=true --batch-mode
fi
- name: package
run: |
tar czf ${{ env.OPENMLDB_PREFIX }}.tar.gz ${{ env.OPENMLDB_PREFIX }}/
rm build/hybridse build/src -rf
du -h --max-depth=1
df -h
- name: upload binary
uses: actions/upload-artifact@v2
with:
path: openmldb-*.tar.gz
name: binary-package
path: build/bin/openmldb
name: binary

- name: upload java native
if: ${{ env.SQL_JAVASDK_ENABLE == 'ON' }}
Expand All @@ -127,8 +146,7 @@ jobs:
with:
name: python-whl
path: |
python/openmldb_sdk/dist/openmldb*.whl
python/openmldb_sdk/dist/openmldb*.whl
# TODO(hw): upload cxx sdk

# macos no need to build thirdparty, but binary/os needs to be built on each os
Expand Down
9 changes: 5 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
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,10 @@ allure-results/
/python/openmldb_autofe/*.egg-info/
# go sdk
!go.mod

# tag files
**/tags
**/GPATH
**/GRTAGS
**/GTAGS
**/cscope.out
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ endif()
message (STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
set(OPENMLDB_VERSION_MAJOR 0)
set(OPENMLDB_VERSION_MINOR 8)
set(OPENMLDB_VERSION_BUG 2)
set(OPENMLDB_VERSION_BUG 3)

function(get_commitid CODE_DIR COMMIT_ID)
find_package(Git REQUIRED)
Expand Down
46 changes: 28 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -139,34 +139,44 @@ 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) -j $(NPROC) --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'
thirdparty: thirdparty-configure
$(CMAKE_PRG) --build $(THIRD_PARTY_BUILD_DIR) -j $(NPROC)
$(CMAKE_PRG) --build $(THIRD_PARTY_BUILD_DIR)

thirdparty-configure:
$(CMAKE_PRG) -S third-party -B $(THIRD_PARTY_BUILD_DIR) -DSRC_INSTALL_DIR=$(THIRD_PARTY_SRC_DIR) -DDEPS_INSTALL_DIR=$(THIRD_PARTY_DIR) $(THIRD_PARTY_CMAKE_FLAGS)
Expand Down
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
17 changes: 17 additions & 0 deletions cases/plan/cmd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -704,3 +704,20 @@ cases:
+-actions:
+-0: DropPathAction (12)
+-1: AddPathAction (13)
- id: show-create-table
desc: SHOW CREATE TABLE
sql: SHOW CREATE TABLE t1;
expect:
node_tree_str: |
+-node[CMD]
+-cmd_type: show create table
+-args: [t1]
- id: show-create-table-db
desc: SHOW CREATE TABLE
sql: SHOW CREATE TABLE db1.t1;
expect:
node_tree_str: |
+-node[CMD]
+-cmd_type: show create table
+-args: [db1, t1]
52 changes: 52 additions & 0 deletions cases/query/const_query.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,55 @@ cases:
columns: ['c1 bool', 'c2 int16', 'c3 int', 'c4 double', 'c5 string', 'c6 date', 'c7 timestamp' ]
rows:
- [ true, 3, 13, 10.0, 'a string', '2020-05-22', 1590115420000 ]

# =================================================================================
# Null safe for structure types: String, Date, Timestamp and Array
# creating struct from:
# 1. NULL liternal (const null)
# 2. another supported date type but fails to cast, e.g. timestamp(-1) returns NULL of timestamp
#
# casting to array type un-implemented
# =================================================================================
- id: 10
desc: null safe for date
mode: procedure-unsupport
sql: |
select
datediff(Date(timestamp(-1)), Date("2021-05-01")) as out1,
datediff(Date(timestamp(-2177481600)), Date("2021-05-01")) as out2,
datediff(cast(NULL as date), Date("2021-05-01")) as out3,
date(NULL) as out4,
date("abc") as out5,
date(timestamp("abc")) as out6
expect:
columns: ["out1 int", "out2 int", "out3 int", "out4 date", "out5 date", "out6 date"]
data: |
NULL, NULL, NULL, NULL, NULL, NULL
- id: 11
desc: null safe for timestamp
mode: procedure-unsupport
sql: |
select
month(cast(NULL as timestamp)) as out1,
month(timestamp(NULL)) as out2,
month(timestamp(-1)) as out3,
month(timestamp("abc")) as out4,
month(timestamp(date("abc"))) as out5
expect:
columns: ["out1 int", "out2 int", "out3 int", "out4 int", "out5 int"]
data: |
NULL, NULL, NULL, NULL, NULL
- id: 12
desc: null safe for string
mode: procedure-unsupport
sql: |
select
char_length(cast(NULL as string)) as out1,
char_length(string(int(NULL))) as out2,
char_length(string(bool(null))) as out3,
char_length(string(timestamp(null))) as out4,
char_length(string(date(null))) as out5
expect:
columns: ["out1 int", "out2 int", "out3 int", "out4 int", "out5 int"]
data: |
NULL, NULL, NULL, NULL, NULL
Loading

0 comments on commit ad0cdaf

Please sign in to comment.