Package cascading.tuple

Examples of cascading.tuple.TupleEntry


    }

    @Override
    public void sink(FlowProcess<JobConf> process, SinkCall<Object[], OutputCollector> sinkCall)
        throws IOException {
      TupleEntry tuple = sinkCall.getOutgoingEntry();

      Object obj = tuple.getObject(0);
      String key;
      //a hack since byte[] isn't natively handled by hadoop
      if (getStructure() instanceof DefaultPailStructure) {
        key = getCategory(obj);
      } else {
View Full Code Here


    // This gets called even when there are no tuples in the group after
    // a GroupBy (see the Buffer javadoc). So we need to check if there are any
    // valid tuples returned in the group.
    if (arguments.hasNext()) {
      TupleEntry group = bufferCall.getGroup();
      TupleEntryCollector outputCollector = bufferCall.getOutputCollector();

      callArgs[0] = Py.java2py(group);
      callArgs[1] = Py.java2py(arguments);
      if (outputMethod == OutputMethod.COLLECTS) {
View Full Code Here

    super.prepare(flowProcess, operationCall);
  }

  @Override
  public void operate(FlowProcess flowProcess, FunctionCall functionCall) {
    TupleEntry inputTuple = functionCall.getArguments();
    TupleEntryCollector outputCollector = functionCall.getOutputCollector();
    Tuple outputTuple = new Tuple();

    for (Comparable field : filteredFields) {
      // We cannot use inputTuple.get(...) here, as that tries to convert
      // the field value to a Comparable. In case we have a complex Python
      // type as a field, that won't work.
      outputTuple.add(inputTuple.getObject(field));
    }
    outputCollector.add(outputTuple);
  }
View Full Code Here

    System.out.println("Aggregator start called");
  }

  @Override
  public void aggregate(FlowProcess flowProcess, AggregatorCall aggregatorCall) {
    TupleEntry group = aggregatorCall.getGroup();
    TupleEntryCollector outputCollector = aggregatorCall.getOutputCollector();

    System.out.println("Aggregator called with group: " + group);
  }
View Full Code Here

    super( 1, fieldDeclaration );
   }

  public void operate( FlowProcess flowProcess, FunctionCall functionCall )
    {
    TupleEntry argument = functionCall.getArguments();
    double tree_lat = argument.getDouble( 0 );
    double tree_lng = argument.getDouble( 1 );
    double lat0 = argument.getDouble( 2 );
    double lng0 = argument.getDouble( 3 );
    double lat1 = argument.getDouble( 4 );
    double lng1 = argument.getDouble( 5 );

    // approximation in meters, based on a euclidean approach
    // for a better metric, try using a Haversine formula

    //double tree_dist = pointToLineDistance( lat0, lng0, lat1, lng1, tree_lat, tree_lng );
View Full Code Here

    super( 1, fieldDeclaration );
   }

  public void operate( FlowProcess flowProcess, FunctionCall functionCall )
    {
    TupleEntry argument = functionCall.getArguments();
    String[] geo_list = argument.getString( 0 ).split( "\\s" );

    for( int i = 0; i < ( geo_list.length - 1 ); i++ )
      {
      String[] p0 = geo_list[i].split( "," );
      Double lng0 = new Double( p0[0] );
View Full Code Here

    this.year_new = year_new;
   }

  public void operate( FlowProcess flowProcess, FunctionCall functionCall )
    {
    TupleEntry argument = functionCall.getArguments();
    Integer year_construct = argument.getInteger( 0 );
    Double albedo_new = argument.getDouble( 1 );
    Double albedo_worn = argument.getDouble( 2 );

    Double albedo = ( year_construct >= year_new ) ? albedo_new : albedo_worn;

    Tuple result = new Tuple();
    result.add( albedo );
View Full Code Here

    this.hash_length = hash_length;
    }

  public void operate( FlowProcess flowProcess, FunctionCall functionCall )
    {
    TupleEntry argument = functionCall.getArguments();
    Double lat = argument.getDouble( 0 );
    Double lng = argument.getDouble( 1 );

    GeoHashUtils ghu = new GeoHashUtils();
    String geohash = ghu.encode( lat, lng );

    Tuple result = new Tuple();
View Full Code Here

    if( !result )
      return false;

    int count = 0;
    TupleEntry entry = sourceCall.getIncomingEntry();

    if( keyType != null )
      entry.setObject( count++, key );

    if( valueType != null )
      entry.setObject( count, value );

    return true;
    }
View Full Code Here

    }

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

    Writable keyValue = NullWritable.get();
    Writable valueValue = NullWritable.get();

    if( keyType == null )
      {
      valueValue = (Writable) tupleEntry.getObject( 0 );
      }
    else if( valueType == null )
      {
      keyValue = (Writable) tupleEntry.getObject( 0 );
      }
    else
      {
      keyValue = (Writable) tupleEntry.getObject( 0 );
      valueValue = (Writable) tupleEntry.getObject( 1 );
      }

    sinkCall.getOutput().collect( keyValue, valueValue );
    }
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.