public static Optional<org.apache.parquet.schema.Type> getColumnType(Type prestoType, MessageType messageType, boolean useParquetColumnNames, HiveColumnHandle column, SchemaTableName tableName, Path path)
    {
        if (isPushedDownSubfield(column)) {
            Subfield pushedDownSubfield = getPushedDownSubfield(column);
            return getSubfieldType(messageType, pushedDownSubfield.getRootName(), nestedColumnPath(pushedDownSubfield));
        }
        return getParquetType(prestoType, messageType, useParquetColumnNames, column, tableName, path);
    }
@Test
    public void testGetColumnType()
    {
        MessageType messageType = buildMessageType();
        SchemaTableName tableName = new SchemaTableName("db001", "tbl001");
        Path path = new Path("/tmp/hello");

        // Simple field by index.
        Optional<org.apache.parquet.schema.Type> parquetType = getColumnType(VarcharType.VARCHAR, messageType, false,
                buildSimpleColumnHandle("name", 0), tableName, path);
        PrimitiveType expectedNameType = new PrimitiveType(REQUIRED, BINARY, "name");
        assertTrue(parquetType.isPresent());
        assertEquals(
                parquetType.get(), expectedNameType);

        // Simple field by name.
        parquetType = getColumnType(VarcharType.VARCHAR, messageType, true,
                buildSimpleColumnHandle("name", 0), tableName, path);
        assertTrue(parquetType.isPresent());
        assertEquals(
                parquetType.get(), expectedNameType);

        // Pushdown fields with useParquetColumnNames = false.
        HiveColumnHandle addressCityColumn = buildNestedPushDownColumnHandle("address", "city");
        parquetType = getColumnType(VarcharType.VARCHAR, messageType, false,
                addressCityColumn, tableName, path);

        PrimitiveType city = new PrimitiveType(REQUIRED, BINARY, "city");
        MessageType expectedAddressWithCityType = new MessageType("address", ImmutableList.of(city));

        assertTrue(parquetType.isPresent());
        assertEquals(
                parquetType.get(), expectedAddressWithCityType);

        // Pushdown fields with useParquetColumnNames = true.
        parquetType = getColumnType(VarcharType.VARCHAR, messageType, true,
                addressCityColumn, tableName, path);
        assertTrue(parquetType.isPresent());
        assertEquals(
                parquetType.get(), expectedAddressWithCityType);
    }