trinodb / trino

Official repository of Trino, the distributed SQL query engine for big data, formerly known as PrestoSQL (https://trino.io)
https://trino.io
Apache License 2.0
9.7k stars 2.81k forks source link

MongoDB DBRef pushdown #21739

Open nsaje opened 1 month ago

nsaje commented 1 month ago

I don't think it's currently possible to efficiently filter by a DBRef field.

While dereference pushdown is supported it is explicitly blocked for DBRef fields.

Why is it blocked? Is the only missing piece giving special treatment to filter transformation? AFAICT a filter like mycollection.id = 'abc' should get translated into {"mycollection.$id": "abc"} and it should work.

cc @ebyhr @Praveen2112

nsaje commented 1 month ago

Would it be enough to alter MongoColumnHandle.getQualifiedName to prefix dereference names with a $ sign if this.dbRefField==true?

If so I'd be happy to prepare a PR.

ebyhr commented 1 month ago

I don't remember the context.

@krvikash Do you remember why we disallowed it?

nsaje commented 3 weeks ago

@krvikash ping - would really like to get to the bottom of this before I dive into preparing a PR, thanks!