Skip to content

Commit 8d504ca

Browse files
committed
fix
1 parent 35522ec commit 8d504ca

File tree

22 files changed

+220
-188
lines changed

22 files changed

+220
-188
lines changed

.github/workflows/e2e-tests-flink-1.x-jdk11.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ jobs:
6363
echo "JVM timezone is set to $jvm_timezone"
6464
profile="flink-${{ matrix.flink_version }}"
6565
if [ "${{ matrix.flink_version }}" = "${{ matrix.flink_version[-1] }}" ]; then
66-
mvn -T 1C -B test -Pflink1,spark3 -pl paimon-e2e-tests -Duser.timezone=$jvm_timezone -Pjava11
66+
mvn -T 1C -B test -Ppaimon-faiss,flink1,spark3 -pl paimon-e2e-tests -Duser.timezone=$jvm_timezone -Pjava11
6767
else
68-
mvn -T 1C -B test -Pflink1,spark3 -pl paimon-e2e-tests -Duser.timezone=$jvm_timezone -P${profile},java11
68+
mvn -T 1C -B test -Ppaimon-faiss,flink1,spark3 -pl paimon-e2e-tests -Duser.timezone=$jvm_timezone -P${profile},java11
6969
fi
7070
env:
7171
MAVEN_OPTS: -Xmx4096m

.github/workflows/e2e-tests-flink-1.x.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
distribution: 'temurin'
5757

5858
- name: Build Flink
59-
run: mvn -T 2C -B clean install -DskipTests -Pflink1,spark3 -pl paimon-e2e-tests -am -Pflink-${{ matrix.flink_version }}
59+
run: mvn -T 2C -B clean install -DskipTests -Ppaimon-faiss,flink1,spark3 -pl paimon-e2e-tests -am -Pflink-${{ matrix.flink_version }}
6060

6161
- name: Test Flink
6262
run: |
@@ -66,9 +66,9 @@ jobs:
6666
echo "JVM timezone is set to $jvm_timezone"
6767
profile="flink-${{ matrix.flink_version }}"
6868
if [ "${{ matrix.flink_version }}" = "${{ matrix.flink_version[-1] }}" ]; then
69-
mvn -T 1C -B test -Pflink1,spark3 -pl paimon-e2e-tests -Duser.timezone=$jvm_timezone
69+
mvn -T 1C -B test -Ppaimon-faiss,flink1,spark3 -pl paimon-e2e-tests -Duser.timezone=$jvm_timezone
7070
else
71-
mvn -T 1C -B test -Pflink1,spark3 -pl paimon-e2e-tests -Duser.timezone=$jvm_timezone -P${profile}
71+
mvn -T 1C -B test -Ppaimon-faiss,flink1,spark3 -pl paimon-e2e-tests -Duser.timezone=$jvm_timezone -P${profile}
7272
fi
7373
env:
7474
MAVEN_OPTS: -Xmx4096m

.github/workflows/utitcase-flink-1.x-jdk11.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
java-version: ${{ env.JDK_VERSION }}
4747
distribution: 'temurin'
4848
- name: Build Flink
49-
run: mvn -T 1C -B clean install -DskipTests -Pflink1,spark3
49+
run: mvn -T 1C -B clean install -DskipTests -Ppaimon-faiss,flink1,spark3
5050
- name: Test Flink
5151
run: |
5252
# run tests with random timezone to find out timezone related bugs
@@ -58,6 +58,6 @@ jobs:
5858
test_modules+="org.apache.paimon:paimon-flink-${suffix},"
5959
done
6060
test_modules="${test_modules%,}"
61-
mvn -T 1C -B test verify -Pflink1,spark3 -pl "${test_modules}" -Duser.timezone=$jvm_timezone
61+
mvn -T 1C -B test verify -Ppaimon-faiss,flink1,spark3 -pl "${test_modules}" -Duser.timezone=$jvm_timezone
6262
env:
6363
MAVEN_OPTS: -Xmx4096m

.github/workflows/utitcase-flink-1.x.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
run: |
5959
COMPILE_MODULE="org.apache.paimon:paimon-flink-${{ matrix.flink_version }}"
6060
echo "Start compiling modules: $COMPILE_MODULE"
61-
mvn -T 2C -B clean install -DskipTests -Pflink1,spark3 -pl "${COMPILE_MODULE}" -am
61+
mvn -T 2C -B clean install -DskipTests -Ppaimon-faiss,flink1,spark3 -pl "${COMPILE_MODULE}" -am
6262
6363
- name: Test Flink
6464
run: |
@@ -67,7 +67,7 @@ jobs:
6767
echo "JVM timezone is set to $jvm_timezone"
6868
TEST_MODULE="org.apache.paimon:paimon-flink-${{ matrix.flink_version }}"
6969
echo "Start testing module: $TEST_MODULE"
70-
mvn -T 2C -B test verify -Pflink1,spark3 -pl "${TEST_MODULE}" -Duser.timezone=$jvm_timezone
70+
mvn -T 2C -B test verify -Ppaimon-faiss,flink1,spark3 -pl "${TEST_MODULE}" -Duser.timezone=$jvm_timezone
7171
echo "All modules tested"
7272
env:
7373
MAVEN_OPTS: -Xmx4096m -XX:+UseG1GC -XX:CICompilerCount=2

