Skip to content

Incorrect Feature count on WFS Queries from HBase #1365

@worky68

Description

@worky68

We have created an HBase Datastore in Geoserver using the GeoWave plugin. We then make requests using the WFS service in Geoserver to this Datastore. Inside of this Datastore we have ingested a number of SimpleFeatures with row visibility set. In addition, we have our own implementation of AuthorizationSPI that we use to filter results.

Expected Behavior

We expect the WFS numOfFeatures attribute to reflect the number of features returned with the current response.

Actual Behavior

The WFS numOfFeatures attribute reflects the total number of features within the Datastore regardless of the authorizations provided. However, the features returned in the resulting featurecollection are correct in terms of the authorizations provided.

Workaround

The problem seems to stem from two places within the code that prefer a cached count over the actual count. As a workaround to the issue, we have removed the code below.

if (query.getFilter().equals(
Filter.INCLUDE)) {
// GEOWAVE-60 optimization
final Map<ByteArrayId, DataStatistics<SimpleFeature>> statsMap = reader
.getTransaction()
.getDataStatistics();
if (statsMap.containsKey(CountDataStatistics.STATS_TYPE)) {
final CountDataStatistics stats = (CountDataStatistics) statsMap.get(CountDataStatistics.STATS_TYPE);
if ((stats != null) && stats.isSet()) {
return (int) stats.getCount();
}
}
}
else if (query.getFilter().equals(
Filter.EXCLUDE)) {
return 0;
}

final Map<ByteArrayId, DataStatistics<SimpleFeature>> stats = new GeoWaveEmptyTransaction(
components).getDataStatistics();
final DataStatistics<SimpleFeature> countStats = stats.get(CountDataStatistics.STATS_TYPE);
if ((countStats != null) && query.getFilter().equals(
Filter.INCLUDE)) {
return (int) ((CountDataStatistics) countStats).getCount();
}

After removing the code we are now receiving the proper count on our queries. Of course, sacrificing some efficiency.

Specifications

  • Version: 0.9.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions