Squashed data fusion changes - #270
Conversation
Signed-off-by: Marc Handalian <marc.handalian@gmail.com> (cherry picked from commit cb75910)
Signed-off-by: Vinay Krishna Pudyodu <vinkrish.neo@gmail.com> (cherry picked from commit eb01905)
…project#19399) Signed-off-by: Vinay Krishna Pudyodu <vinkrish.neo@gmail.com> (cherry picked from commit c9d5b17)
Signed-off-by: Vinay Krishna Pudyodu <vinkrish.neo@gmail.com> (cherry picked from commit 98de93e)
Signed-off-by: Vinay Krishna Pudyodu <vinkrish.neo@gmail.com> (cherry picked from commit 5fef617)
Signed-off-by: Vinay Krishna Pudyodu <vinkrish.neo@gmail.com> (cherry picked from commit e4ebf59)
Signed-off-by: bharath-techie <bharath78910@gmail.com>
Signed-off-by: bharath-techie <bharath78910@gmail.com>
Signed-off-by: bharath-techie <bharath78910@gmail.com>
Signed-off-by: bharath-techie <bharath78910@gmail.com>
Signed-off-by: bharath-techie <bharath78910@gmail.com>
Co-authored-by: Arpit Bandejiya <abandeji@amazon.com> Signed-off-by: bharath-techie <bharath78910@gmail.com>
Co-authored-by: Arpit Bandejiya <abandeji@amazon.com> Signed-off-by: Arpit Bandejiya <abandeji@amazon.com>
Signed-off-by: Arpit Bandejiya <abandeji@amazon.com>
* Abstracting lucene away: part 1 * initial abstractions to reduce indexing engine coupling * Text backed engine testing --------- Co-authored-by: Mohit Godwani <mgodwan@amazon.com>
Signed-off-by: bharath-techie <bharath78910@gmail.com>
Signed-off-by: Arpit Bandejiya <abandeji@amazon.com>
…roject#19441) Signed-off-by: expani <anijainc@amazon.com>
Signed-off-by: Arpit Bandejiya <abandeji@amazon.com>
* Changes in dataformat for CSVEngine Signed-off-by: Arpit Bandejiya <abandeji@amazon.com> * Changes for Reader to work Signed-off-by: Arpit Bandejiya <abandeji@amazon.com> --------- Signed-off-by: Arpit Bandejiya <abandeji@amazon.com> Co-authored-by: Bharathwaj G <bharath78910@gmail.com> Signed-off-by: bharath-techie <bharath78910@gmail.com>
Signed-off-by: bharath-techie <bharath78910@gmail.com>
* Integrate aggregators to convert result from datafusion Signed-off-by: expani <anijainc@amazon.com> * Initialised bigArrays and queryCollManagers for DatafusionContext Signed-off-by: expani <anijainc@amazon.com> * Refactored to set agg result within utility Signed-off-by: expani <anijainc@amazon.com> --------- Signed-off-by: expani <anijainc@amazon.com>
Co-authored-by: Arpit Bandejiya <abandeji@amazon.com> Signed-off-by: bharath-techie <bharath78910@gmail.com>
Signed-off-by: bharath-techie <bharath78910@gmail.com>
Signed-off-by: bharath-techie <bharath78910@gmail.com>
Signed-off-by: bharath-techie <bharath78910@gmail.com>
Signed-off-by: expani <anijainc@amazon.com>
* Feature/datafusion 4 (#46) * Composite document writer pool initial implementation * Committer interface and lucene based commit engine implementation * Catalog snapshot changes to create segment view during commit --------- Co-authored-by: Shashank Gowri <shnkgo@amazon.com> * fix build for commit integration Signed-off-by: bharath-techie <bharath78910@gmail.com> --------- Signed-off-by: bharath-techie <bharath78910@gmail.com> Co-authored-by: Shashank Gowri <shnkgo@amazon.com>
* Add memory pool changes for datafusion Signed-off-by: Arpit Bandejiya <abandeji@amazon.com> * Add comments over the new monitor structs Signed-off-by: Arpit Bandejiya <abandeji@amazon.com> * Add changes for wrapper of global runTimeEnv Signed-off-by: Arpit Bandejiya <abandeji@amazon.com> * Add documentation related setting and make the memory pool static * comment the print for memory * Fix tests Signed-off-by: Arpit Bandejiya <abandeji@amazon.com> --------- Signed-off-by: Arpit Bandejiya <abandeji@amazon.com>
Signed-off-by: expani <anijainc@amazon.com>
* Add parquet benchmarks in missing javadoc Signed-off-by: Arpit Bandejiya <abandeji@amazon.com> * add flag to disable java doc check --------- Signed-off-by: Arpit Bandejiya <abandeji@amazon.com>
* Single commit with all changes * Update the e2e test workflow * Ignore lint * Add missing doc flag * fix newline * remove extra missingdoc flag in action * Add changes to have all queries * Run only DatafusionReaderManager test Signed-off-by: Arpit Bandejiya <abandeji@amazon.com> * Fix 200 status code Signed-off-by: Arpit Bandejiya <abandeji@amazon.com> --------- Signed-off-by: Arpit Bandejiya <abandeji@amazon.com>
* Add CacheManager # Conflicts: # plugins/engine-datafusion/jni/src/lib.rs # plugins/engine-datafusion/jni/src/listing_table.rs # plugins/engine-datafusion/jni/src/row_id_optimizer.rs # plugins/engine-datafusion/jni/src/util.rs # Conflicts: # plugins/engine-datafusion/jni/src/lib.rs # plugins/engine-datafusion/src/main/java/org/opensearch/datafusion/DataFusionQueryJNI.java # plugins/engine-datafusion/src/main/java/org/opensearch/datafusion/DataFusionService.java # plugins/engine-datafusion/src/main/java/org/opensearch/datafusion/core/GlobalRuntimeEnv.java # plugins/engine-datafusion/src/main/java/org/opensearch/datafusion/search/DatafusionSearcher.java # plugins/engine-datafusion/src/test/java/org/opensearch/datafusion/DataFusionReaderManagerTests.java # Conflicts: # plugins/engine-datafusion/jni/src/lib.rs # plugins/engine-datafusion/src/main/java/org/opensearch/datafusion/DataFusionPlugin.java # plugins/engine-datafusion/src/main/java/org/opensearch/datafusion/DataFusionService.java # plugins/engine-datafusion/src/main/java/org/opensearch/datafusion/core/GlobalRuntimeEnv.java # plugins/engine-datafusion/src/main/java/org/opensearch/datafusion/search/DatafusionSearcher.java # plugins/engine-datafusion/src/test/java/org/opensearch/datafusion/DataFusionReaderManagerTests.java # plugins/engine-datafusion/src/test/java/org/opensearch/datafusion/DataFusionServiceTests.java # plugins/engine-datafusion/src/test/java/org/opensearch/datafusion/TestDataFusionServiceTests.java * create CacheManager struct * rebase * add file2 * fix references * cleanup commented code * remove unused references * rebase1 * Add Native Handles * moving cacheOperations to use runtimeEnv * fix references * runtimeHandle reference * rename configPtr reference
…#20048) * add stream and allocator closure post fetch phase Signed-off-by: Marc Handalian <marc.handalian@gmail.com> * Move stream and allocator for executeQueryPhase into correct scope Signed-off-by: Marc Handalian <marc.handalian@gmail.com> --------- Signed-off-by: Marc Handalian <marc.handalian@gmail.com>
…nsearch-project#20032) * Injecting count sub agg if absent to ensure doc_count is correct Signed-off-by: expani <anijainc@amazon.com> * Sorting keys for merge sort to work Signed-off-by: expani <anijainc@amazon.com> * Went into zen mode and made code simpler Signed-off-by: expani <anijainc@amazon.com> --------- Signed-off-by: expani <anijainc@amazon.com>
…ject#20041) * Single commit with all changes * Update the e2e test workflow * Clean unused functions Signed-off-by: Arpit Bandejiya <abandeji@amazon.com> * remove imports --------- Signed-off-by: Arpit Bandejiya <abandeji@amazon.com>
Signed-off-by: Dhwanil Patel <dhwanip@amazon.com>
* fixing path reference while adding to cache * remove unnecessary logs
…roject#20070) Signed-off-by: Dhwanil Patel <dhwanip@amazon.com>
…s with Searcher (opensearch-project#20063) * CatalogSnapshot Manager + postDelete hooks * Fix tests * Minor fixes to post delete hooks * Fix IndexFileDeleterTests * Add IndexFileDeleter tests in E2E * Empty commit to re-run E2E tests
Signed-off-by: Sandesh Kumar <sandeshkr419@gmail.com>
…project#20079) These tests run 42 or 43 queries right now and match results for correctness. all queries flagged as supported are expected to succeed for this check to pass Signed-off-by: Marc Handalian <marc.handalian@gmail.com>
Signed-off-by: Marc Handalian <marc.handalian@gmail.com>
…sync changes (opensearch-project#20071) * Changes for tokio io/cpu runtime + search flow async changes Signed-off-by: bharath-techie <bharath78910@gmail.com> * minor fixes and todos Signed-off-by: bharath-techie <bharath78910@gmail.com> * Addressing comment to move to ActionListener Signed-off-by: bharath-techie <bharath78910@gmail.com> * addressing comments Signed-off-by: bharath-techie <bharath78910@gmail.com> * fix to sort numeric aggs Signed-off-by: bharath-techie <bharath78910@gmail.com> --------- Signed-off-by: bharath-techie <bharath78910@gmail.com>
…ect#20110) Signed-off-by: Arpit Bandejiya <abandeji@amazon.com>
…pensearch-project#20119) Signed-off-by: Dhwanil Patel <dhwanip@amazon.com>
…pensearch-project#19978) * Adding JNI abstractions for logging in rust through RustLoggerBridge Signed-off-by: Raghuvansh Raj <raghraaj@amazon.com> * Adding logging for java in parquet-data-format module and cleaning up stale files Signed-off-by: Raghuvansh Raj <raghraaj@amazon.com> --------- Signed-off-by: Raghuvansh Raj <raghraaj@amazon.com>
* Refactor stream handling for DF execution * Change to Buffer Allocator for DF execution * Introduce RecordBatchIterator and integrate with collector * Minor fixup * Update VSRManager to update field vector atomically * Fixup * Fixup * Fixup * Test fixup * Integrate with AsyncRecordBatchIterator * Fix up
Summary of ChangesHello @sandeshkr419, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances OpenSearch's data processing capabilities by integrating the DataFusion query engine and introducing native support for the Parquet columnar data format. It lays the groundwork for a vectorized execution framework, enabling more efficient storage and querying of analytical workloads. The changes involve new modules for a vectorized execution Service Provider Interface (SPI), a dedicated Parquet data format plugin with a Rust backend, and a DataFusion engine plugin that orchestrates these components for advanced query execution, complete with robust memory management and caching. Highlights
Ignored Files
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a significant new feature for data fusion, including support for the Parquet data format, a vectorized execution SPI, and a DataFusion engine plugin. The changes span across Java, Gradle, and Rust code, setting up the foundation for columnar data processing.
While the overall direction is promising, my review has identified several critical issues that must be addressed before this can be considered for merging. These include disabled assertions in tests, commented-out API validation logic, a memory leak in the native resource handling, and several build-breaking issues in the Rust code such as an invalid edition and JNI signature mismatches. There are also some bugs in the Java code, like incorrect enum values. These issues suggest that the code is in a very early stage of development and requires substantial refinement to meet production quality standards.
| // TODO : remove this - this disables assertions | ||
| node.jvmArgs(" -da "); |
There was a problem hiding this comment.
This change disables assertions (-da) for test cluster nodes. The TODO comment indicates this might be temporary, but merging this would cause tests to run without critical checks, potentially masking bugs and regressions. Assertions should be enabled in test environments to ensure code correctness. Please remove this line before merging.
| // for (var element : elements) { | ||
| // validate(element); | ||
| // | ||
| // if (!checkPackage(element)) { | ||
| // continue; | ||
| // } | ||
| // | ||
| // // Skip all not-public elements | ||
| // checkPublicVisibility(null, element); | ||
| // | ||
| // if (element instanceof TypeElement) { | ||
| // process((TypeElement) element); | ||
| // } | ||
| // } |
There was a problem hiding this comment.
The core logic of the ApiAnnotationProcessor has been commented out. This processor is essential for enforcing API backward compatibility and proper usage of annotations like @PublicApi and @ExperimentalApi. Disabling it, even temporarily, is dangerous as it can lead to unintended breaking changes. This code must be restored, and any compilation issues that led to it being commented out should be fixed properly.
| throw new IllegalArgumentException("Null native pointer"); | ||
| } | ||
| this.ptr = ptr; | ||
| this.cleanable = CLEANER.register(this, new CleanupAction(ptr, this::doClose)); |
There was a problem hiding this comment.
The use of java.lang.ref.Cleaner here will cause a memory leak. The Runnable passed to CLEANER.register is created with a method reference this::doClose, which captures a strong reference to the NativeHandle instance (this). According to the Cleaner documentation, the cleanup action must not hold a strong reference to the object being registered, otherwise the object will never become phantom-reachable and the cleanup action will never run. This means both the Java object and the native memory it points to will be leaked.
The CleanupAction should be a static class that does not hold a reference to the NativeHandle instance. It should operate on the native pointer (ptr) and use a static method for deallocation.
| @ExperimentalApi | ||
| public enum DataFormat { | ||
| /** CSV Format*/ | ||
| CSV("parquet"), |
| } | ||
|
|
||
| public DataFormat getDataFormat() { | ||
| return DataFormat.CSV; |
| [package] | ||
| name = "rust" | ||
| version = "0.1.0" | ||
| edition = "2024" |
| pub extern "system" fn Java_com_parquet_parquetdataformat_bridge_RustBridge_createWriter( | ||
| mut env: JNIEnv, | ||
| _class: JClass, | ||
| file: JString, | ||
| schema_address: jlong | ||
| ) -> jint { | ||
| let filename: String = env.get_string(&file).expect("Couldn't get java string!").into(); | ||
| match NativeParquetWriter::create_writer(filename, schema_address as i64) { | ||
| Ok(_) => 0, | ||
| Err(_) => -1, | ||
| } | ||
| } | ||
|
|
||
| #[unsafe(no_mangle)] | ||
| pub extern "system" fn Java_com_parquet_parquetdataformat_bridge_RustBridge_write( | ||
| mut env: JNIEnv, | ||
| _class: JClass, | ||
| file: JString, | ||
| array_address: jlong, | ||
| schema_address: jlong | ||
| ) -> jint { | ||
| let filename: String = env.get_string(&file).expect("Couldn't get java string!").into(); | ||
| match NativeParquetWriter::write_data(filename, array_address as i64, schema_address as i64) { | ||
| Ok(_) => 0, | ||
| Err(_) => -1, | ||
| } | ||
| } | ||
|
|
||
| #[unsafe(no_mangle)] | ||
| pub extern "system" fn Java_com_parquet_parquetdataformat_bridge_RustBridge_closeWriter( | ||
| mut env: JNIEnv, | ||
| _class: JClass, | ||
| file: JString | ||
| ) -> jint { | ||
| let filename: String = env.get_string(&file).expect("Couldn't get java string!").into(); | ||
| match NativeParquetWriter::close_writer(filename) { | ||
| Ok(_) => 0, | ||
| Err(_) => -1, | ||
| } | ||
| } | ||
|
|
||
| #[unsafe(no_mangle)] | ||
| pub extern "system" fn Java_com_parquet_parquetdataformat_bridge_RustBridge_flushToDisk( | ||
| mut env: JNIEnv, | ||
| _class: JClass, | ||
| file: JString | ||
| ) -> jint { | ||
| let filename: String = env.get_string(&file).expect("Couldn't get java string!").into(); | ||
| match NativeParquetWriter::flush_to_disk(filename) { | ||
| Ok(_) => 0, | ||
| Err(_) => -1, | ||
| } |
There was a problem hiding this comment.
There is a JNI signature mismatch between the Java native method declarations in RustBridge.java and their Rust implementations here. The Java methods are declared as void and throws IOException, while the Rust JNI functions are implemented to return a jint. This will cause an UnsatisfiedLinkError at runtime.
The Rust functions should be updated to have a void return type and to throw a Java exception when an error occurs, to match the Java declaration. For example, instead of returning -1, use env.throw_new("java/io/IOException", error_message).
| compileJava { | ||
| options.compilerArgs += ['-processor', ['org.apache.logging.log4j.core.config.plugins.processor.PluginProcessor', | ||
| 'org.opensearch.common.annotation.processor.ApiAnnotationProcessor'].join(',')] | ||
| options.compilerArgs += ['-processor', ['org.apache.logging.log4j.core.config.plugins.processor.PluginProcessor'].join(',')] |
There was a problem hiding this comment.
| /modules/parquet-data-format/jni/target/.rustc_info.json | ||
|
|
||
| /modules/parquet-data-format/jni/target/release | ||
| **/Cargo.lock |
There was a problem hiding this comment.
The pattern **/Cargo.lock ignores all Cargo.lock files throughout the repository. For applications and top-level library crates, Cargo.lock should be checked into version control to ensure reproducible builds. Globally ignoring it can lead to dependency hell and non-deterministic builds across different environments. Please consider removing this global ignore and only ignore Cargo.lock files within build artifact directories (like target/), if necessary.
| -XX:+UnlockDiagnosticVMOptions | ||
|
|
||
| # Enabling debug logs for Allocators in Arrow | ||
| -Darrow.memory.debug.allocator=true |
There was a problem hiding this comment.
Description
Squashing all commits in my private repo to cherry-pick easily
Related Issues
Resolves #[Issue number to be closed when this PR is merged]
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.