@Override
    public Stream<MappingField> resolveAndValidateFields(
            boolean isKey,
            List<MappingField> userFields,
            Map<String, String> options,
            InternalSerializationService serializationService
    ) {
        Map<QueryPath, MappingField> fieldsByPath = extractFields(userFields, isKey);
        for (QueryPath path : fieldsByPath.keySet()) {
            if (path.isTopLevel()) {
                throw QueryException.error("Cannot use the '" + path + "' field with Avro serialization");
            }
        }

        Schema schema = getSchema(fieldsByPath, options, isKey);
        if (schema != null && options.containsKey("schema.registry.url")) {
            throw new IllegalArgumentException("Inline schema cannot be used with schema registry");
        }

        if (userFields.isEmpty()) {
            if (schema == null) {
                throw QueryException.error(
                        "Either a column list or an inline schema is required to create Avro-based mapping");
            }
            return resolveFields(schema, (name, type) ->
                    new MappingField(name, type, new QueryPath(name, isKey).toString()));
        } else {
            if (schema != null) {
                validate(schema, getFields(fieldsByPath).collect(toList()));
            }
            return fieldsByPath.values().stream();
        }
    }
@Test
    public void test_resolveFields() {
        Stream<MappingField> fields = INSTANCE.resolveAndValidateFields(
                isKey,
                List.of(field("field", QueryDataType.INT)),
                emptyMap(),
                null
        );

        assertThat(fields).containsExactly(field("field", QueryDataType.INT));
    }