Skip to content

Commit

Permalink
Fixing distinct lookup when cottontail returns null (#321)
Browse files Browse the repository at this point in the history
  • Loading branch information
silvanheller authored Jul 6, 2022
1 parent 51d5ec6 commit 01738de
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.vitrivr.cineast.api.messages.result.DistinctElementsResult;
import org.vitrivr.cineast.api.rest.handlers.interfaces.ParsingPostRestHandler;
import org.vitrivr.cineast.core.data.providers.primitive.PrimitiveTypeProvider;
import org.vitrivr.cineast.core.data.providers.primitive.ProviderDataType;
import org.vitrivr.cineast.core.db.DBSelector;
import org.vitrivr.cineast.standalone.config.Config;

Expand Down Expand Up @@ -48,7 +49,7 @@ public DistinctElementsResult performPost(ColumnSpecification specification, Con
}
StopWatch watch = StopWatch.createStarted();
selector.open(specification.table());
distinct = selector.getUniqueValues(specification.column()).stream().map(PrimitiveTypeProvider::getString).collect(Collectors.toList());
distinct = selector.getUniqueValues(specification.column()).stream().filter(p -> p.getType() != ProviderDataType.UNKNOWN).map(PrimitiveTypeProvider::getString).collect(Collectors.toList());
cache.put(specification.table() + specification.column(), distinct);
LOGGER.trace("Retrieved unique values for {} in {} ms", specification.table() + "." + specification.column(), watch.getTime(TimeUnit.MILLISECONDS));
return new DistinctElementsResult("", distinct);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ public String toString() {
return "NothingProvider";
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
public interface StringProvider {

default String getString() {
throw new UnsupportedOperationException("No string value specified");
throw new UnsupportedOperationException("No string value specified: " + this);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public List<ScoreElement> getSimilar(SegmentContainer sc, ReadableQueryConfig qc

if (relevantExpressions.isEmpty()) {
LOGGER.debug("No relevant expressions in {} for query {}", this.getClass().getSimpleName(), sc.toString());
LOGGER.debug("In this class: {}, {}", this.getSupportedOperators(), this.getAttributes());
return Collections.emptyList();
}

Expand Down

0 comments on commit 01738de

Please sign in to comment.