Package cascading.tuple

Examples of cascading.tuple.Tuple


    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


    treeSpec.setTree( tree );

    TreeFunction treeFunction = new TreeFunction( treeSpec );

    TupleEntry tupleArguments = new TupleEntry( expectedFields, new Tuple( 0d, 1d, 0d ) );

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

    assertEquals( new Tuple( "1" ), collector.entryIterator().next().getTuple() );
    }
View Full Code Here

    regressionSpec.addRegressionTable( table );

    PredictionRegressionFunction regressionFunction = new PredictionRegressionFunction( regressionSpec );

    TupleEntry tupleArguments = new TupleEntry( expectedFields, new Tuple( 5.1d, 3.8d, 1.6d, 0.2d ) );

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

    assertEquals( 1.0d, collector.entryIterator().next().getTuple().getDouble( 0 ), 0.00001d );
    }
View Full Code Here

    regressionSpec.addRegressionTable( regressionTable );

    PredictionRegressionFunction regressionFunction = new PredictionRegressionFunction( regressionSpec );

    TupleEntry tupleArguments = new TupleEntry( expectedFields, new Tuple( 3d, 1.3d, 0.2d, "setosa" ) );

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

    assertEquals( new Tuple( 4.70048473693065d ), collector.entryIterator().next().getTuple() );
    }
View Full Code Here

    }

    CategoricalRegressionFunction regressionFunction = new CategoricalRegressionFunction( regressionSpec );

    {
    TupleEntry tupleArguments = new TupleEntry( expectedFields, new Tuple( 7d, 3.2d, 4.7d, 1.4d ) );

    TupleListCollector collector = invokeFunction( regressionFunction, tupleArguments, modelSchema.getDeclaredFields() );

    assertEquals( "versicolor", collector.entryIterator().next().getTuple().getObject( 0 ) );
    }

    {
    TupleEntry tupleArguments = new TupleEntry( expectedFields, new Tuple( 5.8d, 4d, 1.2d, 0.2d ) );

    TupleListCollector collector = invokeFunction( regressionFunction, tupleArguments, modelSchema.getDeclaredFields() );

    assertEquals( "setosa", collector.entryIterator().next().getTuple().getObject( 0 ) );
    }
View Full Code Here

    expectedFields = Fields.NONE
      .append( new Fields( "var0", double.class ) )
      .append( new Fields( "var1", String.class ) )
      .append( new Fields( "var2", double.class ) );

    Tuple tuple = new Tuple( 0.d, "value", null );

    tupleEntry = new TupleEntry( expectedFields, tuple );
    }
View Full Code Here

  public void sink( TupleEntry tupleEntry, OutputCollector outputCollector ) throws IOException
    {
    if( updateBy != null )
      {
      Tuple allValues = tupleEntry.selectTuple( updateValueFields );
      Tuple updateValues = tupleEntry.selectTuple( updateByFields );

      allValues = cleanTuple( allValues );

      TupleRecord key = new TupleRecord( allValues );

      if( updateValues.equals( updateIfTuple ) )
        outputCollector.collect( key, null );
      else
        outputCollector.collect( key, key );

      return;
      }

    Tuple result = tupleEntry.selectTuple( getSinkFields() );

    result = cleanTuple( result );

    outputCollector.collect( new TupleRecord( result ), null );
    }
View Full Code Here

      statement.setObject( i + 1, tuple.get( i ) );
    }

  public void readFields( ResultSet resultSet ) throws SQLException
    {
    tuple = new Tuple();

    for( int i = 0; i < resultSet.getMetaData().getColumnCount(); i++ )
      tuple.add( (Comparable) resultSet.getObject( i + 1 ) );
    }
View Full Code Here

public class Split extends CascalogFunction {
  public void operate(FlowProcess flowProcess, FunctionCall fnCall) {
    String sentence = fnCall.getArguments().getString(0);
    for (String word : sentence.split(" ")) {
      fnCall.getOutputCollector().add(new Tuple(word));
    }
  }
View Full Code Here

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

        if (!result)
            return false;

        sourceCall.getIncomingEntry().setTuple(new Tuple(key.toString(), value));
        return true;
    }
View Full Code Here

TOP

Related Classes of cascading.tuple.Tuple

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.