@@ -0,0 +1,3060 @@
+/*%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage com.facebook.presto.parquet.writer;%0A%0Aimport com.facebook.presto.common.type.RowType;%0Aimport com.google.common.collect.ImmutableList;%0Aimport org.apache.parquet.schema.GroupType;%0Aimport org.apache.parquet.schema.PrimitiveType;%0Aimport org.apache.parquet.schema.Type;%0Aimport org.testng.annotations.Test;%0A%0Aimport static com.facebook.presto.common.type.BigintType.BIGINT;%0Aimport static com.facebook.presto.common.type.IntegerType.INTEGER;%0Aimport static com.facebook.presto.common.type.RowType.field;%0Aimport static com.facebook.presto.common.type.VarcharType.VARCHAR;%0Aimport static com.facebook.presto.tests.StructuralTestUtil.mapType;%0Aimport static java.util.Arrays.asList;%0Aimport static org.apache.parquet.schema.Type.Repetition.OPTIONAL;%0Aimport static org.apache.parquet.schema.Type.Repetition.REPEATED;%0Aimport static org.testng.Assert.assertEquals;%0A%0Apublic class TestParquetSchemaConverter%0A%7B%0A    @Test%0A    public void testMapKeyRepetitionLevel()%0A    %7B%0A        ParquetSchemaConverter schemaConverter = new ParquetSchemaConverter(%0A                ImmutableList.of(mapType(VARCHAR, INTEGER)),%0A                ImmutableList.of(%22test%22));%0A        GroupType mapType = schemaConverter.getMessageType().getType(0).asGroupType();%0A        GroupType keyValueValue = mapType.getType(0).asGroupType();%0A        assertEquals(keyValueValue.isRepetition(REPEATED), true);%0A        Type keyType = keyValueValue.getType(0).asPrimitiveType();%0A        assertEquals(keyType.isRepetition(OPTIONAL), true);%0A        PrimitiveType valueType = keyValueValue.getType(1).asPrimitiveType();%0A        assertEquals(valueType.isRepetition(OPTIONAL), true);%0A%0A        schemaConverter = new ParquetSchemaConverter(%0A                ImmutableList.of(mapType(RowType.from(asList(field(%22a%22, VARCHAR), field(%22b%22, BIGINT))), INTEGER)),%0A                ImmutableList.of(%22test%22));%0A        mapType = schemaConverter.getMessageType().getType(0).asGroupType();%0A        keyValueValue = mapType.getType(0).asGroupType();%0A        assertEquals(keyValueValue.isRepetition(REPEATED), true);%0A        keyType = keyValueValue.getType(0).asGroupType();%0A        assertEquals(keyType.isRepetition(OPTIONAL), true);%0A        assertEquals(keyType.asGroupType().getType(0).asPrimitiveType().isRepetition(OPTIONAL), true);%0A        assertEquals(keyType.asGroupType().getType(1).asPrimitiveType().isRepetition(OPTIONAL), true);%0A        valueType = keyValueValue.getType(1).asPrimitiveType();%0A        assertEquals(valueType.isRepetition(OPTIONAL), true);%0A    %7D%0A%7D%0A

Add TestParquetSchemaConverter