chenjunjiedada commented on a change in pull request #830: URL: https://github.com/apache/incubator-iceberg/pull/830#discussion_r429517712
########## File path: spark/src/test/java/org/apache/iceberg/spark/source/TestSparkTableUtil.java ########## @@ -199,4 +204,41 @@ public void testImportAsHiveTable() throws Exception { long count2 = spark.read().format("iceberg").load(DB_NAME + ".test_partitioned_table").count(); Assert.assertEquals("three values ", 3, count2); } + + @Test + public void testImportWithIncompatibleSchema() throws Exception { + spark.table(qualifiedTableName).write().mode("overwrite").format("parquet") + .saveAsTable("original_table"); + + // The field is different so that it will project with name mapping + Schema filteredSchema = new Schema( + optional(1, "data", Types.StringType.get()) + ); + + TableIdentifier source = new TableIdentifier("original_table"); + Table table = catalog.createTable( + org.apache.iceberg.catalog.TableIdentifier.of(DB_NAME, "target_table"), + filteredSchema, + SparkSchemaUtil.specForTable(spark, "original_table")); + File stagingDir = temp.newFolder("staging-dir"); + SparkTableUtil.importSparkTable(spark, source, table, stagingDir.toString()); Review comment: OK, I updated this. ---------------------------------------------------------------- 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: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org