@@ -1622,6 +1622,7 @@ impl DeltaDataChecker {
16221622 break ;
16231623 }
16241624 }
1625+
16251626 let sql = format ! (
16261627 "SELECT {} FROM `{table_name}` WHERE NOT ({}) LIMIT 1" ,
16271628 field_to_select, expression
@@ -2419,58 +2420,6 @@ mod tests {
24192420 assert ! ( result. is_err( ) ) ;
24202421 }
24212422
2422- /// Ensure that constraints when there are spaces in the field name still work
2423- ///
2424- /// See <https://github.com/delta-io/delta-rs/pull/3374>
2425- #[ tokio:: test]
2426- async fn test_constraints_with_spacey_fields ( ) -> DeltaResult < ( ) > {
2427- let schema = Arc :: new ( Schema :: new ( vec ! [
2428- Field :: new( "a" , ArrowDataType :: Utf8 , false ) ,
2429- Field :: new( "b bop" , ArrowDataType :: Int32 , false ) ,
2430- ] ) ) ;
2431- let batch = RecordBatch :: try_new (
2432- Arc :: clone ( & schema) ,
2433- vec ! [
2434- Arc :: new( arrow:: array:: StringArray :: from( vec![
2435- "a" , "b bop" , "c" , "d" ,
2436- ] ) ) ,
2437- Arc :: new( arrow:: array:: Int32Array :: from( vec![ 1 , 10 , 10 , 100 ] ) ) ,
2438- ] ,
2439- ) ?;
2440-
2441- // Valid invariants return Ok(())
2442- let constraints = vec ! [
2443- Constraint :: new( "custom a" , "a is not null" ) ,
2444- Constraint :: new( "custom_b" , "b bop < 1000" ) ,
2445- ] ;
2446- assert ! ( DeltaDataChecker :: new_with_constraints( constraints)
2447- . check_batch( & batch)
2448- . await
2449- . is_ok( ) ) ;
2450-
2451- // Violated invariants returns an error with list of violations
2452- let constraints = vec ! [
2453- Constraint :: new( "custom_a" , "a is null" ) ,
2454- Constraint :: new( "custom_B" , "b bop < 100" ) ,
2455- ] ;
2456- let result = DeltaDataChecker :: new_with_constraints ( constraints)
2457- . check_batch ( & batch)
2458- . await ;
2459- assert ! ( result. is_err( ) ) ;
2460- assert ! ( matches!( result, Err ( DeltaTableError :: InvalidData { .. } ) ) ) ;
2461- if let Err ( DeltaTableError :: InvalidData { violations } ) = result {
2462- assert_eq ! ( violations. len( ) , 2 ) ;
2463- }
2464-
2465- // Irrelevant constraints return a different error
2466- let constraints = vec ! [ Constraint :: new( "custom_c" , "c > 2000" ) ] ;
2467- let result = DeltaDataChecker :: new_with_constraints ( constraints)
2468- . check_batch ( & batch)
2469- . await ;
2470- assert ! ( result. is_err( ) ) ;
2471- Ok ( ( ) )
2472- }
2473-
24742423 #[ test]
24752424 fn roundtrip_test_delta_exec_plan ( ) {
24762425 let ctx = SessionContext :: new ( ) ;
0 commit comments