You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "Corvin Deboeser (Jira)" <ji...@apache.org> on 2019/12/04 01:02:33 UTC
[jira] [Comment Edited] (BEAM-8884) Python MongoDBIO TypeError when
splitting
[ https://issues.apache.org/jira/browse/BEAM-8884?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16987394#comment-16987394 ]
Corvin Deboeser edited comment on BEAM-8884 at 12/4/19 1:00 AM:
----------------------------------------------------------------
Hi there, I found the issue.
When querying the split-vector from mongo in _get_split_keys, the function returns a list of dicts with the structure \{ _id: ObjectId(...) } . The split function in L165 the iterates through the list of dicts instead of a list if ObjectIds (at L174). This causes the min statement in L177 to fail.
Line numbers all refer to this file: [https://github.com/apache/beam/blob/b7fad128a710213267683f3ecf3f890c7a3b82d9/sdks/python/apache_beam/io/mongodbio.py]
I tried a local version and unpacked the list of dicts into a list of ObjectIds and that worked. Hope it helps!
was (Author: corvin):
Hi there, I found the issue.
When querying the split-vector from mongo in _get_split_keys, the function returns a list of dicts with the structure \{ _id: ObjectId(...) } . The split function in L165 the iterates through the list of dicts instead of a list if ObjectIds (at L174). This causes the min statement in L177 to fail.
I tried a local version and unpacked the list of dicts into a list of ObjectIds and that worked. Hope it helps!
> Python MongoDBIO TypeError when splitting
> -----------------------------------------
>
> Key: BEAM-8884
> URL: https://issues.apache.org/jira/browse/BEAM-8884
> Project: Beam
> Issue Type: Bug
> Components: sdk-py-core
> Reporter: Brian Hulette
> Assignee: Yichi Zhang
> Priority: Major
>
> From [slack|https://the-asf.slack.com/archives/CBDNLQZM1/p1575350991134000]:
> I am trying to run a pipeline (defined with the Python SDK) on Dataflow that uses beam.io.ReadFromMongoDB. When dealing with very small datasets (<10mb) it runs fine, when trying to run it with slightly larger datasets (70mb), I always get this error:
> {code:}
> TypeError: '<' not supported between instances of 'dict' and 'ObjectId'
> {code}
> Stack trace see below. Running it on a local machine works just fine. I would highly appreciate any pointers what this could be.
> I hope this is the right channel do address this.
> {code:}
> Traceback (most recent call last):
> File "/usr/local/lib/python3.7/site-packages/dataflow_worker/batchworker.py", line 649, in do_work
> work_executor.execute()
> File "/usr/local/lib/python3.7/site-packages/dataflow_worker/executor.py", line 218, in execute
> self._split_task)
> File "/usr/local/lib/python3.7/site-packages/dataflow_worker/executor.py", line 226, in _perform_source_split_considering_api_limits
> desired_bundle_size)
> File "/usr/local/lib/python3.7/site-packages/dataflow_worker/executor.py", line 263, in _perform_source_split
> for split in source.split(desired_bundle_size):
> File "/usr/local/lib/python3.7/site-packages/apache_beam/io/mongodbio.py", line 174, in split
> bundle_end = min(stop_position, split_key_id)
> TypeError: '<' not supported between instances of 'dict' and 'ObjectId'
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)