Examples of NamedExpression


Examples of com.github.sommeri.less4j.core.ast.NamedExpression

  public NamedExpression handleNamedExpression(HiddenTokenAwareTree token) {
    HiddenTokenAwareTree nameToken = token.getChild(0);
    HiddenTokenAwareTree valueToken = token.getChild(1);
    Expression value = (Expression) switchOn(valueToken);

    return new NamedExpression(token, nameToken.getText(), value);

  }
View Full Code Here

Examples of com.github.sommeri.less4j.core.ast.NamedExpression

    result.configureParentToAllChilds();
    return result;
  }

  public Expression evaluate(NamedExpression input) {
    NamedExpression result = new NamedExpression(input.getUnderlyingStructure(), input.getName(), evaluate(input.getExpression()), input.getScope());
    result.configureParentToAllChilds();
    return result;
  }
View Full Code Here

Examples of com.google.dart.engine.ast.NamedExpression

   */
  private Expression getArgument(String name) {
    List<Expression> arguments = annotation.getArguments().getArguments();
    for (Expression argument : arguments) {
      if (argument instanceof NamedExpression) {
        NamedExpression namedExpression = (NamedExpression) argument;
        String argumentName = namedExpression.getName().getLabel().getName();
        if (name.equals(argumentName)) {
          return namedExpression.getExpression();
        }
      }
    }
    return null;
  }
View Full Code Here

Examples of com.google.dart.engine.ast.NamedExpression

    DartObjectImpl[] argumentValues = new DartObjectImpl[argumentCount];
    HashMap<String, DartObjectImpl> namedArgumentValues = new HashMap<String, DartObjectImpl>();
    for (int i = 0; i < argumentCount; i++) {
      Expression argument = arguments.get(i);
      if (argument instanceof NamedExpression) {
        NamedExpression namedExpression = (NamedExpression) argument;
        String name = namedExpression.getName().getLabel().getName();
        namedArgumentValues.put(name, constantVisitor.valueOf(namedExpression.getExpression()));
        argumentValues[i] = constantVisitor.getNull();
      } else {
        argumentValues[i] = constantVisitor.valueOf(argument);
      }
    }
View Full Code Here

Examples of org.apache.drill.common.logical.data.NamedExpression

      List<OrderDef> orderDefs = Lists.newArrayList();
     
      List<NamedExpression> keys = Lists.newArrayList();
      for(LogicalExpression e : segment.getExprs()){
        if( !(e instanceof SchemaPath)) throw new OptimizerException("The basic optimizer doesn't currently support collapsing aggregate where the segment value is something other than a SchemaPath.");
        keys.add(new NamedExpression(e, new FieldReference((SchemaPath) e)));
        orderDefs.add(new OrderDef(Direction.ASC, e));
      }
      Sort sort = new Sort(segment.getInput().accept(this, value), orderDefs, false);
     
      StreamingAggregate sa = new StreamingAggregate(sort, keys.toArray(new NamedExpression[keys.size()]), agg.getAggregations(), 1.0f);
View Full Code Here

Examples of org.apache.drill.common.logical.data.NamedExpression

    TypedFieldId[] keyOutputIds = new TypedFieldId[popConfig.getKeys().length];
   
    ErrorCollector collector = new ErrorCollectorImpl();
   
    for(int i =0; i < keyExprs.length; i++){
      NamedExpression ne = popConfig.getKeys()[i];
      final LogicalExpression expr = ExpressionTreeMaterializer.materialize(ne.getExpr(), incoming, collector);
      if(expr == null) continue;
      keyExprs[i] = expr;
      final MaterializedField outputField = MaterializedField.create(ne.getRef(), expr.getMajorType());
      ValueVector vector = TypeHelper.getNewVector(outputField, context.getAllocator());
      allocators.add(VectorAllocator.getAllocator(vector, 50));
      keyOutputIds[i] = container.add(vector);
    }
   
    for(int i =0; i < valueExprs.length; i++){
      NamedExpression ne = popConfig.getExprs()[i];
      final LogicalExpression expr = ExpressionTreeMaterializer.materialize(ne.getExpr(), incoming, collector);
      if(expr == null) continue;
     
      final MaterializedField outputField = MaterializedField.create(ne.getRef(), expr.getMajorType());
      ValueVector vector = TypeHelper.getNewVector(outputField, context.getAllocator());
      allocators.add(VectorAllocator.getAllocator(vector, 50));
      TypedFieldId id = container.add(vector);
      valueExprs[i] = new ValueVectorWriteExpression(id, expr, true);
    }
