Skip to content

Conversation

@jerry-024
Copy link
Contributor

@jerry-024 jerry-024 commented Jan 8, 2026

add faiss jni to support faiss in java

Tests

  • IndexTest

API and Format

Documentation

@jerry-024 jerry-024 marked this pull request as draft January 8, 2026 09:38
@jerry-024 jerry-024 force-pushed the support_faiss_jni branch 2 times, most recently from 75a5561 to cd3101d Compare January 8, 2026 10:15
@jerry-024 jerry-024 force-pushed the support_faiss_jni branch 2 times, most recently from f3456ce to 80c6129 Compare January 9, 2026 02:20
@jerry-024 jerry-024 marked this pull request as ready for review January 9, 2026 03:26
@jerry-024 jerry-024 requested a review from Copilot January 9, 2026 03:27
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds FAISS (Facebook AI Similarity Search) JNI bindings to enable vector similarity search in Java within the Paimon project. The implementation provides a comprehensive Java API wrapper around the native FAISS C++ library with zero-copy data transfer capabilities using direct ByteBuffers.

Key changes:

  • New paimon-faiss module with JNI bindings for FAISS library
  • Native C++ implementation with comprehensive JNI layer for index operations
  • Java wrapper classes providing type-safe API for vector indexing and search operations
  • Build infrastructure including CMake configuration, shell scripts, and GitHub Actions workflows

Reviewed changes

Copilot reviewed 22 out of 23 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pom.xml Adds new paimon-faiss profile and build exclusions for native artifacts
paimon-faiss/pom.xml Parent POM for FAISS module
paimon-faiss/paimon-faiss-jni/pom.xml Maven configuration for JNI module with SLF4J and test dependencies
paimon-faiss/paimon-faiss-jni/src/main/native/* CMake build configuration and C++ JNI implementation
paimon-faiss/paimon-faiss-jni/src/main/java/org/apache/paimon/faiss/* Java API wrapper classes for FAISS operations
paimon-faiss/paimon-faiss-jni/src/test/java/org/apache/paimon/faiss/IndexTest.java Comprehensive test suite covering index types, operations, and serialization
paimon-faiss/paimon-faiss-jni/scripts/build-native.sh Build script for compiling native libraries across platforms
.github/workflows/* CI/CD configuration for building and testing FAISS module
.gitignore Exclusions for native build artifacts
paimon-faiss/paimon-faiss-jni/NOTICE Licensing attribution for FAISS library

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

try (Index index = IndexFactory.create(DIMENSION, "IDMap,Flat", MetricType.L2)) {
ByteBuffer vectorBuffer = createVectorBuffer(NUM_VECTORS, DIMENSION);
ByteBuffer idBuffer = Index.allocateIdBuffer(NUM_VECTORS);
idBuffer.asLongBuffer();
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The result of idBuffer.asLongBuffer() is not used. This statement has no effect and should be removed.

Suggested change
idBuffer.asLongBuffer();

Copilot uses AI. Check for mistakes.
# See the License for the specific language governing permissions and
# limitations under the License.

cmake_minimum_required(VERSION 3.30.1)
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requiring exactly CMake version 3.30.1 is overly restrictive. This should use a minimum version requirement (e.g., cmake_minimum_required(VERSION 3.17)) rather than an exact version to allow compatibility with newer CMake versions and avoid forcing users to downgrade.

Suggested change
cmake_minimum_required(VERSION 3.30.1)
cmake_minimum_required(VERSION 3.17)

Copilot uses AI. Check for mistakes.
throw new ExceptionInInitializerError(e);
}
}

Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing JavaDoc for the public getVersion() method. All public API methods should have documentation explaining their purpose and return values.

Suggested change
/**
* Get the version of the underlying Faiss library.
*
* @return the Faiss library version string
*/

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@JingsongLi JingsongLi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jerry-024 +1

@JingsongLi JingsongLi merged commit 66fb0a0 into apache:master Jan 9, 2026
18 of 20 checks passed
@jerry-024 jerry-024 deleted the support_faiss_jni branch January 9, 2026 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants