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

Fix logical type issues in the Parquet writer #14322

Merged
Merged
Show file tree
Hide file tree
Changes from 3 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
6 changes: 4 additions & 2 deletions cpp/src/io/parquet/parquet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,15 @@ struct TimeUnit {
};

struct TimeType {
bool isAdjustedToUTC = false;
bool isAdjustedToUTC = true;
vuule marked this conversation as resolved.
Show resolved Hide resolved
TimeUnit unit;
explicit TimeType(TimeUnit::Type t = TimeUnit::MILLIS) : unit{t} {}
};

struct TimestampType {
bool isAdjustedToUTC = false;
bool isAdjustedToUTC = true;
TimeUnit unit;
explicit TimestampType(TimeUnit::Type t = TimeUnit::MILLIS) : unit{t} {}
};

struct IntType {
Expand Down
18 changes: 9 additions & 9 deletions cpp/src/io/parquet/writer_impl.cu
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ struct leaf_schema_fn {
col_schema.ts_scale = 1000;
if (not timestamp_is_int96) {
col_schema.converted_type = ConvertedType::TIMESTAMP_MILLIS;
col_schema.logical_type = LogicalType{TimestampType{false, TimeUnit::MILLIS}};
col_schema.logical_type = LogicalType{TimestampType{TimeUnit::MILLIS}};
}
}

Expand All @@ -415,7 +415,7 @@ struct leaf_schema_fn {
col_schema.stats_dtype = statistics_dtype::dtype_timestamp64;
if (not timestamp_is_int96) {
col_schema.converted_type = ConvertedType::TIMESTAMP_MILLIS;
col_schema.logical_type = LogicalType{TimestampType{false, TimeUnit::MILLIS}};
col_schema.logical_type = LogicalType{TimestampType{TimeUnit::MILLIS}};
}
}

Expand All @@ -426,7 +426,7 @@ struct leaf_schema_fn {
col_schema.stats_dtype = statistics_dtype::dtype_timestamp64;
if (not timestamp_is_int96) {
col_schema.converted_type = ConvertedType::TIMESTAMP_MICROS;
col_schema.logical_type = LogicalType{TimestampType{false, TimeUnit::MICROS}};
col_schema.logical_type = LogicalType{TimestampType{TimeUnit::MICROS}};
}
}

Expand All @@ -441,7 +441,7 @@ struct leaf_schema_fn {
}
// set logical type if it's not int96
else {
col_schema.logical_type = LogicalType{TimestampType{false, TimeUnit::NANOS}};
col_schema.logical_type = LogicalType{TimestampType{TimeUnit::NANOS}};
}
}

Expand All @@ -453,7 +453,7 @@ struct leaf_schema_fn {
col_schema.converted_type = ConvertedType::TIME_MILLIS;
col_schema.stats_dtype = statistics_dtype::dtype_int32;
col_schema.ts_scale = 24 * 60 * 60 * 1000;
col_schema.logical_type = LogicalType{TimeType{false, TimeUnit::MILLIS}};
col_schema.logical_type = LogicalType{TimeType{TimeUnit::MILLIS}};
}

template <typename T>
Expand All @@ -463,7 +463,7 @@ struct leaf_schema_fn {
col_schema.converted_type = ConvertedType::TIME_MILLIS;
col_schema.stats_dtype = statistics_dtype::dtype_int32;
col_schema.ts_scale = 1000;
col_schema.logical_type = LogicalType{TimeType{false, TimeUnit::MILLIS}};
col_schema.logical_type = LogicalType{TimeType{TimeUnit::MILLIS}};
}

template <typename T>
Expand All @@ -472,7 +472,7 @@ struct leaf_schema_fn {
col_schema.type = Type::INT32;
col_schema.converted_type = ConvertedType::TIME_MILLIS;
col_schema.stats_dtype = statistics_dtype::dtype_int32;
col_schema.logical_type = LogicalType{TimeType{false, TimeUnit::MILLIS}};
col_schema.logical_type = LogicalType{TimeType{TimeUnit::MILLIS}};
}

template <typename T>
Expand All @@ -481,7 +481,7 @@ struct leaf_schema_fn {
col_schema.type = Type::INT64;
col_schema.converted_type = ConvertedType::TIME_MICROS;
col_schema.stats_dtype = statistics_dtype::dtype_int64;
col_schema.logical_type = LogicalType{TimeType{false, TimeUnit::MICROS}};
col_schema.logical_type = LogicalType{TimeType{TimeUnit::MICROS}};
}

// unsupported outside cudf for parquet 1.0.
Expand All @@ -490,7 +490,7 @@ struct leaf_schema_fn {
{
col_schema.type = Type::INT64;
col_schema.stats_dtype = statistics_dtype::dtype_int64;
col_schema.logical_type = LogicalType{TimeType{false, TimeUnit::NANOS}};
col_schema.logical_type = LogicalType{TimeType{TimeUnit::NANOS}};
}

template <typename T>
Expand Down
Loading