use of com.hazelcast.sql.impl.extract.QueryPath in project hazelcast by hazelcast.
the class JoinByEquiJoinProcessorSupplier method get.
@Nonnull
@Override
public Collection<? extends Processor> get(int count) {
List<Processor> processors = new ArrayList<>(count);
for (int i = 0; i < count; i++) {
PartitionIdSet partitions = this.partitions == null ? null : new PartitionIdSet(partitionCount, this.partitions);
QueryPath[] rightPaths = rightRowProjectorSupplier.paths();
KvRowProjector rightProjector = rightRowProjectorSupplier.get(evalContext, extractors);
Processor processor = new TransformP<JetSqlRow, JetSqlRow>(joinFn(joinInfo, map, partitions, rightPaths, rightProjector, evalContext)) {
@Override
public boolean isCooperative() {
return false;
}
};
processors.add(processor);
}
return processors;
}
use of com.hazelcast.sql.impl.extract.QueryPath in project hazelcast by hazelcast.
the class MetadataCompactResolver method resolveMetadata.
@Override
public KvMetadata resolveMetadata(boolean isKey, List<MappingField> resolvedFields, Map<String, String> options, InternalSerializationService serializationService) {
Map<QueryPath, MappingField> fieldsByPath = extractFields(resolvedFields, isKey);
String typeNameProperty = isKey ? OPTION_KEY_COMPACT_TYPE_NAME : OPTION_VALUE_COMPACT_TYPE_NAME;
String typeName = options.get(typeNameProperty);
List<TableField> fields = new ArrayList<>(fieldsByPath.size());
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);
Schema schema = resolveSchema(typeName, fieldsByPath);
return new KvMetadata(fields, GenericQueryTargetDescriptor.DEFAULT, new CompactUpsertTargetDescriptor(schema));
}
use of com.hazelcast.sql.impl.extract.QueryPath in project hazelcast by hazelcast.
the class MetadataCompactResolver method resolveSchema.
private Schema resolveSchema(String typeName, Map<QueryPath, MappingField> fields) {
SchemaWriter schemaWriter = new SchemaWriter(typeName);
for (Entry<QueryPath, MappingField> entry : fields.entrySet()) {
String name = entry.getKey().getPath();
QueryDataType type = entry.getValue().type();
schemaWriter.addField(new FieldDescriptor(name, resolveToCompactKind(type.getTypeFamily())));
}
return schemaWriter.build();
}
use of com.hazelcast.sql.impl.extract.QueryPath in project hazelcast by hazelcast.
the class MetadataPortableResolver method resolveFields.
Stream<MappingField> resolveFields(boolean isKey, @Nullable ClassDefinition clazz) {
if (clazz == null || clazz.getFieldCount() == 0) {
// ClassDefinition does not exist, or it is empty, map the whole value
String name = isKey ? KEY : VALUE;
return Stream.of(new MappingField(name, QueryDataType.OBJECT, name));
}
return clazz.getFieldNames().stream().map(name -> {
QueryPath path = new QueryPath(name, isKey);
QueryDataType type = resolvePortableType(clazz.getFieldType(name));
return new MappingField(name, type, path.toString());
});
}
use of com.hazelcast.sql.impl.extract.QueryPath in project hazelcast by hazelcast.
the class MetadataPortableResolver method resolveMetadata.
@Override
public KvMetadata resolveMetadata(boolean isKey, List<MappingField> resolvedFields, Map<String, String> options, InternalSerializationService serializationService) {
Map<QueryPath, MappingField> fieldsByPath = extractFields(resolvedFields, isKey);
ClassDefinition clazz = resolveClassDefinition(isKey, options, fieldsByPath.values(), serializationService);
return resolveMetadata(isKey, resolvedFields, fieldsByPath, clazz);
}
Aggregations