nastra commented on code in PR #12418:
URL: https://github.com/apache/iceberg/pull/12418#discussion_r2013467120


##########
spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestCreateChangelogViewProcedure.java:
##########
@@ -95,6 +103,49 @@ public void testCustomizedViewName() {
     Assert.assertEquals(2, rowCount);
   }
 
+  @TestTemplate
+  public void testNonStandardColumnNames() {
+    createTableWithTwoNonStandardColumns();
+    sql("INSERT INTO %s VALUES (1, 'a')", tableName);
+    sql("INSERT INTO %s VALUES (2, 'b')", tableName);
+
+    Table table = validationCatalog.loadTable(tableIdent);
+
+    Snapshot snap1 = table.currentSnapshot();
+
+    sql("INSERT OVERWRITE %s VALUES (-2, 'b')", tableName);
+
+    table.refresh();
+
+    Snapshot snap2 = table.currentSnapshot();
+
+    sql(
+            "CALL %s.system.create_changelog_view("
+                    + "table => '%s',"
+                    + "options => map('%s','%s','%s','%s'),"
+                    + "changelog_view => '%s')",
+            catalogName,
+            tableName,
+            SparkReadOptions.START_SNAPSHOT_ID,
+            snap1.snapshotId(),
+            SparkReadOptions.END_SNAPSHOT_ID,
+            snap2.snapshotId(),
+            "cdc_view");
+
+    final var df = spark.sql("select * from cdc_view");
+    final var fieldNames = 
Arrays.stream(df.schema().fields()).map(StructField::name).collect(Collectors.toList());
+    assertThat(fieldNames).containsExactly(
+            "the id",
+            "the.data",
+            "_change_type",
+            "_change_ordinal",
+            "_commit_snapshot_id"
+    );
+
+    final var rows = df.collectAsList();
+    assertThat(rows).hasSize(2);

Review Comment:
   can be inlined to have `assertThat(df.collectAsList()).hasSize(2);`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to