@Override public final RowAnnotation createAnnotation() { return new RowAnnotationImpl(); }
@Override public void transferAnnotations(final RowAnnotation from, final RowAnnotation to) { final RowAnnotationImpl fromImpl = (RowAnnotationImpl) from; final RowAnnotationImpl toImpl = (RowAnnotationImpl) to; toImpl.incrementRowCount(fromImpl.getRowCount()); fromImpl.resetRowCount(); }
@Override public MarkRowsAnalyzerResult reduce(Collection<? extends MarkRowsAnalyzerResult> results) { InputColumn<?>[] highlightedColumns = null; final RowAnnotationImpl annotation = new RowAnnotationImpl(); for (MarkRowsAnalyzerResult result : results) { final int annotatedRowCount = result.getAnnotatedRowCount(); annotation.incrementRowCount(annotatedRowCount); if (highlightedColumns == null || highlightedColumns.length == 0) { highlightedColumns = result.getHighlightedColumns(); } } return new MarkRowsAnalyzerResult(annotation, null, highlightedColumns); }
@Override public void annotate(final InputRow row, final RowAnnotation annotation) { final RowAnnotationImpl annotationImpl = (RowAnnotationImpl) annotation; annotationImpl.incrementRowCount(1); }
@Override public void resetAnnotation(final RowAnnotation annotation) { final RowAnnotationImpl annotationImpl = (RowAnnotationImpl) annotation; annotationImpl.resetRowCount(); }
@Override public MarkRowsAnalyzerResult reduce(Collection<? extends MarkRowsAnalyzerResult> results) { InputColumn<?>[] highlightedColumns = null; final RowAnnotationImpl annotation = new RowAnnotationImpl(); for (MarkRowsAnalyzerResult result : results) { final int annotatedRowCount = result.getAnnotatedRowCount(); annotation.incrementRowCount(annotatedRowCount); if (highlightedColumns == null || highlightedColumns.length == 0) { highlightedColumns = result.getHighlightedColumns(); } } return new MarkRowsAnalyzerResult(annotation, null, highlightedColumns); }
public void run(final InputRow row, final String value, final int distinctCount) { if (value == null) { if (_recordAnnotations) { _annotationFactory.annotate(row, distinctCount, _nullValueAnnotation); } else { ((RowAnnotationImpl) _nullValueAnnotation).incrementRowCount(distinctCount); } } else { RowAnnotation annotation; synchronized (this) { annotation = _annotationMap.get(value); if (annotation == null) { if (_recordAnnotations) { annotation = _annotationFactory.createAnnotation(); } else { annotation = new RowAnnotationImpl(); } _annotationMap.put(value, annotation); } } if (_recordAnnotations) { _annotationFactory.annotate(row, distinctCount, annotation); } else { ((RowAnnotationImpl) annotation).incrementRowCount(distinctCount); } } _totalCount.addAndGet(distinctCount); }
public RowAnnotation getCategoryRowAnnotation(final String category) { final RowAnnotation annotation = _categories.get(category); if (annotation == null) { // return an empty annotation return new RowAnnotationImpl(); } return annotation; }
public ValueDistributionGroup(final String groupName, final RowAnnotationFactory annotationFactory, final boolean recordAnnotations, final InputColumn<?>[] inputColumns) { _groupName = groupName; _annotationFactory = annotationFactory; _recordAnnotations = recordAnnotations; _inputColumns = inputColumns; _totalCount = new AtomicInteger(); _annotationMap = new HashMap<>(); if (recordAnnotations) { _nullValueAnnotation = _annotationFactory.createAnnotation(); } else { _nullValueAnnotation = new RowAnnotationImpl(); } }
@Override public ReferentialIntegrityAnalyzerResult reduce( final Collection<? extends ReferentialIntegrityAnalyzerResult> partialResults) { if (partialResults.isEmpty()) { return null; } final RowAnnotation reducerAnnotation = new RowAnnotationImpl(); final InMemoryRowAnnotationFactory2 reducerAnnotationFactory = new InMemoryRowAnnotationFactory2(); InputColumn<?>[] highlightedColumns = null; for (final ReferentialIntegrityAnalyzerResult partialResult : partialResults) { final List<InputRow> partialRows = partialResult.getSampleRows(); for (final InputRow partialRow : partialRows) { reducerAnnotationFactory.annotate(partialRow, reducerAnnotation); } highlightedColumns = partialResult.getHighlightedColumns(); } return new ReferentialIntegrityAnalyzerResult(reducerAnnotation, reducerAnnotationFactory, highlightedColumns); }