protected V getDefaultValue() { if (defaultValue != null) { return valueSerializer.copy(defaultValue); } else { return null; } }
@Override public void copy(DataInputView source, DataOutputView target) throws IOException { for (int i = 0; i < arity; i++) { fieldSerializers[i].copy(source, target); } }
@Override public E next() { E next = source.next(); return serializer.copy(next); }
@Override public Map<K, V> copy(Map<K, V> from) { Map<K, V> newMap = new HashMap<>(from.size()); for (Map.Entry<K, V> entry : from.entrySet()) { K newKey = keySerializer.copy(entry.getKey()); V newValue = entry.getValue() == null ? null : valueSerializer.copy(entry.getValue()); newMap.put(newKey, newValue); } return newMap; }
@Override public void copy(DataInputView source, DataOutputView target) throws IOException { int len = fieldSerializers.length; // copy null mask readIntoAndCopyNullMask(len, source, target, nullMask); for (int i = 0; i < len; i++) { if (!nullMask[i]) { fieldSerializers[i].copy(source, target); } } }
@Override public void apply(K key, W window, Iterable<T> values, Collector<R> out) throws Exception { ACC result = accSerializer.copy(initialValue); for (T val: values) { result = foldFunction.fold(result, val); } wrappedFunction.apply(key, window, Collections.singletonList(result), out); }
@Override public void apply(W window, Iterable<T> values, Collector<R> out) throws Exception { ACC result = accSerializer.copy(initialValue); for (T val: values) { result = foldFunction.fold(result, val); } wrappedFunction.apply(window, Collections.singletonList(result), out); }
@Override public void process(K key, Context context, Iterable<T> values, Collector<R> out) throws Exception { ACC result = accSerializer.copy(initialValue); for (T val : values) { result = foldFunction.fold(result, val); } this.ctx.window = context.window(); this.ctx.context = context; windowFunction.process(key, ctx, Collections.singletonList(result), out); }
@Override public void process(final Context context, Iterable<T> values, Collector<R> out) throws Exception { ACC result = accSerializer.copy(initialValue); for (T val : values) { result = foldFunction.fold(result, val); } this.ctx.window = context.window(); this.ctx.context = context; windowFunction.process(ctx, Collections.singletonList(result), out); }
@Override public void copy(DataInputView source, DataOutputView target) throws IOException { target.writeByte(source.readByte()); eventIdSerializer.copy(source, target); StringValue.copyString(source, target); }
@Override public T copy(T from) { T target = instantiateRaw(); for (int i = 0; i < arity; i++) { Object copy = fieldSerializers[i].copy(from.getField(i)); target.setField(copy, i); } return target; }
@Override public void copy(DataInputView source, DataOutputView target) throws IOException { boolean isNull = source.readBoolean(); target.writeBoolean(isNull); if (isNull) { target.write(padding); } else { originalSerializer.copy(source, target); } }
@Override public void copy(DataInputView source, DataOutputView target) throws IOException { int len = source.readInt(); target.writeInt(len); for (int i = 0; i < len; i++) { boolean isNonNull = source.readBoolean(); target.writeBoolean(isNonNull); if (isNonNull) { componentSerializer.copy(source, target); } } }