MCPcopy Create free account
hub / github.com/apache/impala / test_select_null

Method test_select_null

tests/hs2/test_fetch.py:235–261  ·  view source on GitHub ↗

Regression test for IMPALA-1370, where NULL literals would appear as strings where they should be booleans

(self)

Source from the content-addressed store, hash-verified

233
234 @needs_session()
235 def test_select_null(self):
236 """Regression test for IMPALA-1370, where NULL literals would appear as strings where
237 they should be booleans"""
238 execute_statement_req = TCLIService.TExecuteStatementReq()
239 execute_statement_req.sessionHandle = self.session_handle
240 execute_statement_req.statement = "select null"
241 execute_statement_resp = self.hs2_client.ExecuteStatement(execute_statement_req)
242 HS2TestSuite.check_response(execute_statement_resp)
243
244 # Check that the expected type is NULL_TYPE (for compatibility with HiveServer2,
245 # see also IMPALA-914, IMPALA-1370, and IMPALA-14027 for history).
246 get_result_metadata_req = TCLIService.TGetResultSetMetadataReq()
247 get_result_metadata_req.operationHandle = execute_statement_resp.operationHandle
248 get_result_metadata_resp = \
249 self.hs2_client.GetResultSetMetadata(get_result_metadata_req)
250 col = get_result_metadata_resp.schema.columns[0]
251 assert col.typeDesc.types[0].primitiveEntry.type == TTypeId.NULL_TYPE
252
253 # Check that the actual type is string
254 fetch_results_req = TCLIService.TFetchResultsReq()
255 fetch_results_req.operationHandle = execute_statement_resp.operationHandle
256 fetch_results_req.maxRows = 1
257 fetch_results_resp = self.fetch(fetch_results_req)
258 assert fetch_results_resp.results.columns[0].stringVal is not None
259
260 assert self.column_results_to_string(
261 fetch_results_resp.results.columns) == (1, "NULL\n")
262
263 @needs_session()
264 def test_compute_stats(self):

Callers

nothing calls this directly

Calls 5

check_responseMethod · 0.80
ExecuteStatementMethod · 0.45
GetResultSetMetadataMethod · 0.45
fetchMethod · 0.45

Tested by

no test coverage detected