static Tuple coerceToString(SinkCall<?, ?> sinkCall) { TupleEntry entry = sinkCall.getOutgoingEntry(); Fields fields = entry.getFields(); Tuple tuple = entry.getTuple(); if (fields.hasTypes()) { Type types[] = new Type[fields.size()]; for (int index = 0; index < fields.size(); index++) { Type type = fields.getType(index); if (type instanceof CoercibleType<?>) { types[index] = String.class; } else { types[index] = type; } } tuple = entry.getCoercedTuple(types); } return tuple; } }
protected Tuple toNextTuple() { TupleEntry entry = iterator.next(); return entry.getCoercedTuple( types ); }
/** * Method getCoercedTuple is a helper method for copying the current tuple elements into a new Tuple, * of the same size, as the requested coerced types. * * @param types of type Type[] * @return returns the a new Tuple instance with coerced values */ public Tuple getCoercedTuple( Type[] types ) { return getCoercedTuple( types, Tuple.size( types.length ) ); }
static Tuple coerceToString(SinkCall<?, ?> sinkCall) { TupleEntry entry = sinkCall.getOutgoingEntry(); Fields fields = entry.getFields(); Tuple tuple = entry.getTuple(); if (fields.hasTypes()) { Type types[] = new Type[fields.size()]; for (int index = 0; index < fields.size(); index++) { Type type = fields.getType(index); if (type instanceof CoercibleType<?>) { types[index] = String.class; } else { types[index] = type; } } tuple = entry.getCoercedTuple(types); } return tuple; } }
@Override public void prepare( FlowProcess flowProcess, OperationCall<Functor> operationCall ) { Functor functor; if( types != null ) { Tuple result = Tuple.size( types.length ); functor = functionCall -> { TupleEntryCollector outputCollector = functionCall.getOutputCollector(); outputCollector.add( functionCall.getArguments().getCoercedTuple( types, result ) ); }; } else { functor = functionCall -> { TupleEntryCollector outputCollector = functionCall.getOutputCollector(); outputCollector.add( functionCall.getArguments().getTuple() ); }; operationCall.setContext( functor ); } operationCall.setContext( functor ); }
result = tupleEntry.getCoercedTuple( fields.getTypes() ); else result = tupleEntry.getTuple();