Skip to content

Commit

Permalink
switch to javascript udf
Browse files Browse the repository at this point in the history
Signed-off-by: Runji Wang <[email protected]>
  • Loading branch information
wangrunji0408 committed Feb 8, 2024
1 parent d8c2c38 commit 667f68e
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 19 deletions.
1 change: 0 additions & 1 deletion ci/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --no-mo
ENV PATH /root/.cargo/bin/:$PATH

RUN rustup show
RUN rustup default `rustup show active-toolchain | awk '{print $1}'`

RUN curl -sSL "https://github.com/bufbuild/buf/releases/download/v1.4.0/buf-$(uname -s)-$(uname -m).tar.gz" | \
tar -xvzf - -C /usr/local --strip-components 1
Expand Down
2 changes: 1 addition & 1 deletion ci/build-ci-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ cat ../rust-toolchain
# shellcheck disable=SC2155

# REMEMBER TO ALSO UPDATE ci/docker-compose.yml
export BUILD_ENV_VERSION=v20240208
export BUILD_ENV_VERSION=v20240204

export BUILD_TAG="public.ecr.aws/x5u3w5h6/rw-build-env:${BUILD_ENV_VERSION}"

Expand Down
10 changes: 5 additions & 5 deletions ci/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ services:
retries: 5

source-test-env:
image: public.ecr.aws/x5u3w5h6/rw-build-env:v20240208
image: public.ecr.aws/x5u3w5h6/rw-build-env:v20240204
depends_on:
- mysql
- db
Expand All @@ -81,7 +81,7 @@ services:
- ..:/risingwave

sink-test-env:
image: public.ecr.aws/x5u3w5h6/rw-build-env:v20240208
image: public.ecr.aws/x5u3w5h6/rw-build-env:v20240204
depends_on:
- mysql
- db
Expand All @@ -93,12 +93,12 @@ services:
- ..:/risingwave

rw-build-env:
image: public.ecr.aws/x5u3w5h6/rw-build-env:v20240208
image: public.ecr.aws/x5u3w5h6/rw-build-env:v20240204
volumes:
- ..:/risingwave

ci-flamegraph-env:
image: public.ecr.aws/x5u3w5h6/rw-build-env:v20240208
image: public.ecr.aws/x5u3w5h6/rw-build-env:v20240204
# NOTE(kwannoel): This is used in order to permit
# syscalls for `nperf` (perf_event_open),
# so it can do CPU profiling.
Expand All @@ -109,7 +109,7 @@ services:
- ..:/risingwave

regress-test-env:
image: public.ecr.aws/x5u3w5h6/rw-build-env:v20240208
image: public.ecr.aws/x5u3w5h6/rw-build-env:v20240204
depends_on:
db:
condition: service_healthy
Expand Down
12 changes: 8 additions & 4 deletions ci/scripts/sql/nexmark/q14.sql
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile

CREATE FUNCTION count_char(s varchar, c varchar) RETURNS int LANGUAGE rust AS $$
fn count_char(s: &str, c: &str) -> i32 {
s.matches(c).count() as i32
}
CREATE FUNCTION count_char(s varchar, c varchar) RETURNS int LANGUAGE javascript AS $$
var count = 0;
for (var cc of s) {
if (cc === c) {
count++;
}
}
return count;
$$;

CREATE SINK nexmark_q14 AS
Expand Down
12 changes: 8 additions & 4 deletions e2e_test/streaming/nexmark/sinks/q14.slt.part
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
statement ok
CREATE FUNCTION count_char(s varchar, c varchar) RETURNS int LANGUAGE rust AS $$
fn count_char(s: &str, c: &str) -> i32 {
s.matches(c).count() as i32
}
CREATE FUNCTION count_char(s varchar, c varchar) RETURNS int LANGUAGE javascript AS $$
var count = 0;
for (var cc of s) {
if (cc === c) {
count++;
}
}
return count;
$$;

statement ok
Expand Down
12 changes: 8 additions & 4 deletions e2e_test/streaming/nexmark/views/q14.slt.part
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
statement ok
CREATE FUNCTION count_char(s varchar, c varchar) RETURNS int LANGUAGE rust AS $$
fn count_char(s: &str, c: &str) -> i32 {
s.matches(c).count() as i32
}
CREATE FUNCTION count_char(s varchar, c varchar) RETURNS int LANGUAGE javascript AS $$
var count = 0;
for (var cc of s) {
if (cc === c) {
count++;
}
}
return count;
$$;

statement ok
Expand Down

0 comments on commit 667f68e

Please sign in to comment.