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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]