Package cascading.lingual.optiq.meta

Examples of cascading.lingual.optiq.meta.Branch


    return new CascadingJoinRel( getCluster(), traitSet, left, right, conditionExpr, this.joinType, this.variablesStopped, this.hash );
    }

  public Branch visitChild( Stack stack )
    {
    Branch lhsBranch = ( (CascadingRelNode) left ).visitChild( stack );
    Branch rhsBranch = ( (CascadingRelNode) right ).visitChild( stack );

    Pipe leftPipe = new Pipe( "lhs", lhsBranch.current );
    leftPipe = stack.addDebug( this, leftPipe, "lhs" );

    Pipe rightPipe = new Pipe( "rhs", rhsBranch.current );
    rightPipe = stack.addDebug( this, rightPipe, "rhs" );

    Fields lhsGroup = createTypedFieldsSelectorFor( getCluster(), leftKeys, left.getRowType(), true );
    Fields rhsGroup = createTypedFieldsSelectorFor( getCluster(), rightKeys, right.getRowType(), true );

    NullNotEquivalentComparator comparator = new NullNotEquivalentComparator();
    for( int i = 0; i < lhsGroup.size(); i++ )
      lhsGroup.setComparator( i, comparator );

    Joiner joiner = getJoiner();

    Fields declaredFields = RelUtil.createTypedFieldsFor( this, false );

    // need to parse lhs rhs fields from condition
    String name = stack.getNameFor( CoGroup.class, leftPipe, rightPipe );
    Pipe coGroup = new CoGroup( name, leftPipe, lhsGroup, rightPipe, rhsGroup, declaredFields, joiner );

    coGroup = stack.addDebug( this, coGroup );

    return new Branch( coGroup, lhsBranch, rhsBranch );
    }
View Full Code Here


  public Branch visitChild( Stack stack )
    {
    String pipeName = isUseFullName() ? getQualifiedName() : name;

    return new Branch( getPlatformBroker(), stack.heads, pipeName, getTapTable().getTableDef() );
    }
View Full Code Here

  @Override
  public Branch visitChild( Stack stack )
    {
    RelNode child = getChild();
    Branch branch = ( (CascadingRelNode) child ).visitChild( stack );

    Fields outgoingNamedFields = RelUtil.createTypedFieldsFor( this, false );

    // assumption here is if aggCalls is empty, we are performing a DISTINCT on the group set
    if( getAggCallList().isEmpty() )
      {
      Pipe current = new Unique( branch.current, outgoingNamedFields );

      current = stack.addDebug( this, current );

      return new Branch( current, branch );
      }

    if( getInputs().size() != 1 )
      throw new UnsupportedOperationException( "multiple inputs not supported, found: " + getInputs().size() );

    RelDataType inputRowType = getInput( 0 ).getRowType();

    Pipe previous = branch.current;
    Fields groupFields = RelUtil.createTypedFields( getCluster(), inputRowType, Util.toIter( getGroupSet() ), false );

    List<AggregateCall> distincts = new ArrayList<AggregateCall>();
    List<AggregateCall> concurrents = new ArrayList<AggregateCall>();
    gatherAggregateCalls( distincts, concurrents );

    AggregateBy concurrentAggregates = createConcurrentAggregates( inputRowType, previous, groupFields, concurrents );
    Pipe[] distinctAggregates = createDistinctAggregates( stack, inputRowType, previous, groupFields, distincts );

    if( concurrentAggregates == null && distinctAggregates == null )
      throw new IllegalStateException( "concurrent and distinct aggregates are null" );

    if( concurrentAggregates != null && distinctAggregates == null )
      return new Branch( stack.addDebug( this, concurrentAggregates ), branch );

    if( concurrentAggregates == null && distinctAggregates != null && distinctAggregates.length == 1 )
      return new Branch( stack.addDebug( this, distinctAggregates[ 0 ] ), branch );

    Pipe[] pipes = createPipes( concurrentAggregates, distinctAggregates );

    Fields declaredFields = createDeclaredFields( groupFields, distincts, concurrentAggregates );
    Fields declaredPosFields = Fields.size( declaredFields.size() ).applyTypes( declaredFields.getTypes() );

    Fields[] groupFieldsArray = createGroupingFields( groupFields, pipes );

    String name = stack.getNameFor( groupFields.isNone() ? HashJoin.class : CoGroup.class, pipes );

    Pipe join;

    if( groupFields.isNone() ) // not grouping, just appending tuples into a single row
      join = new HashJoin( name, pipes, groupFieldsArray, declaredFields, new InnerJoin() );
    else
      join = new CoGroup( name, pipes, groupFieldsArray, declaredFields, new InnerJoin() );

    join = new Retain( join, outgoingNamedFields );

    join = stack.addDebug( this, join );

    return new Branch( join, branch );
    }
