You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "Daniel Oliveira (Jira)" <ji...@apache.org> on 2021/06/09 03:19:00 UTC

[jira] [Created] (BEAM-12466) Add documentation and improved errors for QueryFn in MongoDbIO

Daniel Oliveira created BEAM-12466:
--------------------------------------

             Summary: Add documentation and improved errors for QueryFn in MongoDbIO
                 Key: BEAM-12466
                 URL: https://issues.apache.org/jira/browse/BEAM-12466
             Project: Beam
          Issue Type: Bug
          Components: io-java-mongodb
            Reporter: Daniel Oliveira


Currently the MongoDbIO.Read implementation assumes that the submitted QueryFn is one of the predefined QueryFns in Beam, so either an AggregationQuery or FindQuery. The problem is this assumption is not documented anywhere.

Fixing this consists of two small changes:

1. Add documentation to the [withQueryFn|https://github.com/apache/beam/blob/release-2.31.0/sdks/java/io/mongodb/src/main/java/org/apache/beam/sdk/io/mongodb/MongoDbIO.java#L279] method specifying that the QueryFn must be one of the predefined classes in the MongoDbIO package.

2. In the [split method|https://github.com/apache/beam/blob/release-2.31.0/sdks/java/io/mongodb/src/main/java/org/apache/beam/sdk/io/mongodb/MongoDbIO.java#L435], the code checks if the QueryFn is a FindQuery, and if not assumes it's an AggregationQuery, meaning that users that input their own class will find it failing to cast to an AggregationQuery. Instead, there should be an error if the QueryFn is an unknown type, preferably instructing users to only use one of the predefined QueryFn types.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)