This is an automated email from the ASF dual-hosted git repository.

blue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-iceberg.git


The following commit(s) were added to refs/heads/master by this push:
     new b179990  Add forTable method for Avro WriteBuilder (#322)
b179990 is described below

commit b1799908e86e03903379b8505d8a444752a0d64d
Author: Arina Ielchiieva <[email protected]>
AuthorDate: Thu Aug 1 01:02:01 2019 +0300

    Add forTable method for Avro WriteBuilder (#322)
---
 core/src/main/java/org/apache/iceberg/avro/Avro.java | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/core/src/main/java/org/apache/iceberg/avro/Avro.java 
b/core/src/main/java/org/apache/iceberg/avro/Avro.java
index 720baec..1276e23 100644
--- a/core/src/main/java/org/apache/iceberg/avro/Avro.java
+++ b/core/src/main/java/org/apache/iceberg/avro/Avro.java
@@ -34,6 +34,7 @@ import org.apache.avro.io.DatumReader;
 import org.apache.avro.io.DatumWriter;
 import org.apache.avro.specific.SpecificData;
 import org.apache.iceberg.SchemaParser;
+import org.apache.iceberg.Table;
 import org.apache.iceberg.io.FileAppender;
 import org.apache.iceberg.io.InputFile;
 import org.apache.iceberg.io.OutputFile;
@@ -90,6 +91,12 @@ public class Avro {
       this.file = file;
     }
 
+    public WriteBuilder forTable(Table table) {
+      schema(table.schema());
+      setAll(table.properties());
+      return this;
+    }
+
     public WriteBuilder schema(org.apache.iceberg.Schema newSchema) {
       this.schema = newSchema;
       return this;

Reply via email to