通过 Apache Drill 执行 Mongo 地理空间查询

Execute Mongo geospatial queries through Apache Drill

我们有一个关于 MongoDB 和 Drill 通过 Mongo 存储插件集成的问题;我们需要使用 MongoDB 地理空间函数通过 Drill 查询和执行地理空间查询。这意味着我们在 Mongo 中有数据并且使用 Drill 我们需要调用那些 Mongo 函数。 例如,假设我们在 Mongo 中有一个区域集合,其中包含区域信息,包括 geojson。直接在 Mongo 中我们可以使用 $geoIntersects Mongo 函数执行以下查询(找到与特定点相交的区域)并获得成功结果:

db.getCollection('zones').find({ geom: { $geoIntersects: { $geometry: { type: "Point", coordinates: [ -73.93414657, 40.82302903 ] } } } })

主要问题:

是否可以在 Drill 中使用 Mongo 地理空间查询运算符,我们该怎么做?

此外,如果我们想执行与上述相同的查询但使用 Drill,这可能吗?如果是,我们该怎么做?

感谢您的帮助!

Apache Drill 的 Mongo 存储插件充当 Mongo 客户端的外观,此外观不支持底层 Mongo 客户端的所有功能。不支持 $geoIntersects$geometry 运算符或换句话说; Apache Drill 的 Mongo 存储插件不知道这些运算符。

original documentation for Apache Drill's Mongo storage plugin 表示:

As of now, predicate pushdown is implemented for the following filters: >, >=, <, <=, ==, !=, isNull and isNotNull.

看看 latest version of the code 情况仍然如此。

所以,这个问题的答案...

Is it possible to use Mongo geospatial query operators in Drill ?

... 是:。 Apache Drill 的 Mongo 存储插件仅支持以下查询运算符:>, >=, <, <=, ==, !=, isNull and isNotNull

以及这个问题的答案...

Also, if we want to execute the same query described above but using Drill, is that possible?

... 是 。请记住,Apache Drill 的 Mongo 存储插件正试图通过文档存储提供 SQL 式的查询功能,而 $geoIntersects$geometry 等地理空间查询运算符没有SQL 中常见且易于理解的等价物。

很遗憾,上面的回复中没有给您带来好消息:( 我认为您的选择是

  • 自己实现这些。 this issue 附带了一个补丁,它可能会提供一些关于如何在 Apache Drill 的 Mongo 存储插件
  • 中实现新查询运算符的指导
  • 针对指定 Component=Storage - MongoDB
  • Drill project 提出问题