Java 从unionavro中提取模式

Java 从unionavro中提取模式,java,hadoop,avro,Java,Hadoop,Avro,我有以下工会: { "name" : "price", "type" : [ "null", { "type" : "array", "items" : { "type" : "record", "name" : "PriceType", "fields" : [ { "name" : "tex

我有以下工会:

{
          "name" : "price",
          "type" : [ "null", {
            "type" : "array",
            "items" : {
              "type" : "record",
              "name" : "PriceType",
              "fields" : [ {
                "name" : "text_value",
                "type" : [ "null", "double" ],
                "source" : "element text_value"
              }, {
                "name" : "currency",
                "type" : [ "null", "string" ],
                "default" : null,
                "source" : "attribute currency"
              } ]
            }
          } ],
          "default" : null,
          "source" : "element price"
        }
从这个联合体中,我使用以下代码获得price字段的模式:

Schema new_schema=schema.getField("price").schema();
现在我想获得联合体的模式:

{
            "type" : "array",
            "items" : {
              "type" : "record",
              "name" : "PriceType",
              "fields" : [ {
                "name" : "text_value",
                "type" : [ "null", "double" ],
                "source" : "element text_value"
              }, {
                "name" : "currency",
                "type" : [ "null", "string" ],
                "default" : null,
                "source" : "attribute currency"
              }
我该怎么做?我该如何在记录中插入一个并集