public static StructType convert(Schema schema) {
    return (StructType) TypeUtil.visit(schema, new TypeToSparkType());
  }
@Test
  public void testSchemaConversionWithMetaDataColumnSchema() {
    StructType structType = SparkSchemaUtil.convert(TEST_SCHEMA_WITH_METADATA_COLS);
    List<AttributeReference> attrRefs =
        scala.collection.JavaConverters.seqAsJavaList(structType.toAttributes());
    for (AttributeReference attrRef : attrRefs) {
      if (MetadataColumns.isMetadataColumn(attrRef.name())) {
        Assert.assertTrue(
            "metadata columns should have __metadata_col in attribute metadata",
            MetadataAttribute.unapply(attrRef).isDefined());
      } else {
        Assert.assertFalse(
            "non metadata columns should not have __metadata_col in attribute metadata",
            MetadataAttribute.unapply(attrRef).isDefined());
      }
    }
  }