@@ -220,6 +220,8 @@ async fn incompatible_schemas_fail() {
220
220
}
221
221
}
222
222
223
+ // Column `year` exists in commit schema, but not in the read schema.
224
+ //
223
225
// The CDF schema has fields: `id: int` and `value: string`.
224
226
// This commit has schema with fields: `id: int`, `value: string` and `year: int` (nullable).
225
227
let schema = StructType :: new ( [
@@ -229,6 +231,8 @@ async fn incompatible_schemas_fail() {
229
231
] ) ;
230
232
assert_schema_check ( schema, get_schema ( ) , false ) . await ;
231
233
234
+ // Commit schema's `id` column has wider type than in the read schema.
235
+ //
232
236
// The CDF schema has fields: `id: int` and `value: string`.
233
237
// This commit has schema with fields: `id: long` and `value: string`.
234
238
let schema = StructType :: new ( [
@@ -237,6 +241,7 @@ async fn incompatible_schemas_fail() {
237
241
] ) ;
238
242
assert_schema_check ( schema, get_schema ( ) , false ) . await ;
239
243
244
+ // Commit schema's `id` column is narrower than in the read schema.
240
245
// NOTE: Once type widening is supported, this should not return an error.
241
246
//
242
247
// The CDF schema has fields: `id: long` and `value: string`.
@@ -251,14 +256,18 @@ async fn incompatible_schemas_fail() {
251
256
] ) ;
252
257
assert_schema_check ( commit_schema, cdf_schema, false ) . await ;
253
258
259
+ // Commit schema's `id` column has an incompatible type with the read schema's.
260
+ //
254
261
// The CDF schema has fields: `id: int` and `value: string`.
255
- // This commit has schema with fields:`id: string` and `value: string`.
262
+ // This commit has schema with fields: `id: string` and `value: string`.
256
263
let schema = StructType :: new ( [
257
264
StructField :: new ( "id" , DataType :: STRING , true ) ,
258
265
StructField :: new ( "value" , DataType :: STRING , true ) ,
259
266
] ) ;
260
267
assert_schema_check ( schema, get_schema ( ) , false ) . await ;
261
268
269
+ // Commit schema's `id` column is non-nullable, but is nullable in the read schema.
270
+ //
262
271
// The CDF schema has fields: nullable `id` and nullable `value`.
263
272
// This commit has schema with fields: non-nullable `id` and nullable `value`.
264
273
let schema = StructType :: new ( [
@@ -267,6 +276,8 @@ async fn incompatible_schemas_fail() {
267
276
] ) ;
268
277
assert_schema_check ( schema, get_schema ( ) , true ) . await ;
269
278
279
+ // Commit schema is missing a nullable `value` column that's found in the read schema.
280
+ //
270
281
// The CDF schema has fields: `id` (nullable) and `value` (nullable).
271
282
// This commit has schema with fields: `id` (nullable).
272
283
let schema = get_schema ( ) . project_as_struct ( & [ "id" ] ) . unwrap ( ) ;
0 commit comments