@Override
 public void visit(SelectExpressionItem item) {
   ColumnParser columnParser = new ColumnParser();
   item.getExpression().accept(columnParser);
   if (columnParser.isSimple()) {
     String columnName = columnParser.getColumnName();
     simpleColumnNames.add(columnName);
     aliases.put(columnName, StringUtils.strip(item.getAlias().getName(), "`").toUpperCase());
   }
 }
Example #2
0
 @Override
 public void visit(SelectExpressionItem sei) {
   _exprStack = new Stack<ValueExpression>();
   _agg = null;
   sei.getExpression().accept(this);
   doneSingleItem();
 }
  @Override
  public void visit(SelectExpressionItem selectExpressionItem) {
    if (firstRun) {
      if (selectExpressionItem.getAlias() != null) {
        aliases.add(selectExpressionItem.getAlias().getName().toUpperCase());
      }
    } else {
      if (selectExpressionItem.getAlias() == null) {

        while (true) {
          String alias = getNextAlias().toUpperCase();
          if (!aliases.contains(alias)) {
            aliases.add(alias);
            selectExpressionItem.setAlias(new Alias(alias));
            break;
          }
        }
      }
    }
  }
  @Override
  public Object[] readOneTuple() {
    // TODO Auto-generated method stub
    Object[] temp = op.readOneTuple();
    Evaluator eval = new Evaluator(schema, temp);

    int index = 0;
    if (temp == null) return null;
    if (allColumns) return temp;
    for (SelectExpressionItem e : toProject) {
      try {
        if (e.getExpression() instanceof Function) {
          Expression x = new Column(null, e.getExpression().toString());
          tuple[index] = eval.eval(x);
        } else {
          tuple[index] = eval.eval(e.getExpression());
        }
      } catch (SQLException e1) {
        System.out.println("Exception in ProjectOperator.readOneTuple()");
      }
      index++;
    }
    return tuple;
  }
Example #5
0
 @Override
 public void visit(SelectExpressionItem selectExpressionItem) throws Exception {
   selectExpressionItem.getExpression().accept(this);
 }