use of com.hazelcast.sql.impl.schema.MappingField in project hazelcast by hazelcast.
the class KvMetadataJsonResolver method resolveMetadata.
@Override
public KvMetadata resolveMetadata(boolean isKey, List<MappingField> resolvedFields, Map<String, String> options, InternalSerializationService serializationService) {
Map<QueryPath, MappingField> fieldsByPath = extractFields(resolvedFields, isKey);
List<TableField> fields = new ArrayList<>();
for (Entry<QueryPath, MappingField> entry : fieldsByPath.entrySet()) {
QueryPath path = entry.getKey();
QueryDataType type = entry.getValue().type();
String name = entry.getValue().name();
fields.add(new MapTableField(name, type, false, path));
}
maybeAddDefaultField(isKey, resolvedFields, fields, QueryDataType.OBJECT);
return new KvMetadata(fields, JsonQueryTargetDescriptor.INSTANCE, JsonUpsertTargetDescriptor.INSTANCE);
}
use of com.hazelcast.sql.impl.schema.MappingField in project hazelcast by hazelcast.
the class TableResolverImpl method resolveMapping.
private Mapping resolveMapping(Mapping mapping) {
String type = mapping.type();
Map<String, String> options = mapping.options();
SqlConnector connector = connectorCache.forType(type);
List<MappingField> resolvedFields = connector.resolveAndValidateFields(nodeEngine, options, mapping.fields());
return new Mapping(mapping.name(), mapping.externalName(), type, new ArrayList<>(resolvedFields), new LinkedHashMap<>(options));
}
Aggregations