Remove the deprecated XGDMatrixCreateFromFile.#12297
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes the deprecated C API entry point XGDMatrixCreateFromFile and updates internal bindings, tests, and documentation to use the JSON-config-based XGDMatrixCreateFromURI API instead.
Changes:
- Remove
XGDMatrixCreateFromFilefrom the public C header and C API implementation. - Update C++ C-API tests and user-facing docs/tutorial/demo to construct and pass URI JSON configs to
XGDMatrixCreateFromURI. - Update XGBoost4J JNI + Java wrappers/tests to call
XGDMatrixCreateFromURI(with JNI constructing the JSON config).
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/cpp/c_api/test_c_api.cc | Drops deprecated API coverage and consolidates error-handling test to the URI path. |
| src/c_api/c_api.cc | Removes the deprecated XGDMatrixCreateFromFile C API shim implementation. |
| include/xgboost/c_api.h | Removes the deprecated XGDMatrixCreateFromFile declaration/docs from the public header. |
| doc/tutorials/c_api_tutorial.rst | Updates tutorial examples to use JSON config + XGDMatrixCreateFromURI. |
| demo/c-api/basic/c-api-demo.c | Updates demo to build a JSON config string and call XGDMatrixCreateFromURI. |
| jvm-packages/xgboost4j/src/main/java/ml/dmlc/xgboost4j/java/XGBoostJNI.java | Renames native entry point to XGDMatrixCreateFromURI. |
| jvm-packages/xgboost4j/src/main/java/ml/dmlc/xgboost4j/java/DMatrix.java | Switches Java constructor to call the renamed native method. |
| jvm-packages/xgboost4j/src/native/xgboost4j.h | Renames the JNI function declaration for the DMatrix create call. |
| jvm-packages/xgboost4j/src/native/xgboost4j.cpp | Implements JNI wrapper that builds JSON config and calls XGDMatrixCreateFromURI. |
| jvm-packages/xgboost4j/src/test/java/ml/dmlc/xgboost4j/java/DMatrixTest.java | Renames the test to reflect URI-based creation. |
Files not reviewed (1)
- jvm-packages/xgboost4j/src/native/xgboost4j.h: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+39
to
+43
| static void MakeDMatrixConfig(char const* uri, int silent, size_t length, char* out) { | ||
| static char const kTemplate[] = "{\"uri\": \"%s\", \"silent\": %d}"; | ||
| memset(out, '\0', length); | ||
| snprintf(out, length, kTemplate, uri, silent); | ||
| } |
hcho3
approved these changes
Jul 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.