mirror of
https://github.com/apache/impala.git
synced 2025-12-30 21:02:41 -05:00
Also add support for "SET", which returns a table of query options and their respective values. The front-end parses the option into a (key, value) pair and then the existing backend logic is used to set the option, or return the result sets. Change-Id: I40dbd98537e2a73bdd5b27d8b2575a2fe6f8295b Reviewed-on: http://gerrit.ent.cloudera.com:8080/3582 Reviewed-by: Daniel Hecht <dhecht@cloudera.com> Tested-by: jenkins (cherry picked from commit aa0f6a2fc1d3fe21f22cc7bc56887e1fdb02250b) Reviewed-on: http://gerrit.ent.cloudera.com:8080/3614
66 lines
2.3 KiB
Python
66 lines
2.3 KiB
Python
#!/usr/bin/env python
|
|
# Copyright (c) 2014 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.
|
|
#
|
|
# Tests for SET <query option>
|
|
|
|
import logging
|
|
import pytest
|
|
from tests.beeswax.impala_beeswax import ImpalaBeeswaxException
|
|
from tests.common.test_dimensions import *
|
|
from tests.common.impala_test_suite import ImpalaTestSuite, SINGLE_NODE_ONLY
|
|
|
|
class TestSet(ImpalaTestSuite):
|
|
@classmethod
|
|
def get_workload(self):
|
|
return 'functional-query'
|
|
|
|
@classmethod
|
|
def add_test_dimensions(cls):
|
|
super(TestSet, cls).add_test_dimensions()
|
|
# This test only needs to be run once.
|
|
cls.TestMatrix.add_dimension(create_single_exec_option_dimension())
|
|
cls.TestMatrix.add_dimension(create_uncompressed_text_dimension(cls.get_workload()))
|
|
|
|
def test_set(self, vector):
|
|
self.run_test_case('QueryTest/set', vector)
|
|
|
|
def test_set_negative(self, vector):
|
|
# Test that SET with an invalid config option name fails
|
|
try:
|
|
self.execute_query('set foo=bar')
|
|
assert False, 'Expected to fail'
|
|
except ImpalaBeeswaxException as e:
|
|
assert "Ignoring invalid configuration option: foo" in str(e)
|
|
|
|
# Test that SET with an invalid config option value fails
|
|
try:
|
|
self.execute_query('set parquet_compression_codec=bar')
|
|
assert False, 'Expected to fail'
|
|
except ImpalaBeeswaxException as e:
|
|
assert "Invalid parquet compression codec: bar" in str(e)
|
|
|
|
@pytest.mark.execute_serially
|
|
def test_set_mem_limit(self, vector):
|
|
# Test that SET actually does change the mem_limit
|
|
self.execute_query('select 1')
|
|
self.execute_query('set mem_limit=1');
|
|
try:
|
|
self.execute_query('select 1')
|
|
assert False, 'Expected to fail'
|
|
except ImpalaBeeswaxException as e:
|
|
assert "Memory limit exceeded" in str(e)
|
|
self.execute_query('set mem_limit=0');
|
|
self.execute_query('select 1')
|