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

use TableProperties for CDF check #536

Merged
merged 2 commits into from
Nov 25, 2024
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
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
Loading