Examples of TupleEntry


Examples of cascading.tuple.TupleEntry

    super( 2, fieldDeclaration );
    }

  public void operate( FlowProcess flowProcess, FunctionCall functionCall )
    {
    TupleEntry argument = functionCall.getArguments();
    String doc_id = argument.getString( 0 );
    String token = scrubText( argument.getString( 1 ) );

    if( token.length() > 0 )
      {
      Tuple result = new Tuple();
      result.add( doc_id );
View Full Code Here

Examples of cascading.tuple.TupleEntry

  public List<TupleEntry> getOutput(Flow flow) throws Exception {
    TupleEntryIterator output = flow.openSink();

    List<TupleEntry> result = new ArrayList<TupleEntry>();
    while (output.hasNext()) {
      TupleEntry e = output.next();
      // We have to make a copy of the TupleEntry here -- otherwise cascading
      // will overwrite its values somewhere deep in its innards.
      result.add(new TupleEntry(e));
    }
    return result;
  }
View Full Code Here

Examples of cascading.tuple.TupleEntry

        public Add1() {
            super(new Fields("result"));
        }

        public void operate(FlowProcess fp, FunctionCall fc) {
            TupleEntry t = fc.getArguments();
            String res = new String(Utils.getBytes((BytesWritable) t.get(0))) + "1";
            fc.getOutputCollector().add(new Tuple(new BytesWritable(res.getBytes())));
        }
View Full Code Here

Examples of cascading.tuple.TupleEntry

  }

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

    byte[] key = (byte[]) tupleEntry.getObject(0);
    byte[] val = (byte[]) tupleEntry.getObject(1);

    sinkCall.getOutput().collect(new BytesWritable(key), new BytesWritable(val));
  }
View Full Code Here

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

Examples of cascading.tuple.TupleEntry

    }

  @Override
  public void operate( FlowProcess flowProcess, FunctionCall<Context<DecisionContext>> functionCall )
    {
    TupleEntry arguments = functionCall.getArguments();

    String[] categories = functionCall.getContext().payload.categories;
    int[] results = functionCall.getContext().payload.results;

    Arrays.fill( results, 0 ); // clear before use
View Full Code Here

Examples of cascading.tuple.TupleEntry

    Iterator<TupleEntry> iterator = bufferCall.getArgumentsIterator();
    int count = 0;

    while( iterator.hasNext() )
      {
      TupleEntry next = iterator.next();
      Double score = next.getDouble( 0 );

      results[ count++ ] += score;
      }

    double prediction = selection.predict( results );
View Full Code Here

Examples of cascading.tuple.TupleEntry

    Iterator<TupleEntry> iterator = bufferCall.getArgumentsIterator();

    while( iterator.hasNext() )
      {
      TupleEntry next = iterator.next();
      Integer category = (Integer) next.getObject( 0 );

      results[ category ] += 1;
      }

    int index = selection.select( results );
View Full Code Here

Examples of cascading.tuple.TupleEntry

    }

  @Override
  public void operate( FlowProcess flowProcess, FunctionCall<Context<BaseRegressionFunction.ExpressionContext>> functionCall )
    {
    TupleEntry arguments = functionCall.getArguments();
    ExpressionEvaluator[] expressions = functionCall.getContext().payload.expressions;
    double[] results = functionCall.getContext().payload.results;

    for( int i = 0; i < expressions.length; i++ )
      results[ i ] = expressions[ i ].calculate( arguments );
View Full Code Here

Examples of cascading.tuple.TupleEntry

    clusteringSpec.addCluster( new Cluster( "3", 6.85277777777778d, 3.075d, 5.78611111111111d, 2.09722222222222d ) );

    ClusteringFunction clusteringFunction = new ClusteringFunction( clusteringSpec );

//    TupleEntry tupleArguments = new TupleEntry( expectedFields, new Tuple( 6.9d, 3.1d, 4.9d, 1.5d ) );
    TupleEntry tupleArguments = new TupleEntry( expectedFields, new Tuple( 6.4d, 3.1d, 5.5d, 1.8d ) );

    TupleListCollector collector = invokeFunction( clusteringFunction, tupleArguments, predictedFields );

//    assertEquals( new Tuple( "2" ), collector.entryIterator().next().getTuple() );
    assertEquals( new Tuple( "3" ), collector.entryIterator().next().getTuple() );
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.