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

Share struct member definition for parse_options and parse_options_view #15825

Open
vyasr opened this issue May 22, 2024 · 1 comment
Open

Share struct member definition for parse_options and parse_options_view #15825

vyasr opened this issue May 22, 2024 · 1 comment
Labels
improvement Improvement / enhancement to an existing function libcudf Affects libcudf (C++/CUDA) code.

Comments

@vyasr
Copy link
Contributor

vyasr commented May 22, 2024

question: It seems a shame that one must repeat most of the fields between parse_options and parse_options_view. Shall we open an issue to discuss whether these should be shared with something like:

struct _parse_options {
   char delimiter;
   ...;
   ...;
}

struct parse_options_view {
    struct _parse_options opts;
    cudf::detail::trie_view trie_true;
    ...;
}

struct parse_options {
   struct _parse_options opts;
   cudf::detail::optional_tree trie_true;
   ...
   
}

WDYT?

Originally posted by @wence- in #15727 (comment)

@etseidl
Copy link
Contributor

etseidl commented May 23, 2024

how about something like

template <class TrieT>
struct _parse_options {
  char delimiter;
  ...
  TrieT trie_true;
  TrieT trie_false;
  TrieT trie_na;
  bool multi_delimiter;
};

using parse_options_view = _parse_options<cudf::detail::trie_view>;

struct parse_options : public _parse_options<cudf::detail::optional_trie> {
  [[nodiscard]] json_inference_options_view json_view() const { ... }
  ...
};

cc @vuule

@brandon-b-miller brandon-b-miller added libcudf Affects libcudf (C++/CUDA) code. improvement Improvement / enhancement to an existing function labels Jun 4, 2024
@karthikeyann karthikeyann added this to the Nested JSON reader milestone Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improvement / enhancement to an existing function libcudf Affects libcudf (C++/CUDA) code.
Projects
None yet
Development

No branches or pull requests

4 participants