【问题标题】:Cannot execute appengine-mapreduce using DatastoreInput with query filters无法使用带有查询过滤器的 DatastoreInput 执行 appengine-mapreduce
【发布时间】:2014-12-09 13:29:28
【问题描述】:

当我尝试将数据存储查询与这样的过滤器一起使用时:

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

并尝试运行: 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();

我得到了这个例外:

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

其中“paidOn”是数据存储实体中具有日期值的属性。

这个 ewxample 与 [example] 中的非常相似:

所以我想我做错了什么,但我不知道,这是一个标准的数据存储查询。 有什么建议么?

【问题讨论】:

    标签: java google-app-engine mapreduce


    【解决方案1】:

    这是这一行中的一个错误:https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/master/java/src/main/java/com/google/appengine/tools/mapreduce/inputs/DatastoreShardStrategy.java#L386 在修复之前,您可以通过提供两个边界(上限和下限)来避免该问题,或者通过将 item.get(0) 替换为 item.get(0).getProperty(propertyName) 自行修补它

    【讨论】:

    • 感谢您的回复,我会努力的
    • 它的修复已提交到 gitHub(但尚未推送到 maven)。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-25
    • 1970-01-01
    • 2016-07-17
    • 2014-07-19
    相关资源
    最近更新 更多