@@ -185,6 +185,8 @@ async fn column_mapping_should_fail() {
185
185
// Note: This should be removed once type widening support is added for CDF
186
186
#[ tokio:: test]
187
187
async fn incompatible_schemas_fail ( ) {
188
+ const PASSES : bool = true ;
189
+ const FAILS : bool = false ;
188
190
async fn assert_schema_check ( commit_schema : StructType , cdf_schema : StructType , passes : bool ) {
189
191
let engine = Arc :: new ( SyncEngine :: new ( ) ) ;
190
192
let mut mock_table = LocalMockTable :: new ( ) ;
@@ -229,7 +231,7 @@ async fn incompatible_schemas_fail() {
229
231
StructField :: nullable ( "value" , DataType :: STRING ) ,
230
232
StructField :: nullable ( "year" , DataType :: INTEGER ) ,
231
233
] ) ;
232
- assert_schema_check ( schema, get_schema ( ) , false ) . await ;
234
+ assert_schema_check ( schema, get_schema ( ) , FAILS ) . await ;
233
235
234
236
// Commit schema's `id` column has wider type than in the read schema.
235
237
//
@@ -239,7 +241,7 @@ async fn incompatible_schemas_fail() {
239
241
StructField :: nullable ( "id" , DataType :: LONG ) ,
240
242
StructField :: nullable ( "value" , DataType :: STRING ) ,
241
243
] ) ;
242
- assert_schema_check ( schema, get_schema ( ) , false ) . await ;
244
+ assert_schema_check ( schema, get_schema ( ) , FAILS ) . await ;
243
245
244
246
// Commit schema's `id` column is narrower than in the read schema.
245
247
// NOTE: Once type widening is supported, this should not return an error.
@@ -254,7 +256,7 @@ async fn incompatible_schemas_fail() {
254
256
StructField :: nullable ( "id" , DataType :: INTEGER ) ,
255
257
StructField :: nullable ( "value" , DataType :: STRING ) ,
256
258
] ) ;
257
- assert_schema_check ( commit_schema, cdf_schema, false ) . await ;
259
+ assert_schema_check ( commit_schema, cdf_schema, FAILS ) . await ;
258
260
259
261
// Commit schema's `id` column has an incompatible type with the read schema's.
260
262
//
@@ -264,7 +266,7 @@ async fn incompatible_schemas_fail() {
264
266
StructField :: nullable ( "id" , DataType :: STRING ) ,
265
267
StructField :: nullable ( "value" , DataType :: STRING ) ,
266
268
] ) ;
267
- assert_schema_check ( schema, get_schema ( ) , false ) . await ;
269
+ assert_schema_check ( schema, get_schema ( ) , FAILS ) . await ;
268
270
269
271
// Commit schema's `id` column is non-nullable, but is nullable in the read schema.
270
272
//
@@ -274,14 +276,14 @@ async fn incompatible_schemas_fail() {
274
276
StructField :: new ( "id" , DataType :: INTEGER , false ) ,
275
277
StructField :: new ( "value" , DataType :: STRING , true ) ,
276
278
] ) ;
277
- assert_schema_check ( schema, get_schema ( ) , true ) . await ;
279
+ assert_schema_check ( schema, get_schema ( ) , PASSES ) . await ;
278
280
279
281
// Commit schema is missing a nullable `value` column that's found in the read schema.
280
282
//
281
283
// The CDF schema has fields: `id` (nullable) and `value` (nullable).
282
284
// This commit has schema with fields: `id` (nullable).
283
285
let schema = get_schema ( ) . project_as_struct ( & [ "id" ] ) . unwrap ( ) ;
284
- assert_schema_check ( schema, get_schema ( ) , true ) . await ;
286
+ assert_schema_check ( schema, get_schema ( ) , PASSES ) . await ;
285
287
}
286
288
287
289
#[ tokio:: test]
0 commit comments