Github user ueshin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18655#discussion_r129488362
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/execution/arrow/ArrowConvertersSuite.scala
 ---
    @@ -857,6 +857,449 @@ class ArrowConvertersSuite extends SharedSQLContext 
with BeforeAndAfterAll {
         collectAndValidate(df, json, "nanData-floating_point.json")
       }
     
    +  test("array type conversion") {
    +    val json =
    +      s"""
    +         |{
    +         |  "schema" : {
    +         |    "fields" : [ {
    +         |      "name" : "a_arr",
    +         |      "nullable" : true,
    +         |      "type" : {
    +         |        "name" : "list"
    +         |      },
    +         |      "children" : [ {
    +         |        "name" : "element",
    +         |        "nullable" : false,
    +         |        "type" : {
    +         |          "name" : "int",
    +         |          "bitWidth" : 32,
    +         |          "isSigned" : true
    +         |        },
    +         |        "children" : [ ],
    +         |        "typeLayout" : {
    +         |          "vectors" : [ {
    +         |            "type" : "VALIDITY",
    +         |            "typeBitWidth" : 1
    +         |          }, {
    +         |            "type" : "DATA",
    +         |            "typeBitWidth" : 32
    +         |          } ]
    +         |        }
    +         |      } ],
    +         |      "typeLayout" : {
    +         |        "vectors" : [ {
    +         |          "type" : "VALIDITY",
    +         |          "typeBitWidth" : 1
    +         |        }, {
    +         |          "type" : "OFFSET",
    +         |          "typeBitWidth" : 32
    +         |        } ]
    +         |      }
    +         |    }, {
    +         |      "name" : "b_arr",
    +         |      "nullable" : true,
    +         |      "type" : {
    +         |        "name" : "list"
    +         |      },
    +         |      "children" : [ {
    +         |        "name" : "element",
    +         |        "nullable" : false,
    +         |        "type" : {
    +         |          "name" : "int",
    +         |          "bitWidth" : 32,
    +         |          "isSigned" : true
    +         |        },
    +         |        "children" : [ ],
    +         |        "typeLayout" : {
    +         |          "vectors" : [ {
    +         |            "type" : "VALIDITY",
    +         |            "typeBitWidth" : 1
    +         |          }, {
    +         |            "type" : "DATA",
    +         |            "typeBitWidth" : 32
    +         |          } ]
    +         |        }
    +         |      } ],
    +         |      "typeLayout" : {
    +         |        "vectors" : [ {
    +         |          "type" : "VALIDITY",
    +         |          "typeBitWidth" : 1
    +         |        }, {
    +         |          "type" : "OFFSET",
    +         |          "typeBitWidth" : 32
    +         |        } ]
    +         |      }
    +         |    }, {
    +         |      "name" : "c_arr",
    +         |      "nullable" : true,
    +         |      "type" : {
    +         |        "name" : "list"
    +         |      },
    +         |      "children" : [ {
    +         |        "name" : "element",
    +         |        "nullable" : true,
    +         |        "type" : {
    +         |          "name" : "int",
    +         |          "bitWidth" : 32,
    +         |          "isSigned" : true
    +         |        },
    +         |        "children" : [ ],
    +         |        "typeLayout" : {
    +         |          "vectors" : [ {
    +         |            "type" : "VALIDITY",
    +         |            "typeBitWidth" : 1
    +         |          }, {
    +         |            "type" : "DATA",
    +         |            "typeBitWidth" : 32
    +         |          } ]
    +         |        }
    +         |      } ],
    +         |      "typeLayout" : {
    +         |        "vectors" : [ {
    +         |          "type" : "VALIDITY",
    +         |          "typeBitWidth" : 1
    +         |        }, {
    +         |          "type" : "OFFSET",
    +         |          "typeBitWidth" : 32
    +         |        } ]
    +         |      }
    +         |    }, {
    +         |      "name" : "d_arr",
    +         |      "nullable" : true,
    +         |      "type" : {
    +         |        "name" : "list"
    +         |      },
    +         |      "children" : [ {
    +         |        "name" : "element",
    +         |        "nullable" : true,
    +         |        "type" : {
    +         |          "name" : "list"
    +         |        },
    +         |        "children" : [ {
    +         |          "name" : "element",
    +         |          "nullable" : false,
    +         |          "type" : {
    +         |            "name" : "int",
    +         |            "bitWidth" : 32,
    +         |            "isSigned" : true
    +         |          },
    +         |          "children" : [ ],
    +         |          "typeLayout" : {
    +         |            "vectors" : [ {
    +         |              "type" : "VALIDITY",
    +         |              "typeBitWidth" : 1
    +         |            }, {
    +         |              "type" : "DATA",
    +         |              "typeBitWidth" : 32
    +         |            } ]
    +         |          }
    +         |        } ],
    +         |        "typeLayout" : {
    +         |          "vectors" : [ {
    +         |            "type" : "VALIDITY",
    +         |            "typeBitWidth" : 1
    +         |          }, {
    +         |            "type" : "OFFSET",
    +         |            "typeBitWidth" : 32
    +         |          } ]
    +         |        }
    +         |      } ],
    +         |      "typeLayout" : {
    +         |        "vectors" : [ {
    +         |          "type" : "VALIDITY",
    +         |          "typeBitWidth" : 1
    +         |        }, {
    +         |          "type" : "OFFSET",
    +         |          "typeBitWidth" : 32
    +         |        } ]
    +         |      }
    +         |    } ]
    +         |  },
    +         |  "batches" : [ {
    +         |    "count" : 4,
    +         |    "columns" : [ {
    +         |      "name" : "a_arr",
    +         |      "count" : 4,
    +         |      "VALIDITY" : [ 1, 1, 1, 1 ],
    +         |      "OFFSET" : [ 0, 2, 4, 4, 5 ],
    +         |      "children" : [ {
    +         |        "name" : "element",
    +         |        "count" : 5,
    +         |        "VALIDITY" : [ 1, 1, 1, 1, 1 ],
    +         |        "DATA" : [ 1, 2, 3, 4, 5 ]
    +         |      } ]
    +         |    }, {
    +         |      "name" : "b_arr",
    +         |      "count" : 4,
    +         |      "VALIDITY" : [ 1, 0, 1, 0 ],
    +         |      "OFFSET" : [ 0, 2, 2, 2, 2 ],
    +         |      "children" : [ {
    +         |        "name" : "element",
    +         |        "count" : 2,
    +         |        "VALIDITY" : [ 1, 1 ],
    +         |        "DATA" : [ 1, 2 ]
    +         |      } ]
    +         |    }, {
    +         |      "name" : "c_arr",
    +         |      "count" : 4,
    +         |      "VALIDITY" : [ 1, 1, 1, 1 ],
    +         |      "OFFSET" : [ 0, 2, 4, 4, 5 ],
    +         |      "children" : [ {
    +         |        "name" : "element",
    +         |        "count" : 5,
    +         |        "VALIDITY" : [ 1, 1, 1, 0, 1 ],
    +         |        "DATA" : [ 1, 2, 3, 0, 5 ]
    +         |      } ]
    +         |    }, {
    +         |      "name" : "d_arr",
    +         |      "count" : 4,
    +         |      "VALIDITY" : [ 1, 1, 1, 1 ],
    +         |      "OFFSET" : [ 0, 1, 3, 3, 4 ],
    +         |      "children" : [ {
    +         |        "name" : "element",
    +         |        "count" : 4,
    +         |        "VALIDITY" : [ 1, 1, 1, 1 ],
    +         |        "OFFSET" : [ 0, 2, 3, 3, 4 ],
    +         |        "children" : [ {
    +         |          "name" : "element",
    +         |          "count" : 4,
    +         |          "VALIDITY" : [ 1, 1, 1, 1 ],
    +         |          "DATA" : [ 1, 2, 3, 5 ]
    +         |        } ]
    +         |      } ]
    +         |    } ]
    +         |  } ]
    +         |}
    +       """.stripMargin
    +
    +    val a_arr = Seq(Seq(1, 2), Seq(3, 4), Seq(), Seq(5))
    +    val b_arr = Seq(Some(Seq(1, 2)), None, Some(Seq()), None)
    +    val c_arr = Seq(Seq(Some(1), Some(2)), Seq(Some(3), None), Seq(), 
Seq(Some(5)))
    +    val d_arr = Seq(Seq(Seq(1, 2)), Seq(Seq(3), Seq()), Seq(), Seq(Seq(5)))
    --- End diff --
    
    Thanks, I'll modify it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to