@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } GroupingInfo that = (GroupingInfo) o; return fields != null ? fields.equals(that.fields) : that.fields == null; }
private void cacheNCheckFields(RecordTranslator<K, V> translator) { for (String stream : translator.streams()) { Fields fromTrans = translator.getFieldsFor(stream); Fields cached = streamToFields.get(stream); if (cached != null && !fromTrans.equals(cached)) { throw new IllegalArgumentException("Stream " + stream + " currently has Fields of " + cached + " which is not the same as those being added in " + fromTrans); } if (cached == null) { streamToFields.put(stream, fromTrans); } } }
private boolean shouldPartitionByKey() { if (node.getParallelism() == 1) { return false; } /* * if the current processor preserves the key and is * already partitioned on key, skip the re-partition. */ if (node instanceof ProcessorNode) { ProcessorNode pn = (ProcessorNode) node; Fields fields = pn.getGroupingInfo() == null ? null : pn.getGroupingInfo().getFields(); if (pn.isPreservesKey() && fields != null && fields.equals(KEY)) { return false; } } return true; }
private void cacheNCheckFields(RecordTranslator<K, V> translator) { for (String stream : translator.streams()) { Fields fromTrans = translator.getFieldsFor(stream); Fields cached = streamToFields.get(stream); if (cached != null && !fromTrans.equals(cached)) { throw new IllegalArgumentException("Stream " + stream + " currently has Fields of " + cached + " which is not the same as those being added in " + fromTrans); } if (cached == null) { streamToFields.put(stream, fromTrans); } } }
final Fields getFields() { if (fields == null) { RecordTranslator<K, V> translator = kafkaSpoutConfig.getTranslator(); Fields fs = null; for (String stream : translator.streams()) { if (fs == null) { fs = translator.getFieldsFor(stream); } else { if (!fs.equals(translator.getFieldsFor(stream))) { throw new IllegalArgumentException("Trident Spouts do not support multiple output Fields"); } } } fields = fs; } LOG.debug("OutputFields = {}", fields); return fields; }