trinodb / trino-python-client

Python client for Trino
Apache License 2.0
309 stars 151 forks source link

Get error Query already begun when query #290

Closed ElapsedSoul closed 1 year ago

ElapsedSoul commented 1 year ago

Expected behavior

work well

Actual behavior

It seems get the same case in python client.

      File "/tmp/dolphinscheduler/exec/process/82/1442/6451842/18620689/py_1442_6451842_18620689.command", line 70, in Conca_X
        X=cur.fetchall()
      File "/opt/applications/conda/lib/python3.9/site-packages/trino/dbapi.py", line 558, in fetchall
        return list(self.genall())
      File "/opt/applications/conda/lib/python3.9/site-packages/trino/client.py", line 509, in __iter__
        rows = self._query.fetch()
      File "/opt/applications/conda/lib/python3.9/site-packages/trino/client.py", line 677, in fetch
        status = self._request.process(response)
      File "/opt/applications/conda/lib/python3.9/site-packages/trino/client.py", line 440, in process
        raise self._process_error(response["error"], response.get("id"))
    trino.exceptions.TrinoQueryError: TrinoQueryError(type=INTERNAL_ERROR, name=GENERIC_INTERNAL_ERROR, message="Query already begun: Optional[20220712_234817_33615_a6hf9] while starting query 20220712_234819_33617_a6hf9", query_id=20220712_234819_33617_a6hf9)

Steps To Reproduce

work as issue

Log output

No response

Operating System

centos7.5

Trino Python client version

0.313.0

Trino Server version

385

Python version

3.9

Are you willing to submit PR?

mdesmet commented 1 year ago

Hi @ElapsedSoul,

I failed to reproduce your issue. The error might be related to using the Hive connector (and transactions potentially), could you give us some code that demonstrates the issue and explain your exact hive setup?

The error seems to come from https://github.com/trinodb/trino/blob/d23a081298e0f26ad8f6b98f1eebe418389b0452/plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/SemiTransactionalHiveMetastore.java#L1384

hashhar commented 1 year ago

@ElapsedSoul Feel free to re-open if this is still a issue. If you have been to solve it it'd be helpful for future visitors if you can leave a comment about what the solution was.