static List<MappingField> resolveFields(Schema schema) {
        Map<String, MappingField> fields = new LinkedHashMap<>();
        for (Schema.Field schemaField : schema.getFields()) {
            String name = schemaField.name();
            // SQL types are nullable by default and NOT NULL is currently unsupported.
            Schema.Type schemaFieldType = unwrapNullableType(schemaField.schema()).getType();
            QueryDataType type = AVRO_TO_SQL.getOrDefault(schemaFieldType, OBJECT);

            MappingField field = new MappingField(name, type);
            fields.putIfAbsent(field.name(), field);
        }
        return new ArrayList<>(fields.values());
    }
@Test
    public void test_resolveNullableFields() {
        // given
        Schema schema = SchemaBuilder.record("name")
                .fields()
                .name("boolean").type().nullable().booleanType().noDefault()
                .name("int").type().nullable().intType().noDefault()
                .name("long").type().nullable().longType().noDefault()
                .name("float").type().nullable().floatType().noDefault()
                .name("double").type().nullable().doubleType().noDefault()
                .name("string").type().nullable().stringType().noDefault()
                .name("object").type().nullable().record("object").fields().endRecord().noDefault()
                .endRecord();

        // when
        List<MappingField> fields = AvroResolver.resolveFields(schema);

        // then
        assertIterableEquals(fields,
                new MappingField("boolean", QueryDataType.BOOLEAN),
                new MappingField("int", QueryDataType.INT),
                new MappingField("long", QueryDataType.BIGINT),
                new MappingField("float", QueryDataType.REAL),
                new MappingField("double", QueryDataType.DOUBLE),
                new MappingField("string", QueryDataType.VARCHAR),
                new MappingField("object", QueryDataType.OBJECT));
    }