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

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


The following commit(s) were added to refs/heads/master by this push:
     new 0626f96  Spark: Fix the typo in the list method of 
DescribeSchemaVisitor in Spark3Util. (#2568)
0626f96 is described below

commit 0626f964c5ba27a48792439fa513dc2ab09300cb
Author: jun-he <[email protected]>
AuthorDate: Mon May 10 08:29:18 2021 -0700

    Spark: Fix the typo in the list method of DescribeSchemaVisitor in 
Spark3Util. (#2568)
    
    Closes #2526
---
 .../src/main/java/org/apache/iceberg/spark/Spark3Util.java |  2 +-
 .../test/java/org/apache/iceberg/spark/TestSpark3Util.java | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/spark3/src/main/java/org/apache/iceberg/spark/Spark3Util.java 
b/spark3/src/main/java/org/apache/iceberg/spark/Spark3Util.java
index 8dce479..3f87a79 100644
--- a/spark3/src/main/java/org/apache/iceberg/spark/Spark3Util.java
+++ b/spark3/src/main/java/org/apache/iceberg/spark/Spark3Util.java
@@ -579,7 +579,7 @@ public class Spark3Util {
 
     @Override
     public String list(Types.ListType list, String elementResult) {
-      return "map<" + elementResult + ">";
+      return "list<" + elementResult + ">";
     }
 
     @Override
diff --git a/spark3/src/test/java/org/apache/iceberg/spark/TestSpark3Util.java 
b/spark3/src/test/java/org/apache/iceberg/spark/TestSpark3Util.java
index 472244d..a14378b 100644
--- a/spark3/src/test/java/org/apache/iceberg/spark/TestSpark3Util.java
+++ b/spark3/src/test/java/org/apache/iceberg/spark/TestSpark3Util.java
@@ -28,6 +28,7 @@ import org.junit.Test;
 
 import static org.apache.iceberg.NullOrder.NULLS_FIRST;
 import static org.apache.iceberg.NullOrder.NULLS_LAST;
+import static org.apache.iceberg.types.Types.NestedField.optional;
 import static org.apache.iceberg.types.Types.NestedField.required;
 
 public class TestSpark3Util {
@@ -64,6 +65,19 @@ public class TestSpark3Util {
             Spark3Util.describe(multiOrder));
   }
 
+  @Test
+  public void testDescribeSchema() {
+    Schema schema = new Schema(
+        required(1, "data", Types.ListType.ofRequired(2, 
Types.StringType.get())),
+        optional(3, "pairs", Types.MapType.ofOptional(4, 5, 
Types.StringType.get(), Types.LongType.get())),
+        required(6, "time", Types.TimestampType.withoutZone())
+    );
+
+    Assert.assertEquals("Schema description isn't correct.",
+        "struct<data: list<string> not null,pairs: map<string, bigint>,time: 
timestamp not null>",
+        Spark3Util.describe(schema));
+  }
+
   private SortOrder buildSortOrder(String transform, Schema schema, int 
sourceId) {
     String jsonString = "{\n" +
             "  \"order-id\" : 10,\n" +

Reply via email to