File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 3636 compare_dbr_versions ,
3737 is_thrift_v5_plus ,
3838)
39+ from databricks .sql .thrift_api .TCLIService import ttypes
3940from tests .e2e .common .core_tests import CoreTestMixin , SmokeTestMixin
4041from tests .e2e .common .large_queries_mixin import LargeQueriesMixin
4142from tests .e2e .common .timestamp_tests import TimestampTestsMixin
@@ -175,6 +176,26 @@ def test_cloud_fetch(self):
175176 for i in range (len (cf_result )):
176177 assert cf_result [i ] == noop_result [i ]
177178
179+ def test_execute_async (self ):
180+ def isExecuting (operation_state ):
181+ return not operation_state or operation_state in [
182+ ttypes .TOperationState .RUNNING_STATE ,
183+ ttypes .TOperationState .PENDING_STATE ,
184+ ]
185+
186+ long_running_query = "SELECT COUNT(*) FROM RANGE(10000 * 16) x JOIN RANGE(10000) y ON FROM_UNIXTIME(x.id * y.id, 'yyyy-MM-dd') LIKE '%not%a%date%'"
187+ with self .cursor () as cursor :
188+ cursor .execute_async (long_running_query )
189+
190+ ## Polling
191+ while isExecuting (cursor .get_query_state ()):
192+ log .info ("Polling the status in test_execute_async" )
193+
194+ cursor .get_execution_result ()
195+ result = cursor .fetchall ()
196+
197+ assert result [0 ].asDict () == {"count(1)" : 0 }
198+
178199
179200# Exclude Retry tests because they require specific setups, and LargeQueries too slow for core
180201# tests
You can’t perform that action at this time.
0 commit comments