Package cascading.tuple

Examples of cascading.tuple.TupleEntry


    }

  @Override
  public void sink( FlowProcess<? extends Properties> flowProcess, SinkCall<PrintWriter, OutputStream> sinkCall ) throws IOException
    {
    TupleEntry tupleEntry = sinkCall.getOutgoingEntry();

    Iterable<String> strings = tupleEntry.asIterableOf( String.class );

    delimitedParser.joinLine( strings, sinkCall.getContext() );

    sinkCall.getContext().println();
    }
View Full Code Here


  public void initialize()
    {
    super.initialize();

    Scope outgoingScope = Util.getFirst( outgoingScopes );
    valueEntry = new TupleEntry( outgoingScope.getOutValuesFields(), true );
    }
View Full Code Here

      }

    public void aggregate( FlowProcess flowProcess, AggregatorCall<Map<String, Double>> aggregatorCall )
      {
      Map<String, Double> context = aggregatorCall.getContext();
      TupleEntry entry = aggregatorCall.getArguments();

      context.put( COUNT, ( (Double) context.get( COUNT ) ) + 1d );

      context.put( SUM1, ( (Double) context.get( SUM1 ) ) + entry.getTuple().getDouble( 0 ) );
      context.put( SUM2, ( (Double) context.get( SUM2 ) ) + entry.getTuple().getDouble( 1 ) );

      context.put( SUMSQRS1, ( (Double) context.get( SUMSQRS1 ) ) + Math.pow( entry.getTuple().getDouble( 0 ), 2 ) );
      context.put( SUMSQRS2, ( (Double) context.get( SUMSQRS2 ) ) + Math.pow( entry.getTuple().getDouble( 1 ), 2 ) );

      context.put( SUMPROD, ( (Double) context.get( SUMPROD ) ) + ( entry.getTuple().getDouble( 0 ) * entry.getTuple().getDouble( 1 ) ) );
      }
View Full Code Here

  public void operate( FlowProcess flowProcess, FunctionCall functionCall )
    {
    Set<Tuple> set = new TreeSet<Tuple>();

    TupleEntry input = functionCall.getArguments();

    for( Fields field : fields )
      set.add( input.selectTuple( field ) );

    int i = 0;
    Tuple inputCopy = new Tuple( input.getTuple() );

    for( Tuple tuple : set )
      inputCopy.put( input.getFields(), fields[ i++ ], tuple );

    functionCall.getOutputCollector().add( inputCopy );
    }
View Full Code Here

      aggregatorCall.setContext( new Double[]{0d} );
      }

    public void aggregate( FlowProcess flowProcess, AggregatorCall<Double[]> aggregatorCall )
      {
      TupleEntry entry = aggregatorCall.getArguments();
      aggregatorCall.getContext()[ 0 ] += Math.pow( entry.getDouble( 0 ) - entry.getDouble( 1 ), 2 );
      }
View Full Code Here

    {
    }

  private TupleEntry getEntry( Tuple tuple )
    {
    return new TupleEntry( Fields.size( tuple.size() ), tuple );
    }
View Full Code Here

    {
    int count = 0;

    while( iterator.hasNext() )
      {
      TupleEntry tupleEntry = iterator.next();

      if( size != -1 )
        assertEquals( "wrong number of elements", size, tupleEntry.size() );

      if( regex != null )
        assertTrue( "regex: " + regex + " does not match: " + tupleEntry.getTuple().toString(), regex.matcher( tupleEntry.getTuple().toString() ).matches() );

      count++;
      }

    try
View Full Code Here

    assertEquals( "wrong number of lines", length, count );
    }

  public static TupleListCollector invokeFunction( Function function, Tuple arguments, Fields resultFields )
    {
    return invokeFunction( function, new TupleEntry( arguments ), resultFields );
    }
View Full Code Here

    return collector;
    }

  public static boolean invokeFilter( Filter filter, Tuple arguments )
    {
    return invokeFilter( filter, new TupleEntry( arguments ) );
    }
View Full Code Here

  private static TupleEntry[] makeArgumentsArray( Tuple[] argumentsArray )
    {
    TupleEntry[] entries = new TupleEntry[ argumentsArray.length ];

    for( int i = 0; i < argumentsArray.length; i++ )
      entries[ i ] = new TupleEntry( argumentsArray[ i ] );

    return entries;
    }
View Full Code Here

TOP

Related Classes of cascading.tuple.TupleEntry

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.