Skip to content

Commit

Permalink
Merge branch 'main' into xxchan/self
Browse files Browse the repository at this point in the history
  • Loading branch information
xxchan authored Jun 14, 2023
2 parents 4f14538 + e3fe51b commit 797ed4a
Show file tree
Hide file tree
Showing 56 changed files with 1,500 additions and 470 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ci/scripts/build-other.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ cd ..

echo "--- Upload Java artifacts"
cp java/connector-node/assembly/target/risingwave-connector-1.0.0.tar.gz ./risingwave-connector.tar.gz
cp java/udf/target/risingwave-udf-example.jar ./risingwave-udf-example.jar
cp java/udf-example/target/risingwave-udf-example.jar ./risingwave-udf-example.jar
buildkite-agent artifact upload ./risingwave-connector.tar.gz
buildkite-agent artifact upload ./risingwave-udf-example.jar
4 changes: 2 additions & 2 deletions ci/scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip
unzip -q awscliv2.zip && ./aws/install && mv /usr/local/bin/aws /bin/aws

echo "--- Check risingwave release version"
if [[ -n "${BUILDKITE_TAG+x}" ]]; then
if [[ -n "${BUILDKITE_TAG}" ]]; then
CARGO_PKG_VERSION="$(toml get --toml-path Cargo.toml workspace.package.version)"
if [[ "${CARGO_PKG_VERSION}" != "${BUILDKITE_TAG#*v}" ]]; then
echo "CARGO_PKG_VERSION: ${CARGO_PKG_VERSION}"
Expand All @@ -64,7 +64,7 @@ elif [[ -n "${BINARY_NAME+x}" ]]; then
aws s3 cp risingwave-${BINARY_NAME}-x86_64-unknown-linux.tar.gz s3://risingwave-nightly-pre-built-binary
fi

if [[ -n "${BUILDKITE_TAG+x}" ]]; then
if [[ -n "${BUILDKITE_TAG}" ]]; then
echo "--- Install gh cli"
yum install -y dnf
dnf install -y 'dnf-command(config-manager)'
Expand Down
2 changes: 1 addition & 1 deletion ci/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ steps:
files: "*-junit.xml"
format: "junit"
- ./ci/plugins/upload-failure-logs
timeout_in_minutes: 10
timeout_in_minutes: 15

- label: "end-to-end test (parallel) (release mode)"
command: "ci/scripts/e2e-test-parallel.sh -p ci-release"
Expand Down
16 changes: 16 additions & 0 deletions e2e_test/batch/basic/range.slt.part
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,19 @@ SELECT * FROM range(0.1::numeric, 2.1::numeric, 0.5::numeric)
0.6
1.1
1.6

# test table function with aliases
query I
SELECT alias from range(1,2) alias;
----
1

query I
SELECT alias.alias from range(1,2) alias;
----
1

query I
SELECT alias.col from range(1,2) alias(col);
----
1
2 changes: 1 addition & 1 deletion e2e_test/udf/udf.slt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Before running this test:
# python3 e2e_test/udf/test.py
# or:
# cd src/udf/java && mvn package && java -jar target/risingwave-udf-example.jar
# cd java/udf-example && mvn package && java -jar target/risingwave-udf-example.jar

# Create a function.
statement ok
Expand Down
1 change: 1 addition & 0 deletions java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<modules>
<module>proto</module>
<module>udf</module>
<module>udf-example</module>
<module>java-binding</module>
<module>common-utils</module>
<module>java-binding-integration-test</module>
Expand Down
8 changes: 8 additions & 0 deletions java/udf-example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## RisingWave Java UDF Example

Make sure you have installed Java 11 and Maven 3 or later.

```sh
mvn package
java -jar target/risingwave-udf-example.jar
```
67 changes: 67 additions & 0 deletions java/udf-example/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.example</groupId>
<artifactId>udf-example</artifactId>
<version>1.0-SNAPSHOT</version>

<name>udf-example</name>
<url>http://maven.apache.org</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>com.risingwave.java</groupId>
<artifactId>risingwave-udf</artifactId>
<version>0.0.1</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M6</version>
<configuration>
<argLine>--add-opens=java.base/java.nio=ALL-UNNAMED</argLine>
</configuration>
</plugin>
<!-- generate an executable for examples -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.4.2</version>
<configuration>
<archive>
<manifest>
<mainClass>com.example.UdfExample</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<finalName>risingwave-udf-example</finalName>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
<execution>
<id>udf-example</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package com.risingwave.functions.example;
package com.example;

import java.io.IOException;
import java.math.BigDecimal;
Expand All @@ -35,7 +35,6 @@ public static void main(String[] args) throws IOException {
server.addFunction("int_42", new Int42());
server.addFunction("gcd", new Gcd());
server.addFunction("gcd3", new Gcd3());
server.addFunction("to_string", new ToString());
server.addFunction("extract_tcp_info", new ExtractTcpInfo());
server.addFunction("hex_to_dec", new HexToDec());
server.addFunction("array_access", new ArrayAccess());
Expand Down Expand Up @@ -77,12 +76,6 @@ public int eval(int a, int b, int c) {
}
}

public static class ToString implements ScalarFunction {
public String eval(String s) {
return s;
}
}

public static class ExtractTcpInfo implements ScalarFunction {
public static class TcpPacketInfo {
public String srcAddr;
Expand Down
Loading

0 comments on commit 797ed4a

Please sign in to comment.