Skip to content

Commit

Permalink
use TableProperties for CDF check (#536)
Browse files Browse the repository at this point in the history
## What changes are proposed in this pull request?
use `TableProperties` for CDF enablement check in `TableChanges`. some
minor nits/cleanup in table properties


## How was this change tested?
existing UT
  • Loading branch information
zachschuermann authored Nov 25, 2024
1 parent d2bb3b1 commit f1f8a82
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
8 changes: 3 additions & 5 deletions kernel/src/table_changes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,10 @@ impl TableChanges {
// Verify CDF is enabled at the beginning and end of the interval to fail early. We must
// still check that CDF is enabled for every metadata action in the CDF range.
let is_cdf_enabled = |snapshot: &Snapshot| {
static ENABLE_CDF_FLAG: &str = "delta.enableChangeDataFeed";
snapshot
.metadata()
.configuration
.get(ENABLE_CDF_FLAG)
.is_some_and(|val| val == "true")
.table_properties()
.enable_change_data_feed
.unwrap_or(false)
};
if !is_cdf_enabled(&start_snapshot) {
return Err(Error::change_data_feed_unsupported(start_version));
Expand Down
15 changes: 1 addition & 14 deletions kernel/src/table_properties/deserialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ pub(crate) fn parse_bool(s: &str) -> Option<bool> {
/// `Some` if successfully parses, and `None` otherwise.
pub(crate) fn parse_column_names(s: &str) -> Option<Vec<ColumnName>> {
ColumnName::parse_column_name_list(s)
.map_err(|e| warn!("column name list failed to parse: {e}"))
.inspect_err(|e| warn!("column name list failed to parse: {e}"))
.ok()
}

Expand Down Expand Up @@ -190,19 +190,6 @@ fn parse_interval_impl(value: &str) -> Result<Duration, ParseIntervalError> {
#[cfg(test)]
mod tests {
use super::*;
use crate::expressions::column_name;

#[test]
fn test_parse_column_names() {
assert_eq!(
parse_column_names("`col 1`, col.a2,col3").unwrap(),
vec![
ColumnName::new(["col 1"]),
column_name!("col.a2"),
column_name!("col3")
]
);
}

#[test]
fn test_parse_bool() {
Expand Down

0 comments on commit f1f8a82

Please sign in to comment.