You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"First value of column 'a' should be either 'Apache' or 'Iceberg'"
1965
+
);
1966
+
}
1967
+
1968
+
#[test]
1969
+
fntest_invalid_incremental_scan_configurations(){
1970
+
let table = TableTestFixture::new().table;
1971
+
1972
+
// Test case 1: to_snapshot_id is required for incremental scan
1973
+
let result = table
1974
+
.scan()
1975
+
.from_snapshot_id(1234)// Only providing from_snapshot_id
1976
+
.build();
1977
+
1978
+
assert!(
1979
+
result.is_err(),
1980
+
"Should fail when to_snapshot_id is not set"
1981
+
);
1982
+
assert_eq!(
1983
+
result.unwrap_err().to_string(),
1984
+
"DataInvalid => Incremental scan requires to_snapshot_id to be set. Use from_snapshot_id (exclusive) and to_snapshot_id (inclusive) to specify the range.",
1985
+
"Should have correct error message for missing to_snapshot_id"
1986
+
);
1987
+
1988
+
// Test case 2: snapshot_id should not be set with incremental scan
1989
+
let result = table
1990
+
.scan()
1991
+
.snapshot_id(1234)
1992
+
.from_snapshot_id(1234)
1993
+
.to_snapshot_id(5678)
1994
+
.build();
1995
+
1996
+
assert!(
1997
+
result.is_err(),
1998
+
"Should fail when snapshot_id is set with incremental scan"
1999
+
);
2000
+
assert_eq!(
2001
+
result.unwrap_err().to_string(),
2002
+
"DataInvalid => snapshot_id should not be set for incremental scan. Use from_snapshot_id and to_snapshot_id instead.",
2003
+
"Should have correct error message for setting both snapshot_id and incremental scan parameters"
2004
+
);
2005
+
}
2006
+
2007
+
#[test]
2008
+
fntest_incremental_scan_edge_cases(){
2009
+
let fixture = TableTestFixture::new();
2010
+
let table = &fixture.table;
2011
+
2012
+
// Test case 1: Non-existent to_snapshot_id
2013
+
let result = table
2014
+
.scan()
2015
+
.to_snapshot_id(999999)// Non-existent snapshot ID
2016
+
.build();
2017
+
2018
+
assert!(
2019
+
result.is_err(),
2020
+
"Should fail when to_snapshot_id does not exist"
2021
+
);
2022
+
assert_eq!(
2023
+
result.unwrap_err().to_string(),
2024
+
"DataInvalid => to_snapshot_id 999999 not found",
2025
+
"Should have correct error message for non-existent to_snapshot_id"
2026
+
);
2027
+
2028
+
// Test case 2: Non-existent from_snapshot_id
2029
+
let result = table
2030
+
.scan()
2031
+
.from_snapshot_id(999998)// Non-existent snapshot ID
2032
+
.to_snapshot_id(999999)// Non-existent snapshot ID
2033
+
.build();
2034
+
2035
+
assert!(
2036
+
result.is_err(),
2037
+
"Should fail when to_snapshot_id does not exist"
2038
+
);
2039
+
// This should fail on to_snapshot_id first since that's checked first
2040
+
assert_eq!(
2041
+
result.unwrap_err().to_string(),
2042
+
"DataInvalid => to_snapshot_id 999999 not found",
2043
+
"Should fail on to_snapshot_id check first"
2044
+
);
2045
+
2046
+
// We need to set up snapshots for the remaining tests
2047
+
let snapshots = table.metadata().snapshots().collect::<Vec<_>>();
2048
+
if snapshots.len() >= 2{
2049
+
let first_snapshot_id = snapshots[0].snapshot_id();
2050
+
let second_snapshot_id = snapshots[1].snapshot_id();
2051
+
2052
+
// Test case 3: from_snapshot_id doesn't exist but to_snapshot_id does
2053
+
let result = table
2054
+
.scan()
2055
+
.from_snapshot_id(999998)// Non-existent
2056
+
.to_snapshot_id(second_snapshot_id)// Existent
2057
+
.build();
2058
+
2059
+
assert!(
2060
+
result.is_err(),
2061
+
"Should fail when from_snapshot_id does not exist"
2062
+
);
2063
+
assert_eq!(
2064
+
result.unwrap_err().to_string(),
2065
+
"DataInvalid => from_snapshot_id 999998 not found",
2066
+
"Should have correct error message for non-existent from_snapshot_id"
2067
+
);
2068
+
2069
+
// Determine which snapshot is newer based on snapshot IDs
2070
+
let(older_snapshot_id, newer_snapshot_id) = if first_snapshot_id < second_snapshot_id {
2071
+
(first_snapshot_id, second_snapshot_id)
2072
+
}else{
2073
+
(second_snapshot_id, first_snapshot_id)
2074
+
};
2075
+
2076
+
// Test case 4: Reversed snapshot order (to_snapshot_id <= from_snapshot_id)
2077
+
let result = table
2078
+
.scan()
2079
+
.from_snapshot_id(newer_snapshot_id)// Later snapshot
0 commit comments