Skip to content
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

Migrate CSV writer to pylibcudf #17163

Merged
merged 40 commits into from
Nov 21, 2024

Conversation

Matt711
Copy link
Contributor

@Matt711 Matt711 commented Oct 24, 2024

Description

Apart of #15162

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@Matt711 Matt711 added feature request New feature or request non-breaking Non-breaking change labels Oct 24, 2024
@Matt711 Matt711 self-assigned this Oct 24, 2024
@github-actions github-actions bot added Python Affects Python cuDF API. pylibcudf Issues specific to the pylibcudf package labels Oct 24, 2024
@Matt711 Matt711 changed the title [WIP] Migrate CSV writer to pylibcudf Migrate CSV writer to pylibcudf Nov 6, 2024
@Matt711 Matt711 marked this pull request as ready for review November 6, 2024 18:15
@Matt711 Matt711 requested a review from a team as a code owner November 6, 2024 18:15
@Matt711 Matt711 mentioned this pull request Nov 18, 2024
3 tasks
@Matt711 Matt711 added the 3 - Ready for Review Ready for review by team label Nov 18, 2024
Copy link
Contributor

@wence- wence- left a comment

Choose a reason for hiding this comment

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

A few questions

python/pylibcudf/pylibcudf/io/csv.pyx Outdated Show resolved Hide resolved
python/pylibcudf/pylibcudf/io/csv.pyx Outdated Show resolved Hide resolved
python/pylibcudf/pylibcudf/io/types.pyx Show resolved Hide resolved
python/pylibcudf/pylibcudf/io/types.pyx Outdated Show resolved Hide resolved
python/pylibcudf/pylibcudf/io/types.pyx Outdated Show resolved Hide resolved
python/pylibcudf/pylibcudf/tests/conftest.py Outdated Show resolved Hide resolved
python/pylibcudf/pylibcudf/io/csv.pyi Outdated Show resolved Hide resolved
return csv_options


def write_csv(
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this (should this? @vyasr) be a cpdef function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. We've been cpdef'ing them, so I did it here too

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's good practice to do it consistently everywhere to enable full Cython usage. For I/O it's probably less important in the grand scheme of things since that shouldn't propagate bad typing afterwards in any way, but consistency helps.

Copy link
Contributor

@vyasr vyasr left a comment

Choose a reason for hiding this comment

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

Some small suggestions, but nothing blocking. Looks great overall.

python/cudf/cudf/_lib/csv.pyx Outdated Show resolved Hide resolved
python/cudf/cudf/_lib/csv.pyx Outdated Show resolved Hide resolved
python/pylibcudf/pylibcudf/io/csv.pyx Outdated Show resolved Hide resolved
python/pylibcudf/pylibcudf/tests/conftest.py Show resolved Hide resolved
@Matt711
Copy link
Contributor Author

Matt711 commented Nov 21, 2024

/merge

1 similar comment
@Matt711
Copy link
Contributor Author

Matt711 commented Nov 21, 2024

/merge

@Matt711 Matt711 requested a review from wence- November 21, 2024 12:10
Comment on lines +64 to +76
class CsvWriterOptionsBuilder:
def __init__(self): ...
def names(self, names: list) -> CsvWriterOptionsBuilder: ...
def na_rep(self, val: str) -> CsvWriterOptionsBuilder: ...
def include_header(self, val: bool) -> CsvWriterOptionsBuilder: ...
def rows_per_chunk(self, val: int) -> CsvWriterOptionsBuilder: ...
def line_terminator(self, term: str) -> CsvWriterOptionsBuilder: ...
def inter_column_delimiter(
self, delim: str
) -> CsvWriterOptionsBuilder: ...
def true_value(self, val: str) -> CsvWriterOptionsBuilder: ...
def false_value(self, val: str) -> CsvWriterOptionsBuilder: ...
def build(self) -> CsvWriterOptions: ...
Copy link
Contributor

@wence- wence- Nov 21, 2024

Choose a reason for hiding this comment

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

nit: Let's do this in a followup, these should return Self (from typing). Edit: apart from build.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do

@rapids-bot rapids-bot bot merged commit f54c1a5 into rapidsai:branch-24.12 Nov 21, 2024
107 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 - Ready for Review Ready for review by team feature request New feature or request libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change pylibcudf Issues specific to the pylibcudf package Python Affects Python cuDF API.
Projects
Status: Done
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants