Github user revans2 commented on a diff in the pull request: https://github.com/apache/storm/pull/2502#discussion_r159967636 --- Diff: storm-client/src/jvm/org/apache/storm/tuple/TupleImpl.java --- @@ -24,50 +24,46 @@ import org.apache.storm.task.GeneralTopologyContext; public class TupleImpl implements Tuple { - private final List<Object> values; - private final int taskId; - private final String streamId; - private final GeneralTopologyContext context; - private final MessageId id; + private List<Object> values; + private int taskId; + private String streamId; + private GeneralTopologyContext context; + private MessageId id; + private final String srcComponent; private Long _processSampleStartTime; private Long _executeSampleStartTime; private long _outAckVal = 0; - + public TupleImpl(Tuple t) { this.values = t.getValues(); this.taskId = t.getSourceTask(); this.streamId = t.getSourceStreamId(); this.id = t.getMessageId(); this.context = t.getContext(); - if (t instanceof TupleImpl) { + this.srcComponent = t.getSourceComponent(); + try { TupleImpl ti = (TupleImpl) t; this._processSampleStartTime = ti._processSampleStartTime; this._executeSampleStartTime = ti._executeSampleStartTime; this._outAckVal = ti._outAckVal; + } catch (ClassCastException e) { + // ignore ... if t is not a TupleImpl type .. faster than checking and then casting } } - public TupleImpl(GeneralTopologyContext context, List<Object> values, int taskId, String streamId, MessageId id) { + public TupleImpl(GeneralTopologyContext context, List<Object> values, String srcComponent, int taskId, String streamId, MessageId id) { this.values = Collections.unmodifiableList(values); this.taskId = taskId; this.streamId = streamId; this.id = id; this.context = context; - - String componentId = context.getComponentId(taskId); - Fields schema = context.getComponentOutputFields(componentId, streamId); - if(values.size()!=schema.size()) { - throw new IllegalArgumentException( - "Tuple created with wrong number of fields. " + - "Expected " + schema.size() + " fields but got " + - values.size() + " fields"); - } --- End diff -- I know this slows things down, but it is a good sanity check. Would it be possible to have a way to configure this on? Like in local mode? We would have to cache it though because just checking the conf might be as long as doing this check.
---