Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot execute appengine-mapreduce using DatastoreInput with query filters

when I try to use datastore Query with a filter like this :

Query billQuery = new Query("Bill"); billQuery.setFilter(new Query.FilterPredicate("payedOn", Query.FilterOperator.GREATER_THAN, new Date()));

and trying to run : new MapReduceSpecification.Builder, List>>>(new DatastoreInput(billQuery, mapShardCount), new SimpleCounter("BillID"), new CountReducer(), new InMemoryOutput>()) .setKeyMarshaller(Marshallers.getStringMarshaller()) .setValueMarshaller(Marshallers.getLongMarshaller()) .setJobName("MapReduceTest count") .setNumReducers(reduceShardCount) .build();

I get this exception :

java.lang.IllegalArgumentException: payedOn: com.google.appengine.api.datastore.Entity is not a supported property type.

where 'paidOn' is property with Date value in a datastore entity.

This ewxample is very similar to that in the [example] :

so I guess I'm doing something wrong, but I have no idea, it is a standard datastore query. Any suggestions?

like image 698
mlesikov Avatar asked Sep 16 '26 07:09

mlesikov


1 Answers

This is a bug in this line: https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/master/java/src/main/java/com/google/appengine/tools/mapreduce/inputs/DatastoreShardStrategy.java#L386 Until fixed, you could avoid the issue by supplying both bounds (upper and lower) or patch it yourself by replacing item.get(0) with item.get(0).getProperty(propertyName)

like image 58
ozarov Avatar answered Sep 17 '26 22:09

ozarov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!