Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
package de.ii.xtraplatform.features.sql.app;

import com.google.common.collect.ImmutableSet;
import de.ii.xtraplatform.features.domain.Decoder;
import de.ii.xtraplatform.features.domain.DecoderFactory;
import de.ii.xtraplatform.features.domain.FeatureEventHandler;
Expand Down Expand Up @@ -34,6 +35,7 @@
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -46,7 +48,7 @@ public class FeatureDecoderSql

private final Map<String, SchemaMapping> mappings;
private final Query query;
private final List<List<String>> mainTablePaths;
private final Set<List<String>> mainTablePaths;
private final FeatureStoreMultiplicityTracker multiplicityTracker;
private final boolean isSingleFeature;
private final Map<String, DecoderFactory> subDecoderFactories;
Expand Down Expand Up @@ -79,7 +81,9 @@ public FeatureDecoderSql(
this.wkbDialect = wkbDialect;

this.mainTablePaths =
sqlQueryMappings.stream().map(s -> s.getMainTable().getFullPath()).toList();
sqlQueryMappings.stream()
.map(s -> s.getMainTable().getFullPath())
.collect(ImmutableSet.toImmutableSet());
List<List<String>> multiTables =
sqlQueryMappings.stream()
.flatMap(s -> s.getTables().stream())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -25,7 +26,9 @@ public class NestingTracker {

private final FeatureEventHandler<?, ?, ModifiableContext<?, ?>> downstream;
private final ModifiableContext<?, ?> context;
private final List<List<String>> mainPaths;
// a Set so the per-value isNotMain() membership test is O(1) instead of a linear scan of
// List<List<String>> with element-wise list equality
private final Set<List<String>> mainPaths;
private final boolean flattenObjects;
private final boolean flattenArrays;
private final List<String> nestingStack;
Expand All @@ -36,7 +39,7 @@ public class NestingTracker {
public <T extends ModifiableContext<?, ?>> NestingTracker(
FeatureEventHandler<?, ?, T> downstream,
T context,
List<List<String>> mainPaths,
Set<List<String>> mainPaths,
boolean flattenObjects,
boolean flattenArrays,
boolean skippable) {
Expand Down
Loading