@Override public Clip getResult() { Clip result = super.getResult(); result.getRecords().forEach(this::splitFields); return result; }
private Clip postAggregate(Clip clip) { if (postStrategies == null) { return clip; } for (PostStrategy postStrategy : postStrategies) { clip = postStrategy.execute(clip); } for (String field : transientFields.keySet()) { clip.getRecords().forEach(record -> record.remove(field)); } return clip; }
@Override public Clip getResult() { Clip result = super.getResult(); renameFields(result.getRecords()); return result; }
@Override public Clip getResult() { Clip result = super.getResult(); renameInPlace(result.getRecords()); return result; }
/** * Adds all the {@link BulletRecord} and the {@link Meta} from the given {@link Clip} to this. * * @param clip The clip to add. * @return This Clip for chaining. */ public Clip add(Clip clip) { if (clip != null) { add(clip.getMeta()); add(clip.getRecords()); } return this; }
/** * Returns the {@link List} of {@link BulletRecord} result so far. See {@link #getResult()} for the full result * with metadata. * * @return The records that are part of the result. */ @Override public List<BulletRecord> getRecords() { try { incrementRate(); Clip result = new Clip(); result.add(window.getRecords()); result = postAggregate(result); return result.getRecords(); } catch (RuntimeException e) { log.error("Unable to get serialized result for query {}", this); return null; } }
@Override public Clip execute(Clip clip) { List<BulletRecord> records = clip.getRecords(); records.sort((a, b) -> { for (OrderBy.SortItem sortItem : orderBy.getFields()) { TypedObject typedObjectA = extractTypedObject(sortItem.getField(), a); TypedObject typedObjectB = extractTypedObject(sortItem.getField(), b); try { int compareValue = typedObjectA.compareTo(typedObjectB); if (compareValue != 0) { return (sortItem.getDirection() == OrderBy.Direction.ASC ? 1 : -1) * compareValue; } } catch (RuntimeException e) { // Ignore the exception and skip this field. log.error("Unable to compare field " + sortItem.getField()); log.error("Skip it due to: " + e); } } return 0; }); return clip; }
@Override public Clip execute(Clip clip) { clip.getRecords().forEach(r -> { try { TypedObject result = calculate(computation.getExpression(), r);