View Full Code Here

  static Branch resolveBranch( Stack stack, CascadingRelNode node, RexProgram program )
    {
    final RelOptCluster cluster = node.getCluster();

    CascadingRelNode child = (CascadingRelNode) ( (SingleRel) node ).getChild();
    Branch branch = child.visitChild( stack );
    Pipe pipe = branch.current;

    final List<String> names = getIncomingFieldNames( pipe );

    if( names != null && !names.equals( program.getInputRowType().getFieldNames() ) )
      program = renameInputs( program, cluster.getRexBuilder(), names );

    Split split = Split.of( program, cluster.getRexBuilder() );

    for( Pair<Op, RexProgram> pair : split.list )
      pipe = addProgram( cluster, pipe, pair.left, pair.right );

    pipe = stack.addDebug( node, pipe );

    return new Branch( pipe, branch );
    }
View Full Code Here

    else
      pipe = new GroupBy( name, pipes, Fields.ALL );

    pipe = stack.addDebug( this, pipe );

    return new Branch( pipe, branches );
    }
View Full Code Here

  public Branch visitChild( Stack stack )
    {
    PlatformBroker platformBroker = getPlatformBroker();
    TableDef tableDef = getTapTable().getTableDef();

    return new Branch( platformBroker, tableDef, getTuples() );
    }
View Full Code Here

    return new CascadingSortRel( getCluster(), traitSet, newInput, newCollation, offset, fetch );
    }

  public Branch visitChild( Stack stack )
    {
    Branch branch = ( (CascadingRelNode) getChild() ).visitChild( stack );
    Fields fields = createFields();

    String name = stack.getNameFor( GroupBy.class, branch.current );
    Pipe current = new GroupBy( name, branch.current, fields );

    current = stack.addDebug( this, current );

    return new Branch( current, branch );
    }
View Full Code Here

  public Branch visitChild( Stack stack )
    {
    String pipeName = createUniqueName();
    Fields fields = RelUtil.createTypedFieldsFor( this, false );

    return new Branch( stack.heads, pipeName, fields, tuples );
    }
View Full Code Here

    }

  @Override
  public Branch visitChild( Stack stack )
    {
    Branch branch = ( (CascadingRelNode) getChild() ).visitChild( stack );
    TableDef tableDef = getTapTable().getTableDef();

    return new Branch( getPlatformBroker(), branch, tableDef );
    }
View Full Code Here

  public Result implement( EnumerableRelImplementor implementor, Prefer pref )
    {
    LOG.debug( "implementing enumerable" );

    CascadingRelNode input = (CascadingRelNode) getChild();
    Branch branch = input.visitChild( new Stack() );

    VolcanoPlanner planner = (VolcanoPlanner) getCluster().getPlanner();

    PhysType physType = PhysTypeImpl.of( implementor.getTypeFactory(), input.getRowType(), JavaRowFormat.ARRAY );
View Full Code Here

TOP

Related Classes of cascading.lingual.optiq.meta.Branch

Copyright © 2018 www.massapicom. 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.