.github/workflows/utitcase-jdk11.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
java-version: ${{ env.JDK_VERSION }}
4545
distribution: 'temurin'
4646
- name: Build
47-
run: mvn -T 1C -B clean install -DskipTests -Pflink1,spark3,paimon-lucene
47+
run: mvn -T 1C -B clean install -DskipTests -Ppaimon-faiss,flink1,spark3,paimon-lucene
4848
- name: Test
4949
run: |
5050
# run tests with random timezone to find out timezone related bugs
@@ -56,6 +56,6 @@ jobs:
5656
test_modules+="!org.apache.paimon:paimon-spark-${suffix}_2.12,"
5757
done
5858
test_modules="${test_modules%,}"
59-
mvn -T 1C -B clean install -pl "${test_modules}" -Pflink1,spark3,paimon-lucene -Pskip-paimon-flink-tests -Duser.timezone=$jvm_timezone
59+
mvn -T 1C -B clean install -pl "${test_modules}" -Ppaimon-faiss,flink1,spark3,paimon-lucene -Pskip-paimon-flink-tests -Duser.timezone=$jvm_timezone
6060
env:
6161
MAVEN_OPTS: -Xmx4096m

.github/workflows/utitcase.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
- name: Build Others
5454
run: |
5555
echo "Start compiling modules"
56-
mvn -T 2C -B clean install -DskipTests -Pflink1,spark3
56+
mvn -T 2C -B clean install -DskipTests -Ppaimon-faiss,flink1,spark3
5757
5858
- name: Test Others
5959
timeout-minutes: 60

paimon-faiss-jni/pom.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
<java.version>1.8</java.version>
2828
<junit.version>5.10.0</junit.version>
2929
<slf4j.version>1.7.36</slf4j.version>
30+
<!-- Skip Faiss JNI tests by default since they require native library with all dependencies bundled.
31+
To run tests: mvn test -DskipFaissTests=false -->
32+
<skipFaissTests>true</skipFaissTests>
3033
</properties>
3134

3235
<dependencies>
@@ -189,6 +192,12 @@
189192
<groupId>org.apache.maven.plugins</groupId>
190193
<artifactId>maven-surefire-plugin</artifactId>
191194
<version>3.1.2</version>
195+
<configuration>
196+
<!-- Skip tests by default since they require native library with all dependencies.
197+
To run tests, use: mvn test -Dfaiss.test.enabled=true
198+
Make sure the native library is built with all dependencies bundled first. -->
199+
<skipTests>${skipFaissTests}</skipTests>
200+
</configuration>
192201
</plugin>
193202
</plugins>
194203
</build>

paimon-faiss-jni/src/main/java/org/apache/paimon/faiss/Faiss.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@
2121
/**
2222
* Global Faiss configuration and utilities.
2323
*
24-
* <p>This class provides methods for configuring Faiss globally, such as
25-
* setting the number of threads for parallel operations.
24+
* <p>This class provides methods for configuring Faiss globally, such as setting the number of
25+
* threads for parallel operations.
2626
*
2727
* <p>Example usage:
28+
*
2829
* <pre>{@code
2930
* // Set the number of threads for Faiss operations
3031
* Faiss.setNumThreads(4);
@@ -59,8 +60,8 @@ public static String getVersion() {
5960
/**
6061
* Set the number of threads for parallel operations.
6162
*
62-
* <p>This affects operations like index training, adding vectors,
63-
* and searching. Set to 1 to disable parallelism.
63+
* <p>This affects operations like index training, adding vectors, and searching. Set to 1 to
64+
* disable parallelism.
6465
*
6566
* @param numThreads the number of threads (must be positive)
6667
*/
@@ -83,9 +84,8 @@ public static int getNumThreads() {
8384
/**
8485
* Ensure the native library is loaded.
8586
*
86-
* <p>This method is called automatically when any Faiss class is used.
87-
* It can be called explicitly to load the library early and catch
88-
* any loading errors.
87+
* <p>This method is called automatically when any Faiss class is used. It can be called
88+
* explicitly to load the library early and catch any loading errors.
8989
*
9090
* @throws FaissException if the native library cannot be loaded
9191
*/
@@ -102,4 +102,3 @@ public static boolean isLibraryLoaded() {
102102
return NativeLibraryLoader.isLoaded();
103103
}
104104
}
105-

paimon-faiss-jni/src/main/java/org/apache/paimon/faiss/FaissException.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
/**
2222
* Exception thrown when a Faiss operation fails.
2323
*
24-
* <p>This exception wraps errors from the native Faiss library as well as
25-
* errors that occur during JNI operations.
24+
* <p>This exception wraps errors from the native Faiss library as well as errors that occur during
25+
* JNI operations.
2626
*/
2727
public class FaissException extends Exception {
2828
private static final long serialVersionUID = 1L;
@@ -55,4 +55,3 @@ public FaissException(Throwable cause) {
5555
super(cause);
5656
}
5757
}
58-

paimon-faiss-jni/src/main/java/org/apache/paimon/faiss/FaissNative.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
/**
2222
* Native method declarations for Faiss JNI.
2323
*
24-
* <p>This class contains all the native method declarations that are implemented
25-
* in the JNI C++ layer. These methods directly map to Faiss C++ API calls.
24+
* <p>This class contains all the native method declarations that are implemented in the JNI C++
25+
* layer. These methods directly map to Faiss C++ API calls.
2626
*
27-
* <p>Users should not call these methods directly. Instead, use the high-level
28-
* Java API classes like {@link Index} and {@link IndexFactory}.
27+
* <p>Users should not call these methods directly. Instead, use the high-level Java API classes
28+
* like {@link Index} and {@link IndexFactory}.
2929
*/
3030
final class FaissNative {
3131

@@ -304,4 +304,3 @@ static native void indexSearch(
304304
*/
305305
static native int getNumThreads();
306306
}
307-

0 commit comments

Comments
 (0)