Skip to content

Commit 087ae67

Browse files
committed
add action
1 parent f33a800 commit 087ae67

File tree

2 files changed

+126
-22
lines changed

2 files changed

+126
-22
lines changed
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
################################################################################
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
################################################################################
18+
19+
name: UTCase Vortex
20+
21+
on:
22+
push:
23+
paths:
24+
- 'paimon-vortex/**'
25+
pull_request:
26+
paths:
27+
- 'paimon-vortex/**'
28+
29+
env:
30+
JDK_VERSION: 8
31+
MAVEN_OPTS: -Dmaven.wagon.httpconnectionManager.ttlSeconds=30 -Dmaven.wagon.http.retryHandler.requestSentEnabled=true
32+
33+
concurrency:
34+
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.number || github.run_id }}
35+
cancel-in-progress: true
36+
37+
jobs:
38+
vortex_test:
39+
runs-on: ubuntu-latest
40+
41+
steps:
42+
- name: Checkout code
43+
uses: actions/checkout@v6
44+
45+
- name: Set up JDK ${{ env.JDK_VERSION }}
46+
uses: actions/setup-java@v5
47+
with:
48+
java-version: ${{ env.JDK_VERSION }}
49+
distribution: 'temurin'
50+
51+
- name: Install Rust toolchain
52+
uses: dtolnay/rust-toolchain@stable
53+
54+
- name: Cache Rust dependencies
55+
uses: actions/cache@v4
56+
with:
57+
path: |
58+
~/.cargo/registry
59+
~/.cargo/git
60+
vortex/target
61+
key: ${{ runner.os }}-cargo-${{ hashFiles('vortex/Cargo.lock') }}
62+
restore-keys: |
63+
${{ runner.os }}-cargo-
64+
65+
- name: Clone and build Vortex native library
66+
run: |
67+
git clone https://github.com/spiraldb/vortex.git vortex
68+
cd vortex
69+
cargo build --package vortex-jni --release
70+
71+
- name: Copy native library to resources
72+
run: |
73+
RESOURCE_DIR=paimon-vortex/paimon-vortex-jni/src/main/resources/native/linux-amd64
74+
mkdir -p ${RESOURCE_DIR}
75+
cp vortex/target/release/libvortex_jni.so ${RESOURCE_DIR}/
76+
77+
- name: Build and test Vortex modules
78+
timeout-minutes: 30
79+
run: |
80+
mvn -T 2C -B -ntp clean install -DskipTests
81+
mvn -B -ntp verify -pl paimon-vortex/paimon-vortex-jni,paimon-vortex/paimon-vortex-format -Dcheckstyle.skip=true -Dspotless.check.skip=true
82+
env:
83+
MAVEN_OPTS: -Xmx4096m

paimon-vortex/paimon-vortex-format/src/test/java/org/apache/paimon/format/vortex/VortexFileFormatReadWriteTest.java

Lines changed: 43 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import org.apache.paimon.types.DataTypes;
3131
import org.apache.paimon.types.RowType;
3232

33+
import dev.vortex.api.DType;
3334
import org.junit.jupiter.api.BeforeAll;
3435

3536
import java.math.BigDecimal;
@@ -47,9 +48,12 @@ protected VortexFileFormatReadWriteTest() {
4748
super("vortex");
4849
}
4950

51+
private static boolean fixedSizeListSupported;
52+
5053
@BeforeAll
5154
static void checkNativeLibrary() {
5255
assumeTrue(isNativeAvailable(), "Vortex native library not available, skipping tests");
56+
fixedSizeListSupported = isFixedSizeListSupported();
5357
}
5458

5559
private static boolean isNativeAvailable() {
@@ -61,6 +65,15 @@ private static boolean isNativeAvailable() {
6165
}
6266
}
6367

68+
private static boolean isFixedSizeListSupported() {
69+
try {
70+
DType.newFixedSizeList(DType.newInt(false), 2, false);
71+
return true;
72+
} catch (Throwable t) {
73+
return false;
74+
}
75+
}
76+
6477
@Override
6578
public boolean supportNestedReadPruning() {
6679
return false;
@@ -109,8 +122,10 @@ protected RowType rowTypeForFullTypesTest() {
109122
1,
110123
"double1",
111124
DataTypes.DOUBLE().notNull(),
112-
"nested row double field 1"))))
113-
.field("floatVector", DataTypes.VECTOR(3, DataTypes.FLOAT()));
125+
"nested row double field 1"))));
126+
if (fixedSizeListSupported) {
127+
builder.field("floatVector", DataTypes.VECTOR(3, DataTypes.FLOAT()));
128+
}
114129

115130
RowType rowType = builder.build();
116131
if (ThreadLocalRandom.current().nextBoolean()) {
@@ -122,26 +137,32 @@ protected RowType rowTypeForFullTypesTest() {
122137
@Override
123138
protected GenericRow expectedRowForFullTypesTest() {
124139
List<Object> values =
125-
Arrays.asList(
126-
1,
127-
fromString("name"),
128-
5.26D,
129-
new GenericArray(new Object[] {fromString("123"), fromString("456")}),
130-
new GenericArray(new Object[] {123, 456}),
131-
true,
132-
(byte) 3,
133-
(short) 6,
134-
12304L,
135-
new byte[] {1, 5, 2},
136-
Timestamp.fromMicros(123123123),
137-
Timestamp.fromEpochMillis(123123123),
138-
2456,
139-
Decimal.fromBigDecimal(new BigDecimal("0.22"), 2, 2),
140-
Decimal.fromBigDecimal(new BigDecimal("12312455.22"), 38, 2),
141-
Decimal.fromBigDecimal(new BigDecimal("12455.1"), 10, 1),
142-
new GenericArray(
143-
new Object[] {GenericRow.of(1, 0.1D), GenericRow.of(2, 0.2D)}),
144-
BinaryVector.fromPrimitiveArray(new float[] {1.0f, 2.0f, 3.0f}));
140+
new java.util.ArrayList<>(
141+
Arrays.asList(
142+
1,
143+
fromString("name"),
144+
5.26D,
145+
new GenericArray(
146+
new Object[] {fromString("123"), fromString("456")}),
147+
new GenericArray(new Object[] {123, 456}),
148+
true,
149+
(byte) 3,
150+
(short) 6,
151+
12304L,
152+
new byte[] {1, 5, 2},
153+
Timestamp.fromMicros(123123123),
154+
Timestamp.fromEpochMillis(123123123),
155+
2456,
156+
Decimal.fromBigDecimal(new BigDecimal("0.22"), 2, 2),
157+
Decimal.fromBigDecimal(new BigDecimal("12312455.22"), 38, 2),
158+
Decimal.fromBigDecimal(new BigDecimal("12455.1"), 10, 1),
159+
new GenericArray(
160+
new Object[] {
161+
GenericRow.of(1, 0.1D), GenericRow.of(2, 0.2D)
162+
})));
163+
if (fixedSizeListSupported) {
164+
values.add(BinaryVector.fromPrimitiveArray(new float[] {1.0f, 2.0f, 3.0f}));
165+
}
145166
return GenericRow.of(values.toArray());
146167
}
147168
}

0 commit comments

Comments
 (0)