Repository navigation
Start migrating I/O writers to pylibcudf (starting with JSON) #15952
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
rapids-bot
merged 38 commits into
NVIDIA:branch-24.08
from
lithomas1:pylibcudf-io-writers
Jul 2, 2024
Merged
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
591cdd2
Start migrating I/O writers to pylibcudf (starting with JSON)
lithomas1 15daaaa
update docs
lithomas1 72204f1
Merge branch 'branch-24.08' of github.com:rapidsai/cudf into pylibcud…
lithomas1 c24664c
update and start writing tests
lithomas1 8c88c7c
Merge branch 'branch-24.08' of github.com:rapidsai/cudf into pylibcud…
lithomas1 2b3853f
add some tests
lithomas1 cd6df5e
Merge branch 'branch-24.08' of github.com:rapidsai/cudf into pylibcud…
lithomas1 c54316e
update
lithomas1 dc93356
Merge branch 'branch-24.08' of github.com:rapidsai/cudf into pylibcud…
lithomas1 8c4c4e4
address comments
lithomas1 63358e9
Merge branch 'branch-24.08' of github.com:rapidsai/cudf into pylibcud…
lithomas1 9150a6c
try something else
lithomas1 b1951d0
try fix
lithomas1 1228569
update following feedback
lithomas1 699efd3
cleanup tests
lithomas1 e242182
address more comments
lithomas1 564358f
Merge branch 'branch-24.08' into pylibcudf-io-writers
lithomas1 e0901dd
fix bad merge
lithomas1 d22953f
Merge branch 'branch-24.08' into pylibcudf-io-writers
lithomas1 604c16d
address more comments
lithomas1 e6c3ec7
address more comments
lithomas1 624d444
fix all nested struct cases
lithomas1 53b821c
Merge branch 'pylibcudf-io-writers' of github.com:lithomas1/cudf into…
lithomas1 186a2fb
Merge branch 'branch-24.08' of github.com:rapidsai/cudf into pylibcud…
lithomas1 9a6a896
Merge branch 'branch-24.08' of github.com:rapidsai/cudf into pylibcud…
lithomas1 0ed9af6
Fix error in testing utils
lithomas1 aff6178
small test fixes
lithomas1 f7cd9e6
cleanup utils
lithomas1 c5a3fbe
Merge branch 'branch-24.08' of github.com:rapidsai/cudf into pylibcud…
lithomas1 79c1dfd
clean source_or_sink
lithomas1 8fc139f
Merge branch 'pylibcudf-io-writers' of github.com:lithomas1/cudf into…
lithomas1 e940e30
Address code review
lithomas1 e57a677
Merge branch 'branch-24.08' of github.com:rapidsai/cudf into pylibcud…
lithomas1 7806ce4
simplify again
lithomas1 25c25d4
Merge branch 'branch-24.08' of github.com:rapidsai/cudf into pylibcud…
lithomas1 60287e1
address more comments
lithomas1 205c32c
Update python/cudf/cudf/_lib/pylibcudf/io/types.pyx
vyasr d325b64
Merge branch 'branch-24.08' into pylibcudf-io-writers
vyasr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| # Copyright (c) 2024, NVIDIA CORPORATION. | ||
|
|
||
| from . cimport avro, types | ||
| from .types cimport SourceInfo, TableWithMetadata | ||
| from . cimport avro, json, types | ||
| from .types cimport SinkInfo, SourceInfo, TableWithMetadata |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| # Copyright (c) 2024, NVIDIA CORPORATION. | ||
|
|
||
| from . import avro, types | ||
| from .types import SourceInfo, TableWithMetadata | ||
| from . import avro, json, types | ||
| from .types import SinkInfo, SourceInfo, TableWithMetadata |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Copyright (c) 2024, NVIDIA CORPORATION. | ||
|
|
||
| from libcpp cimport bool | ||
| from libcpp.string cimport string | ||
|
lithomas1 marked this conversation as resolved.
Resolved
|
||
|
|
||
| from cudf._lib.pylibcudf.io.types cimport SinkInfo, TableWithMetadata | ||
| from cudf._lib.pylibcudf.libcudf.io.types cimport compression_type | ||
|
lithomas1 marked this conversation as resolved.
Resolved
|
||
|
|
||
|
|
||
| cpdef void write_json( | ||
| SinkInfo sink_info, | ||
| TableWithMetadata tbl, | ||
| str na_rep = *, | ||
| bool include_nulls = *, | ||
| bool lines = *, | ||
| int rows_per_chunk = *, | ||
| str true_value = *, | ||
| str false_value = * | ||
| ) | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| # Copyright (c) 2024, NVIDIA CORPORATION. | ||
|
|
||
| from libcpp cimport bool | ||
| from libcpp.limits cimport numeric_limits | ||
| from libcpp.string cimport string | ||
| from libcpp.utility cimport move | ||
|
|
||
| from cudf._lib.pylibcudf.io.types cimport SinkInfo, TableWithMetadata | ||
| from cudf._lib.pylibcudf.libcudf.io.json cimport ( | ||
| json_writer_options, | ||
| write_json as cpp_write_json, | ||
| ) | ||
| from cudf._lib.pylibcudf.libcudf.io.types cimport table_metadata | ||
| from cudf._lib.pylibcudf.types cimport size_type | ||
|
|
||
|
|
||
| cpdef void write_json( | ||
| SinkInfo sink_info, | ||
| TableWithMetadata table_w_meta, | ||
| str na_rep = "", | ||
| bool include_nulls = False, | ||
| bool lines = False, | ||
| int rows_per_chunk = numeric_limits[size_type].max(), | ||
| str true_value = "true", | ||
| str false_value = "false" | ||
| ): | ||
| """ | ||
| """ | ||
| cdef table_metadata tbl_meta = table_w_meta.metadata | ||
| cdef string na_rep_c = na_rep.encode() | ||
| cdef string true_value_c = true_value.encode() | ||
| cdef string false_value_c = false_value.encode() | ||
|
lithomas1 marked this conversation as resolved.
Resolved
|
||
|
|
||
| cdef json_writer_options options = move( | ||
| json_writer_options.builder(sink_info.c_obj, table_w_meta.tbl.view()) | ||
| .metadata(tbl_meta) | ||
| .na_rep(na_rep_c) | ||
| .include_nulls(include_nulls) | ||
| .lines(lines) | ||
| .rows_per_chunk(rows_per_chunk) | ||
| .true_value(true_value_c) | ||
| .false_value(false_value_c) | ||
| .build() | ||
| ) | ||
|
|
||
| with nogil: | ||
| cpp_write_json(options) | ||
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.