Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [geowave-dev] No results with cqlfilter

Hey Derek,
I´m sorry for the long response time. My EventBaseCode is a String.
Here is the query which causes the empty results:

/**
     * find events which are from type "empathic comment" (eventbasecode 018)
     * which took place during christmas (1979-2014).
     */
    private static Iterator<SimpleFeature> getResultsForQuery7(
            VectorDataStore dataStore,
            AccumuloAdapterStore adapterStore ) {

        Iterator<SimpleFeature> results = null;

        ArrayList<TemporalRange> christmasTemporalRangeList = new ArrayList<TemporalRange>();

        DateFormat df = new SimpleDateFormat(
                "yyyy-MM-dd");
        int year = 1979;
        do {
            try {
                Date start = df.parse(year + "-12-24");
                Date end = df.parse(year + "-12-26");
                TemporalRange temporalRange = new TemporalRange(
                        start,
                        end);
                christmasTemporalRangeList.add(temporalRange);
                year++;
            }
            catch (java.text.ParseException e) {
                e.printStackTrace();
            }
        }
        while (year < 2015);

        TemporalConstraints tempConstraints = new TemporalConstraints(
                christmasTemporalRangeList,
                "christmas");

        Filter eventFilter = null;
        try {
            eventFilter = CQL.toFilter("EventBaseCode = '018'");
        }
        catch (CQLException e) {
            e.printStackTrace();
        }

        FeatureDataAdapter adapter = (FeatureDataAdapter) adapterStore.getAdapter(new ByteArrayId(
                "geowave-gdelt"));

        TemporalQuery query = new TemporalQuery(
                tempConstraints);
       
        results = dataStore.query(
                adapter,
                INDEX,
                query,
                eventFilter,
                Integer.MAX_VALUE);

        return results;
    }

Do you see any problems in there? Another question: In some methods I can define queryOptions for getting only a subset of the attributes. What do I have to do when using
dataStore.query(adapter, INDEX, query, eventFilter, Integer.MAX_VALUE)? There is no queryOption parameter. Is it possible to express it via ECQL (similar to a select-statement in SQL)?

Best regards,
Marcel Jacob.


Am 29.10.2015 15:26, schrieb Derek Yeager:
Hi Marcel,

I would like to help you debug this issue.  Is the property "EventBaseCode" of type String or Integer?  You may find it easier to define your filter using the static CQL.toFilter() method.  For example:
  • CQL.toFilter("EventBaseCode = 18")  --> if EventBaseCode is an Integer
  • CQL.toFilter("EventBaseCode = '018'") --> if EventBaseCode is a String
The two query methods you are using are defined in different data store implementations (VectorDataStore vs. AccumuloDataStore) and follow different query paths under the covers in GeoWave.  I want to replicate the issue you are seeing so that I can properly debug it, but in order to do so I prefer to make as few assumptions as possible.  Would you mind sharing more code, the entire class if possible?

Thanks,
Derek

On Wed, Oct 28, 2015 at 1:11 PM, Marcel Jacob <m.jacob@xxxxxxxxxxx> wrote:
Hello,
I wrote a query which works fine with the following method:
datastore.query(INDEX, query, queryOptions);
When adding some cql-constraints the query also runs successfully using
the following method:
datastore.query(adapter, INDEX, query, eventFilter, Integer.MAX_VALUE);
But my result file is empty! I know that there have to be at least 3
results.
Version: 0.89-Snapshot.

Here is a code snippet for defining a filter and the adapter:

FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
         Filter eventFilter = ff.equal(
                 ff.property("EventBaseCode"),
                 ff.literal("018"),
                 false);

FeatureDataAdapter adapter = (FeatureDataAdapter)
adapterStore.getAdapter(new ByteArrayId(
                 "geowave-gdelt"));

The property "EventBaseCode" and my adapter "geowave-gdelt" exists.
What could be the problem?
Is there another method for executing a query using a cqlfilter?

Best regards,
Marcel Jacob.
_______________________________________________
geowave-dev mailing list
geowave-dev@xxxxxxxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.locationtech.org/mailman/listinfo/geowave-dev



_______________________________________________
geowave-dev mailing list
geowave-dev@xxxxxxxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.locationtech.org/mailman/listinfo/geowave-dev


Back to the top