Package org.eigenbase.rex

Examples of org.eigenbase.rex.RexProgramBuilder.addProject()


    {
    final RelDataTypeFactory typeFactory = new FieldTypeFactory();
    final RelDataType inputType = typeFactory.createStructType( new RelDataTypeFactory.FieldInfoBuilder() );
    final RexBuilder builder = new RexBuilder( typeFactory );
    final RexProgramBuilder programBuilder = new RexProgramBuilder( inputType, builder );
    programBuilder.addProject( builder.makeExactLiteral( BigDecimal.ONE ), "x" );
    programBuilder.addProject( builder.makeCharLiteral( new NlsString( "foo", null, null ) ), "y" );
    final RexProgram program = programBuilder.getProgram();
    final ProgramUtil.Analyzed analyze = ProgramUtil.analyze( program );
    assertTrue( analyze.hasConstants );
    assertFalse( analyze.hasFunctions );
View Full Code Here


    final RelDataTypeFactory typeFactory = new FieldTypeFactory();
    final RelDataType inputType = typeFactory.createStructType( new RelDataTypeFactory.FieldInfoBuilder() );
    final RexBuilder builder = new RexBuilder( typeFactory );
    final RexProgramBuilder programBuilder = new RexProgramBuilder( inputType, builder );
    programBuilder.addProject( builder.makeExactLiteral( BigDecimal.ONE ), "x" );
    programBuilder.addProject( builder.makeCharLiteral( new NlsString( "foo", null, null ) ), "y" );
    final RexProgram program = programBuilder.getProgram();
    final ProgramUtil.Analyzed analyze = ProgramUtil.analyze( program );
    assertTrue( analyze.hasConstants );
    assertFalse( analyze.hasFunctions );
    assertNull( analyze.permutation );
View Full Code Here

          final RexProgramBuilder builder = new RexProgramBuilder( previous.getOutputRowType(), rexBuilder );

          for( int i = 0; i < analyze.permutation.getTargetCount(); i++ )
            {
            final int target = analyze.permutation.getTarget( i );
            builder.addProject( target, null );
            }

          previous = builder.getProgram();
          list.add( Pair.of( Op.RENAME, previous ) );
          break;
View Full Code Here

            if( source >= 0 )
              outputFieldNames.set( source, name.e );
            }

          for( int i = 0; i < outputFieldNames.size(); i++ )
            builder.addProject( i, outputFieldNames.get( i ) );

          previous = builder.getProgram();
          list.add( Pair.of( Op.RENAME, previous ) );

          // We're done. Remaining program would be the identity.
View Full Code Here

          builder.clearProjects();

          for( RexLocalRef pair : program.getProjectList() )
            {
            final int index = pair.getIndex();
            builder.addProject( index, program.getInputRowType().getFieldNames().get( index ) );
            }

          previous = builder.getProgram();
          list.add( Pair.of( Op.RETAIN, previous ) );
View Full Code Here

      int index = i;

      if( exp.left instanceof RexInputRef )
        index = ( (RexInputRef) exp.left ).getIndex();

      builder.addProject( index, exp.right );
      }

    return builder.getProgram( false ); // todo: optimizer causes issues
    }
  }
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.