Skip to content

Commit 3c7abf7

Browse files
Add clarifying comments
1 parent a6eb6cf commit 3c7abf7

File tree

1 file changed

+12
-1
lines changed
  • kernel/src/table_changes/log_replay

1 file changed

+12
-1
lines changed

kernel/src/table_changes/log_replay/tests.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,8 @@ async fn incompatible_schemas_fail() {
220220
}
221221
}
222222

223+
// Column `year` exists in commit schema, but not in the read schema.
224+
//
223225
// The CDF schema has fields: `id: int` and `value: string`.
224226
// This commit has schema with fields: `id: int`, `value: string` and `year: int` (nullable).
225227
let schema = StructType::new([
@@ -229,6 +231,8 @@ async fn incompatible_schemas_fail() {
229231
]);
230232
assert_schema_check(schema, get_schema(), false).await;
231233

234+
// Commit schema's `id` column has wider type than in the read schema.
235+
//
232236
// The CDF schema has fields: `id: int` and `value: string`.
233237
// This commit has schema with fields: `id: long` and `value: string`.
234238
let schema = StructType::new([
@@ -237,6 +241,7 @@ async fn incompatible_schemas_fail() {
237241
]);
238242
assert_schema_check(schema, get_schema(), false).await;
239243

244+
// Commit schema's `id` column is narrower than in the read schema.
240245
// NOTE: Once type widening is supported, this should not return an error.
241246
//
242247
// The CDF schema has fields: `id: long` and `value: string`.
@@ -251,14 +256,18 @@ async fn incompatible_schemas_fail() {
251256
]);
252257
assert_schema_check(commit_schema, cdf_schema, false).await;
253258

259+
// Commit schema's `id` column has an incompatible type with the read schema's.
260+
//
254261
// 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`.
256263
let schema = StructType::new([
257264
StructField::new("id", DataType::STRING, true),
258265
StructField::new("value", DataType::STRING, true),
259266
]);
260267
assert_schema_check(schema, get_schema(), false).await;
261268

269+
// Commit schema's `id` column is non-nullable, but is nullable in the read schema.
270+
//
262271
// The CDF schema has fields: nullable `id` and nullable `value`.
263272
// This commit has schema with fields: non-nullable `id` and nullable `value`.
264273
let schema = StructType::new([
@@ -267,6 +276,8 @@ async fn incompatible_schemas_fail() {
267276
]);
268277
assert_schema_check(schema, get_schema(), true).await;
269278

279+
// Commit schema is missing a nullable `value` column that's found in the read schema.
280+
//
270281
// The CDF schema has fields: `id` (nullable) and `value` (nullable).
271282
// This commit has schema with fields: `id` (nullable).
272283
let schema = get_schema().project_as_struct(&["id"]).unwrap();

0 commit comments

Comments
 (0)