[ 
https://issues.apache.org/jira/browse/IMPALA-14920?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18076006#comment-18076006
 ] 

Quanlong Huang commented on IMPALA-14920:
-----------------------------------------

The start_time is captured after the statement is submitted. Though the 
statement itself takes longer than 80ms (alltypestiny has 8 rows), the time 
difference between end_time and start_time could be less than 80ms.
{code:python}
    statement = "SELECT count(sleep(10)) from functional.alltypestiny"
    execute_statement_resp = self.execute_statement(statement)

    start_time = time.time()  # <---- At this point, the query might already be 
running
    get_operation_status_resp = \
        self.get_operation_status(execute_statement_resp.operationHandle)
    end_time = time.time()
    ...
    time_diff = end_time - start_time
    assert time_diff < 1
    # This should take at least 80ms, because that is the amount of time the 
query
    # should sleep
    assert time_diff >= 0.08{code}
I think we can remove the assertion on "time_diff >= 0.08". Checking "time_diff 
< 1" already verifies GetOperationStatus returns immediately after the query 
state becomes FINISHED.

On the other hand, FINISHED just means "Rows available" for the client to 
fetch. It doesn't guarantee all results are ready. Since the table has 4 files 
in 4 partitions, there are 4 scanner threads. The first GetNext() on the scan 
node just returns results of the first scanner. Then I think the query state 
becomes FINISHED and it's not guaranteed to be 80ms after the query execution.

Uploaded a patch to simply remove this check: 
https://gerrit.cloudera.org/c/24235/

> TestHS2.test_long_polling_success fails with time_diff too small
> ----------------------------------------------------------------
>
>                 Key: IMPALA-14920
>                 URL: https://issues.apache.org/jira/browse/IMPALA-14920
>             Project: IMPALA
>          Issue Type: Bug
>            Reporter: Quanlong Huang
>            Priority: Major
>              Labels: broken-build
>
> h3. Error Message
> assert 0.07497954368591309 >= 0.08
> h3. Stacktrace
> {noformat}
> hs2/hs2_test_suite.py:68: in add_session
>     add_session_helper(self, protocol_version, conf_overlay, close_session,
>         close_session = True
>         conf_overlay = {'long_polling_time_ms': '10000'}
>         fn         = <function TestHS2.test_long_polling_success at 
> 0x7f3f9da13560>
>         protocol_version = 5
>         self       = <tests.hs2.test_hs2.TestHS2 object at 0x7f3f9aa82e10>
> hs2/hs2_test_suite.py:50: in add_session_helper
>     fn()
>         close_session = True
>         close_session_req = 
> TCloseSessionReq(sessionHandle=TSessionHandle(sessionId=THandleIdentifier(guid=b'\xdb\xe7\xf9\xe3\xb1yE\x7f\xbfJEk\xa5\xd0\xc7A',
>  secret=b'\x19\xa8Tj\x07\x1fH\x1f\x8f\xd6\x8b2\xf3\xc5\xcd\x83')))
>         conf_overlay = {'long_polling_time_ms': '10000'}
>         fn         = <function 
> needs_session.<locals>.session_decorator.<locals>.add_session.<locals>.<lambda>
>  at 0x7f3f9ab61f80>
>         open_session_req = TOpenSessionReq(client_protocol=5, 
> username='jenkins', password=None, configuration={'long_polling_time_ms': 
> '10000'})
>         protocol_version = 5
>         resp       = TOpenSessionResp(status=TStatus(statusCode=0, 
> infoMessages=None, sqlState=None, errorCode=None, errorMessage=None), se..., 
> 'WRITE_KUDU_UTC_TIMESTAMPS': '0', 'http_addr': 
> 'impala-ec2-rhel92-m6i-4xlarge-ondemand-16e6.vpc.cloudera.com:25000'})
>         self       = <tests.hs2.test_hs2.TestHS2 object at 0x7f3f9aa82e10>
> hs2/hs2_test_suite.py:69: in <lambda>
>     lambda: fn(self))
>         fn         = <function TestHS2.test_long_polling_success at 
> 0x7f3f9da13560>
>         self       = <tests.hs2.test_hs2.TestHS2 object at 0x7f3f9aa82e10>
> /data/jenkins/workspace/impala-cdw-master-staging-core/repos/Impala/tests/hs2/test_hs2.py:398:
>  in test_long_polling_success
>     assert time_diff >= 0.08
> E   assert 0.07497954368591309 >= 0.08
>         end_time   = 1776999337.8833542
>         execute_statement_resp = 
> TExecuteStatementResp(status=TStatus(statusCode=0, infoMessages=None, 
> sqlState=None, errorCode=None, 
> errorMessage=None...t=b'\x19\xa8Tj\x07\x1fH\x1f\x8f\xd6\x8b2\xf3\xc5\xcd\x83'),
>  operationType=0, hasResultSet=True, modifiedRowCount=None))
>         get_operation_status_resp = 
> TGetOperationStatusResp(status=TStatus(statusCode=0, infoMessages=None, 
> sqlState=None, errorCode=None, errorMessage=None), operationState=2, 
> sqlState=None, errorCode=None, errorMessage=None)
>         self       = <tests.hs2.test_hs2.TestHS2 object at 0x7f3f9aa82e10>
>         start_time = 1776999337.8083746
>         statement  = 'SELECT count(sleep(10)) from functional.alltypestiny'
>         time_diff  = 0.07497954368591309{noformat}
> h3. Standard Error
> {noformat}
> --------------------------------- Captured Err 
> ---------------------------------
> -- 2026-04-23 19:55:37,753 INFO     MainThread: beeswax: 
> set client_identifier=hs2/test_hs2.py::TestHS2::test_long_polling_success;
> -- 2026-04-23 19:55:37,753 INFO     MainThread: hs2: 
> set client_identifier=hs2/test_hs2.py::TestHS2::test_long_polling_success;
> -- 2026-04-23 19:55:37,753 INFO     MainThread: hs2-http: 
> set client_identifier=hs2/test_hs2.py::TestHS2::test_long_polling_success;
> -- 2026-04-23 19:55:37,753 INFO     MainThread: Could not connect to ('::1', 
> 21050, 0, 0)
> Traceback (most recent call last):
>   File 
> "/data/jenkins/workspace/impala-cdw-master-staging-core/repos/Impala/infra/python/env-gcc10.4.0-py3/lib/python3.11/site-packages/thrift/transport/TSocket.py",
>  line 137, in open
>     handle.connect(sockaddr)
> ConnectionRefusedError: [Errno 111] Connection refused{noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to