Skip to content

Commit f10d606

Browse files
author
Devdutt Shenoi
committed
Revert "update: remove time partition stream creation (#1227)"
This reverts commit 10aef7b.
1 parent 283aa21 commit f10d606

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/parseable/mod.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -557,17 +557,23 @@ impl Parseable {
557557
.await;
558558
}
559559

560-
if !time_partition.is_empty() || !time_partition_limit.is_empty() {
561-
return Err(StreamError::Custom {
562-
msg: "Creating stream with time partition is not supported anymore".to_string(),
563-
status: StatusCode::BAD_REQUEST,
564-
});
565-
}
560+
let time_partition_in_days = if !time_partition_limit.is_empty() {
561+
Some(validate_time_partition_limit(&time_partition_limit)?)
562+
} else {
563+
None
564+
};
566565

567566
if let Some(custom_partition) = &custom_partition {
568567
validate_custom_partition(custom_partition)?;
569568
}
570569

570+
if !time_partition.is_empty() && custom_partition.is_some() {
571+
return Err(StreamError::Custom {
572+
msg: "Cannot set both time partition and custom partition".to_string(),
573+
status: StatusCode::BAD_REQUEST,
574+
});
575+
}
576+
571577
let schema = validate_static_schema(
572578
body,
573579
stream_name,
@@ -579,7 +585,7 @@ impl Parseable {
579585
self.create_stream(
580586
stream_name.to_string(),
581587
&time_partition,
582-
None,
588+
time_partition_in_days,
583589
custom_partition.as_ref(),
584590
static_schema_flag,
585591
schema,

0 commit comments

Comments
 (0)