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

Improve performance in JSON reader when mixed_types_as_string option is enabled #15236

Merged
merged 4 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cpp/src/io/json/json_column.cu
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,9 @@ void make_device_json_column(device_span<SymbolT const> input,
columns.try_emplace(this_col_id, columns.at(old_col_id));
karthikeyann marked this conversation as resolved.
Show resolved Hide resolved
continue;
}
col.forced_as_string_column = true;
columns.try_emplace(this_col_id, columns.at(old_col_id));
continue;
karthikeyann marked this conversation as resolved.
Show resolved Hide resolved
}

if (column_categories[this_col_id] == NC_VAL || column_categories[this_col_id] == NC_STR) {
Expand Down Expand Up @@ -915,6 +918,8 @@ std::pair<std::unique_ptr<column>, std::vector<column_name_info>> device_json_co
: "n/a");
#endif
target_type = schema.value().type;
} else if (json_col.forced_as_string_column) {
target_type = data_type{type_id::STRING};
}
// Infer column type, if we don't have an explicit type for it
else {
Expand Down
2 changes: 2 additions & 0 deletions cpp/src/io/json/nested_json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ struct device_json_column {
std::vector<std::string> column_order;
// Counting the current number of items in this column
row_offset_t num_rows = 0;
// Force as string column
bool forced_as_string_column{false};

/**
* @brief Construct a new d json column object
Expand Down
Loading