Skip to content

Commit

Permalink
fix make_empty_scalar_like (#9782)
Browse files Browse the repository at this point in the history
Signed-off-by: sperlingxx <[email protected]>
  • Loading branch information
sperlingxx authored Nov 30, 2021
1 parent 2c6f919 commit 74ac6ed
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions cpp/src/io/orc/writer_impl.cu
Original file line number Diff line number Diff line change
Expand Up @@ -1496,15 +1496,23 @@ orc_table_view make_orc_table_view(table_view const& table,
append_orc_column(col.child(lists_column_view::child_column_index),
&orc_columns[new_col_idx],
col_meta.child(lists_column_view::child_column_index));
} else if (kind == TypeKind::STRUCT or kind == TypeKind::MAP) {
// MAP: skip to the list child - include grandchildren columns instead of children
auto const real_parent_col =
kind == TypeKind::MAP ? col.child(lists_column_view::child_column_index) : col;
for (auto child_idx = 0; child_idx != real_parent_col.num_children(); ++child_idx) {
append_orc_column(real_parent_col.child(child_idx),
&orc_columns[new_col_idx],
col_meta.child(child_idx));
} else if (kind == TypeKind::STRUCT) {
for (auto child_idx = 0; child_idx != col.num_children(); ++child_idx) {
append_orc_column(
col.child(child_idx), &orc_columns[new_col_idx], col_meta.child(child_idx));
}
} else if (kind == TypeKind::MAP) {
// MAP: skip to the list child - include grandchildren columns instead of children
auto const real_parent_col = col.child(lists_column_view::child_column_index);
auto const& real_parent_meta = col_meta.child(lists_column_view::child_column_index);
CUDF_EXPECTS(real_parent_meta.num_children() == 2,
"Map struct column should have exactly two children");
// process MAP key
append_orc_column(
real_parent_col.child(0), &orc_columns[new_col_idx], real_parent_meta.child(0));
// process MAP value
append_orc_column(
real_parent_col.child(1), &orc_columns[new_col_idx], real_parent_meta.child(1));
}
};

Expand Down

0 comments on commit 74ac6ed

Please sign in to comment.