Skip to content

Conversation

@parthchandra
Copy link
Contributor

Which issue does this PR close?

Closes #2360.

Rationale for this change

Some tests should be run only when the binary has been built with specific features

What changes are included in this PR?

Adds a jni call to check if a feature required by the test is available in the build

How are these changes tested?

@codecov-commenter
Copy link

codecov-commenter commented Sep 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.43%. Comparing base (f09f8af) to head (57b6e14).
⚠️ Report is 500 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2372      +/-   ##
============================================
+ Coverage     56.12%   57.43%   +1.30%     
- Complexity      976     1296     +320     
============================================
  Files           119      147      +28     
  Lines         11743    13418    +1675     
  Branches       2251     2349      +98     
============================================
+ Hits           6591     7706    +1115     
- Misses         4012     4449     +437     
- Partials       1140     1263     +123     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@parthchandra parthchandra marked this pull request as ready for review September 12, 2025 19:44
@parthchandra
Copy link
Contributor Author

@wForget ptal

test("test native_datafusion scan on fake fs") {
// Skip test if HDFS feature is not enabled in native library
val hdfsEnabled =
try {
Copy link
Member

Choose a reason for hiding this comment

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

Should we extract this try...catch block into a common method in NativeBase?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea. Done

/// * `1` (true) if the feature is enabled
/// * `0` (false) if the feature is disabled or unknown
#[no_mangle]
pub extern "system" fn Java_org_apache_comet_NativeBase_isFeatureEnabled(
Copy link
Contributor

Choose a reason for hiding this comment

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

@parthchandra please help me to understand where the feature comes from?
Another thing would it support multiple features like https://doc.rust-lang.org/cargo/reference/features.html#command-line-feature-options
features=f1,f2 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The name of the feature comes from the features specified in cargo.toml. And no, this is one feature at a time.

@wForget
Copy link
Member

wForget commented Sep 13, 2025

How about we replace it with getCometFeatures to get the features enabled by comet and caching them in the JVM? That way we can avoid multiple jni calls caused by multiple calls.

@parthchandra
Copy link
Contributor Author

How about we replace it with getCometFeatures to get the features enabled by comet and caching them in the JVM? That way we can avoid multiple jni calls caused by multiple calls.

Um. It's not that expensive to make a jni call in a unit test :)

Co-authored-by: Oleks V <comphead@users.noreply.github.com>
Copy link
Contributor

@comphead comphead left a comment

Choose a reason for hiding this comment

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

lgtm thanks @parthchandra

@parthchandra parthchandra merged commit 9994657 into apache:main Sep 15, 2025
94 checks passed
@parthchandra
Copy link
Contributor Author

merged. Thank you @comphead @wForget

coderfender pushed a commit to coderfender/datafusion-comet that referenced this pull request Dec 13, 2025
* feat: feature specific tests
@parthchandra parthchandra deleted the feature-tests branch January 14, 2026 22:02
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.

Enable feature specific unit tests

4 participants