Search in sources :

Example 1 with MongoScanSpec

use of org.apache.drill.exec.store.mongo.MongoScanSpec in project drill by apache.

the class MongoPluginImplementor method getPhysicalOperator.

@Override
public GroupScan getPhysicalOperator() {
    MongoScanSpec scanSpec = groupScan.getScanSpec();
    List<String> operations = this.operations.stream().map(op -> op.toBsonDocument().toJson()).collect(Collectors.toList());
    String filters = Optional.ofNullable(this.filters).map(Document::toJson).orElse(null);
    MongoScanSpec newSpec = new MongoScanSpec(scanSpec.getDbName(), scanSpec.getCollectionName(), filters, operations);
    return new MongoGroupScan(groupScan.getUserName(), groupScan.getStoragePlugin(), newSpec, columns, runAggregate);
}
Also used : Document(org.bson.Document) Aggregates(com.mongodb.client.model.Aggregates) BsonValue(org.bson.BsonValue) Union(org.apache.calcite.rel.core.Union) Utilities(org.apache.drill.exec.util.Utilities) BigDecimal(java.math.BigDecimal) BsonElement(org.bson.BsonElement) RexNode(org.apache.calcite.rex.RexNode) PluginProjectRel(org.apache.drill.exec.store.plan.rel.PluginProjectRel) PluginLimitRel(org.apache.drill.exec.store.plan.rel.PluginLimitRel) SqlKind(org.apache.calcite.sql.SqlKind) PluginFilterRel(org.apache.drill.exec.store.plan.rel.PluginFilterRel) RexLiteral(org.apache.calcite.rex.RexLiteral) SchemaPath(org.apache.drill.common.expression.SchemaPath) MongoGroupScan(org.apache.drill.exec.store.mongo.MongoGroupScan) LogicalExpression(org.apache.drill.common.expression.LogicalExpression) RelFieldCollation(org.apache.calcite.rel.RelFieldCollation) Collectors(java.util.stream.Collectors) List(java.util.List) Sort(org.apache.calcite.rel.core.Sort) RelDataTypeField(org.apache.calcite.rel.type.RelDataTypeField) Optional(java.util.Optional) PluginAggregateRel(org.apache.drill.exec.store.plan.rel.PluginAggregateRel) Project(org.apache.calcite.rel.core.Project) TableScan(org.apache.calcite.rel.core.TableScan) PluginSortRel(org.apache.drill.exec.store.plan.rel.PluginSortRel) Filter(org.apache.calcite.rel.core.Filter) BsonString(org.bson.BsonString) BsonDocument(org.bson.BsonDocument) ArrayList(java.util.ArrayList) AbstractPluginImplementor(org.apache.drill.exec.store.plan.AbstractPluginImplementor) Bson(org.bson.conversions.Bson) DrillOptiq(org.apache.drill.exec.planner.logical.DrillOptiq) MongoAggregateUtils(org.apache.drill.exec.store.mongo.MongoAggregateUtils) Pair(org.apache.calcite.util.Pair) PluginImplementor(org.apache.drill.exec.store.plan.PluginImplementor) JavaTypeFactory(org.apache.calcite.adapter.java.JavaTypeFactory) DrillParseContext(org.apache.drill.exec.planner.logical.DrillParseContext) PrelUtil(org.apache.drill.exec.planner.physical.PrelUtil) PluginUnionRel(org.apache.drill.exec.store.plan.rel.PluginUnionRel) IOException(java.io.IOException) RelNode(org.apache.calcite.rel.RelNode) Aggregate(org.apache.calcite.rel.core.Aggregate) MongoFilterBuilder(org.apache.drill.exec.store.mongo.MongoFilterBuilder) DrillLimitRelBase(org.apache.drill.exec.planner.common.DrillLimitRelBase) GroupScan(org.apache.drill.exec.physical.base.GroupScan) MongoScanSpec(org.apache.drill.exec.store.mongo.MongoScanSpec) AggregateCall(org.apache.calcite.rel.core.AggregateCall) BsonInt32(org.bson.BsonInt32) StoragePluginTableScan(org.apache.drill.exec.store.plan.rel.StoragePluginTableScan) BsonString(org.bson.BsonString) MongoGroupScan(org.apache.drill.exec.store.mongo.MongoGroupScan) MongoScanSpec(org.apache.drill.exec.store.mongo.MongoScanSpec)

Aggregations

Aggregates (com.mongodb.client.model.Aggregates)1 IOException (java.io.IOException)1 BigDecimal (java.math.BigDecimal)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Optional (java.util.Optional)1 Collectors (java.util.stream.Collectors)1 JavaTypeFactory (org.apache.calcite.adapter.java.JavaTypeFactory)1 RelFieldCollation (org.apache.calcite.rel.RelFieldCollation)1 RelNode (org.apache.calcite.rel.RelNode)1 Aggregate (org.apache.calcite.rel.core.Aggregate)1 AggregateCall (org.apache.calcite.rel.core.AggregateCall)1 Filter (org.apache.calcite.rel.core.Filter)1 Project (org.apache.calcite.rel.core.Project)1 Sort (org.apache.calcite.rel.core.Sort)1 TableScan (org.apache.calcite.rel.core.TableScan)1 Union (org.apache.calcite.rel.core.Union)1 RelDataTypeField (org.apache.calcite.rel.type.RelDataTypeField)1 RexLiteral (org.apache.calcite.rex.RexLiteral)1 RexNode (org.apache.calcite.rex.RexNode)1