Files
impala/tests/hs2/test_fetch.py
Nong Li 4b883ac7eb Fix decimal bugs.
Fix overflow handling in a few cases and add decimal as hs2 type.

Change-Id: Ifde1988365f6be961e7eb7404ed37d7bbaab875c
Reviewed-on: http://gerrit.ent.cloudera.com:8080/2531
Reviewed-by: Nong Li <nong@cloudera.com>
Tested-by: jenkins
Reviewed-on: http://gerrit.ent.cloudera.com:8080/2564
2014-05-16 00:17:38 -07:00

45 lines
1.9 KiB
Python
Executable File

#!/usr/bin/env python
# Copyright (c) 2012 Cloudera, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import pytest
from tests.hs2.hs2_test_suite import HS2TestSuite, needs_session
from cli_service import TCLIService
# Simple test to make sure all the HS2 types are supported.
class TestFetch(HS2TestSuite):
@needs_session
def test_query_stmts(self):
execute_statement_req = TCLIService.TExecuteStatementReq()
execute_statement_req.sessionHandle = self.session_handle
execute_statement_req.statement =\
"SELECT * FROM functional.alltypessmall ORDER BY id LIMIT 1"
execute_statement_resp = self.hs2_client.ExecuteStatement(execute_statement_req)
HS2TestSuite.check_response(execute_statement_resp)
results = self.fetch(execute_statement_resp.operationHandle,
TCLIService.TFetchOrientation.FETCH_NEXT, 1, 1)
assert len(results.results.rows) == 1
self.close(execute_statement_resp.operationHandle)
execute_statement_req.statement =\
"SELECT * FROM functional.decimal_tbl ORDER BY d1 LIMIT 1"
execute_statement_resp = self.hs2_client.ExecuteStatement(execute_statement_req)
HS2TestSuite.check_response(execute_statement_resp)
results = self.fetch(execute_statement_resp.operationHandle,
TCLIService.TFetchOrientation.FETCH_NEXT, 1, 1)
assert len(results.results.rows) == 1
self.close(execute_statement_resp.operationHandle)