Skip to content

Commit

Permalink
Add VtlConfiguration parameter to force sorting after each operation
Browse files Browse the repository at this point in the history
  • Loading branch information
hadrienk committed Dec 11, 2018
1 parent 73e3e43 commit 08f75ad
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Expand Up @@ -6,9 +6,9 @@ public class VtlConfiguration {

private boolean filterOptimization = true;
private boolean filterPropagation = true;

private boolean profiling = true;
private boolean sortAssert = true;
private boolean sortAssert = false;
private boolean forceSort = true;

public static VtlConfiguration getConfig() {
VtlConfiguration configuration = localConfiguration.get();
Expand Down Expand Up @@ -56,4 +56,7 @@ public boolean isSortAssertionEnabled() {
return sortAssert;
}

public boolean isForceSortEnabled() {
return forceSort;
}
}
Expand Up @@ -197,7 +197,7 @@ Stream<DataPoint> decorateStream(Stream<DataPoint> stream) {
}

// Post ordering
if (!requestedOrdering.equals(actualOrdering)) {
if (configuration.isForceSortEnabled() || !requestedOrdering.equals(actualOrdering)) {
stream = stream.sorted(requestedOrdering);
if (configuration.isProfilingEnabled()) {
stream = measureStartStream(
Expand All @@ -209,7 +209,7 @@ Stream<DataPoint> decorateStream(Stream<DataPoint> stream) {
}

// Order assertion
if (configuration.isProfilingEnabled()) {
if (configuration.isSortAssertionEnabled()) {
AtomicReference<DataPoint> previous = new AtomicReference<>();
stream = stream.peek(dataPoint -> {
if (previous.get() != null) {
Expand All @@ -235,7 +235,7 @@ Stream<DataPoint> decorateStream(Stream<DataPoint> stream) {
});
}

if (statistics != null) {
if (configuration.isProfilingEnabled()) {
stream = stream.peek(dataPoint -> {
statistics.rows.increment();
statistics.cells.increment(dataPoint.size());
Expand Down

0 comments on commit 08f75ad

Please sign in to comment.