You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2020/12/15 19:56:40 UTC

[GitHub] [iceberg] karuppayya commented on a change in pull request #1932: Refactor Spark schema evolution tests

karuppayya commented on a change in pull request #1932:
URL: https://github.com/apache/iceberg/pull/1932#discussion_r543644843



##########
File path: spark2/src/test/java/org/apache/iceberg/examples/SchemaEvolutionTest.java
##########
@@ -84,29 +98,56 @@ public void before() throws IOException {
 
   @Test
   public void addColumnToSchema() {
-    table.updateSchema().addColumn("publisher", Types.StringType.get()).commit();
 
-    Dataset<Row> df2 = spark.read().json(dataLocation + "new-books.json");
+    String fieldName = "publisher";
+    Schema schema = table.schema();
+    Assert.assertNull(schema.findField(fieldName));
+
+    table.updateSchema().addColumn(fieldName, Types.StringType.get()).commit();
+
+    Dataset<Row> df1 = spark.read()
+        .json(dataLocation + "books.json");
+    df1 = df1.withColumn(fieldName, new Column(Literal$.MODULE$.apply(null)))
+        .selectExpr("title", "price", "author", "cast(published as timestamp)", "genre", "publisher");

Review comment:
       @rdblue Thanks for inputs, I have removed the correctness related changes.




----------------------------------------------------------------
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.

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



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