Package cascading.tuple

Examples of cascading.tuple.TupleEntry


    boolean result = sourceCall.getInput().next( key, value );

    if( !result )
      return false;

    TupleEntry entry = sourceCall.getIncomingEntry();

    if( entry.hasTypes() )
      entry.setCanonicalTuple( value );
    else
      entry.setTuple( value );

    return true;
    }
View Full Code Here


    return sourceCall.getInput().next( context[ 0 ], context[ 1 ] );
    }

  protected void sourceHandleInput( SourceCall<Object[], RecordReader> sourceCall )
    {
    TupleEntry result = sourceCall.getIncomingEntry();

    int index = 0;
    Object[] context = sourceCall.getContext();

    // coerce into canonical forms
    if( getSourceFields().size() == 2 )
      result.setLong( index++, ( (LongWritable) context[ 0 ] ).get() );

    result.setString( index, makeEncodedString( context ) );
    }
View Full Code Here

    }

  @Override
  public void sink( FlowProcess<? extends Configuration> flowProcess, SinkCall<Object[], OutputCollector> sinkCall ) throws IOException
    {
    TupleEntry tupleEntry = sinkCall.getOutgoingEntry();

    Text text = (Text) sinkCall.getContext()[ 0 ];
    StringBuilder line = (StringBuilder) sinkCall.getContext()[ 1 ];
    Charset charset = (Charset) sinkCall.getContext()[ 2 ];

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

    line = (StringBuilder) delimitedParser.joinLine( strings, line );

    text.set( line.toString().getBytes( charset ) );
View Full Code Here

    String line = sourceCall.getContext().readLine();

    if( line == null )
      return false;

    TupleEntry incomingEntry = sourceCall.getIncomingEntry();

    if( getSourceFields().size() == 1 )
      {
      incomingEntry.setObject( 0, line );
      }
    else
      {
      incomingEntry.setInteger( 0, lineNumber );
      incomingEntry.setString( 1, line );
      }

    return true;
    }
View Full Code Here

    operationCall = new ConcreteCall();
    }

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

    ExpressionFilter f2 = new ExpressionFilter( "( 100f < b )", new String[]{"b"}, new Class<?>[]{Float.TYPE} );
    Or logic = new Or( new Fields( "a" ), f1, new Fields( "b" ), f2 );

    boolean[] results = invokeFilter( logic,
      new TupleEntry[]{
        new TupleEntry( inputFields, new Tuple( "1", "10" ) ),
        new TupleEntry( inputFields, new Tuple( "2", "20" ) )
      } );

    assertFalse( results[ 0 ] );
    assertFalse( results[ 1 ] );
    }
View Full Code Here

    ExpressionFilter f2 = new ExpressionFilter( "( 100f < b )", new String[]{"b"}, new Class<?>[]{Float.TYPE} );
    Xor logic = new Xor( new Fields( "a" ), f1, new Fields( "b" ), f2 );

    boolean[] results = invokeFilter( logic,
      new TupleEntry[]{
        new TupleEntry( inputFields, new Tuple( "1", "10" ) ),
        new TupleEntry( inputFields, new Tuple( "2", "20" ) )
      } );

    assertFalse( results[ 0 ] );
    assertFalse( results[ 1 ] );
    }
View Full Code Here

    ExpressionFilter f2 = new ExpressionFilter( "( 100f < b )", new String[]{"b"}, new Class<?>[]{Float.TYPE} );
    And logic = new And( new Fields( "a" ), f1, new Fields( "b" ), f2 );

    boolean[] results = invokeFilter( logic,
      new TupleEntry[]{
        new TupleEntry( inputFields, new Tuple( "1", "10" ) ),
        new TupleEntry( inputFields, new Tuple( "2", "20" ) )
      } );

    assertFalse( results[ 0 ] );
    assertFalse( results[ 1 ] );
    }
View Full Code Here

    operationCall = new ConcreteCall();
    }

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

    }

  public void operate( FlowProcess flowProcess, BufferCall<Integer> bufferCall )
    {
    bufferCall.setContext( bufferCall.getContext() + 1 );
    TupleEntry group = bufferCall.getGroup();

//    if( !group.getFields().equals( groupFields ) )
//      throw new RuntimeException( "group fields do not match: " + group.getFields() + " != " + groupFields );

    if( group.size() != groupFields.size() )
      throw new RuntimeException( "group tuple size not fields size" );

    if( group.size() == 0 )
      throw new RuntimeException( "group tuple size is zero" );

    boolean allAreNull = true;
    for( Object o : group.getTuple() )
      {
      if( o != null )
        allAreNull = false;
      }
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.