View Full Code Here

Examples of org.apache.drill.common.logical.data.NamedExpression

    final List<TransferPair> transfers = Lists.newArrayList();
   
    final CodeGenerator<Projector> cg = new CodeGenerator<Projector>(Projector.TEMPLATE_DEFINITION, context.getFunctionRegistry());
   
    for(int i =0; i < exprs.size(); i++){
      final NamedExpression namedExpression = exprs.get(i);
      final LogicalExpression expr = ExpressionTreeMaterializer.materialize(namedExpression.getExpr(), incoming, collector);
      final MaterializedField outputField = MaterializedField.create(getRef(namedExpression), expr.getMajorType());
      if(collector.hasErrors()){
        throw new SchemaChangeException(String.format("Failure while trying to materialize incoming schema.  Errors:\n %s.", collector.toErrorString()));
      }
     
View Full Code Here

Examples of org.apache.drill.common.logical.data.NamedExpression

    final List<String> childFields = getChild().getRowType().getFieldNames();
    final List<String> fields = getRowType().getFieldNames();

    for (int group : BitSets.toIter(groupSet)) {
      FieldReference fr = new FieldReference(childFields.get(group), ExpressionPosition.UNKNOWN);
      keys.add(new NamedExpression(fr, fr));
    }

    for (Ord<AggregateCall> aggCall : Ord.zip(aggCalls)) {
      int aggExprOrdinal = groupSet.cardinality() + aggCall.i;
      FieldReference ref = new FieldReference(fields.get(aggExprOrdinal));
      LogicalExpression expr = toDrill(aggCall.e, childFields, new DrillParseContext());
      NamedExpression ne = new NamedExpression(expr, ref);
      aggExprs.add(ne);

      if (getOperatorPhase() == OperatorPhase.PHASE_1of2) {
        if (aggCall.e.getAggregation().getName().equals("COUNT")) {
          // If we are doing a COUNT aggregate in Phase1of2, then in Phase2of2 we should SUM the COUNTs,
View Full Code Here

Examples of org.apache.drill.common.logical.data.NamedExpression

    public void setupHashTable() throws IOException, SchemaChangeException, ClassTransformationException {

        // Setup the hash table configuration object
        int conditionsSize = conditions.size();

        NamedExpression rightExpr[] = new NamedExpression[conditionsSize];
        NamedExpression leftExpr[] = new NamedExpression[conditionsSize];

        // Create named expressions from the conditions
        for (int i = 0; i < conditionsSize; i++) {
            rightExpr[i] = new NamedExpression(conditions.get(i).getRight(), new FieldReference("build_side_" + i ));
            leftExpr[i] = new NamedExpression(conditions.get(i).getLeft(), new FieldReference("probe_side_" + i));

            // Hash join only supports equality currently.
            assert conditions.get(i).getRelationship().equals("==");
        }
View Full Code Here

Examples of org.apache.drill.common.logical.data.NamedExpression

  protected List<NamedExpression> getProjectExpressions(DrillParseContext context) {
    List<NamedExpression> expressions = Lists.newArrayList();
    for (Pair<RexNode, String> pair : Pair.zip(exps, getRowType().getFieldNames())) {
      LogicalExpression expr = DrillOptiq.toDrill(context, getChild(), pair.left);
      expressions.add(new NamedExpression(expr, FieldReference.getWithQuotedRef(pair.right)));
    }
    return expressions;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.