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

feat: collapsible columns supports variable length type #241

Merged
merged 3 commits into from
Sep 19, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
32 changes: 13 additions & 19 deletions analytic_engine/src/sst/parquet/encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,16 +161,6 @@ pub enum Error {
type_name: String,
backtrace: Backtrace,
},

#[snafu(display(
"Hybrid format doesn't support variable length type, type:{}.\nBacktrace:\n{}",
type_name,
backtrace
))]
VariableLengthType {
type_name: String,
backtrace: Backtrace,
},
}

define_result!(Error);
Expand Down Expand Up @@ -355,14 +345,6 @@ impl HybridRecordEncoder {
}

if schema.is_collapsible_column(idx) {
// TODO: support variable length type
ensure!(
col.data_type.size().is_some(),
VariableLengthType {
chunshao90 marked this conversation as resolved.
Show resolved Hide resolved
type_name: col.data_type.to_string(),
}
);

collapsible_col_types.push(IndexedType {
idx,
data_type: schema.column(idx).data_type,
Expand Down Expand Up @@ -788,6 +770,12 @@ mod tests {
.unwrap(),
)
.unwrap()
.add_normal_column(
column_schema::Builder::new("string_value".to_string(), DatumKind::String)
.build()
.unwrap(),
)
.unwrap()
.build()
.unwrap()
}
Expand Down Expand Up @@ -882,7 +870,7 @@ mod tests {
}

#[test]
fn encode_hybrid_record_and_decode_back() {
fn hybrid_record_encode_and_decode() {
let write_props = WriterProperties::builder().build();
let schema = build_schema();
let mut encoder = HybridRecordEncoder::try_new(write_props, &schema).unwrap();
Expand All @@ -903,6 +891,12 @@ mod tests {
Some("region2"),
]),
int32_array(vec![Some(1), Some(2), Some(11), Some(12)]),
string_array(vec![
Some("string_value1"),
Some("string_value2"),
Some("string_value3"),
Some("string_value4"),
]),
];

let input_record_batch =
Expand Down
Loading