import logging
import pytest
from copy import copy
from tests.common.test_vector import *
from tests.common.impala_test_suite import *

class TestStringQueries(ImpalaTestSuite):

  @classmethod
  def get_workload(cls):
    return 'functional-query'

  def setup_method(self, method):
    self.__cleanup_char_tables()
    self.__create_char_tables()

  def teardown_method(self, method):
    self.__cleanup_char_tables()

  def __cleanup_char_tables(self):
    self.client.execute('drop table if exists functional.test_char_tmp');
    self.client.execute('drop table if exists functional.test_varchar_tmp');

  def __create_char_tables(self):
    self.client.execute(
        'create table if not exists functional.test_varchar_tmp (vc varchar(5))')
    self.client.execute(
        'create table if not exists functional.test_char_tmp (c char(5))')

  @classmethod
  def add_test_dimensions(cls):
    super(TestStringQueries, cls).add_test_dimensions()
    cls.TestMatrix.add_dimension(
      create_exec_option_dimension(disable_codegen_options=[True]))
    cls.TestMatrix.add_constraint(lambda v:\
        v.get_value('table_format').file_format in ['text'])

  def test_varchar(self, vector):
    self.run_test_case('QueryTest/chars', vector)

import logging
import pytest
from copy import copy
from tests.common.test_vector import *
from tests.common.impala_test_suite import *

class TestStringQueries(ImpalaTestSuite):

  @classmethod
  def get_workload(cls):
    return 'functional-query'

  def setup_method(self, method):
    self.__cleanup_char_tables()
    self.__create_char_tables()

  def teardown_method(self, method):
    self.__cleanup_char_tables()

  def __cleanup_char_tables(self):
    self.client.execute('drop table if exists functional.test_char_tmp');
    self.client.execute('drop table if exists functional.test_varchar_tmp');

  def __create_char_tables(self):
    self.client.execute(
        'create table if not exists functional.test_varchar_tmp (vc varchar(5))')
    self.client.execute(
        'create table if not exists functional.test_char_tmp (c char(5))')

  @classmethod
  def add_test_dimensions(cls):
    super(TestStringQueries, cls).add_test_dimensions()
    cls.TestMatrix.add_dimension(
      create_exec_option_dimension(disable_codegen_options=[True]))
    cls.TestMatrix.add_constraint(lambda v:\
        v.get_value('table_format').file_format in ['text'] and
        v.get_value('table_format').compression_codec in ['none'])

  def test_varchar(self, vector):
    self.run_test_case('QueryTest/chars', vector)

Fix char test to only run on test/none.
Fix char test to only run on test/none.

Change-Id: I8f5ac5a6e7399ce2fdbe78d07ae24deaa1d7532d
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4326
Tested-by: jenkins
Reviewed-by: Alex Behm <fe1626037acfc2dc542d2aa723a6d14f2464a20c@cloudera.com>

  import logging
  import pytest
  from copy import copy
  from tests.common.test_vector import *
  from tests.common.impala_test_suite import *
  
  class TestStringQueries(ImpalaTestSuite):
  
    @classmethod
    def get_workload(cls):
      return 'functional-query'
  
    def setup_method(self, method):
      self.__cleanup_char_tables()
      self.__create_char_tables()
  
    def teardown_method(self, method):
      self.__cleanup_char_tables()
  
    def __cleanup_char_tables(self):
      self.client.execute('drop table if exists functional.test_char_tmp');
      self.client.execute('drop table if exists functional.test_varchar_tmp');
  
    def __create_char_tables(self):
      self.client.execute(
          'create table if not exists functional.test_varchar_tmp (vc varchar(5))')
      self.client.execute(
          'create table if not exists functional.test_char_tmp (c char(5))')
  
    @classmethod
    def add_test_dimensions(cls):
      super(TestStringQueries, cls).add_test_dimensions()
      cls.TestMatrix.add_dimension(
        create_exec_option_dimension(disable_codegen_options=[True]))
      cls.TestMatrix.add_constraint(lambda v:\
-         v.get_value('table_format').file_format in ['text'])
+         v.get_value('table_format').file_format in ['text'] and
+         v.get_value('table_format').compression_codec in ['none'])
  
    def test_varchar(self, vector):
      self.run_test_case('QueryTest/chars', vector)
  
Fix char test to only run on test/none.
## Code Before:
import logging
import pytest
from copy import copy
from tests.common.test_vector import *
from tests.common.impala_test_suite import *

class TestStringQueries(ImpalaTestSuite):

  @classmethod
  def get_workload(cls):
    return 'functional-query'

  def setup_method(self, method):
    self.__cleanup_char_tables()
    self.__create_char_tables()

  def teardown_method(self, method):
    self.__cleanup_char_tables()

  def __cleanup_char_tables(self):
    self.client.execute('drop table if exists functional.test_char_tmp');
    self.client.execute('drop table if exists functional.test_varchar_tmp');

  def __create_char_tables(self):
    self.client.execute(
        'create table if not exists functional.test_varchar_tmp (vc varchar(5))')
    self.client.execute(
        'create table if not exists functional.test_char_tmp (c char(5))')

  @classmethod
  def add_test_dimensions(cls):
    super(TestStringQueries, cls).add_test_dimensions()
    cls.TestMatrix.add_dimension(
      create_exec_option_dimension(disable_codegen_options=[True]))
    cls.TestMatrix.add_constraint(lambda v:\
        v.get_value('table_format').file_format in ['text'])

  def test_varchar(self, vector):
    self.run_test_case('QueryTest/chars', vector)

## Instruction:
Fix char test to only run on test/none.
## Code After:
import logging
import pytest
from copy import copy
from tests.common.test_vector import *
from tests.common.impala_test_suite import *

class TestStringQueries(ImpalaTestSuite):

  @classmethod
  def get_workload(cls):
    return 'functional-query'

  def setup_method(self, method):
    self.__cleanup_char_tables()
    self.__create_char_tables()

  def teardown_method(self, method):
    self.__cleanup_char_tables()

  def __cleanup_char_tables(self):
    self.client.execute('drop table if exists functional.test_char_tmp');
    self.client.execute('drop table if exists functional.test_varchar_tmp');

  def __create_char_tables(self):
    self.client.execute(
        'create table if not exists functional.test_varchar_tmp (vc varchar(5))')
    self.client.execute(
        'create table if not exists functional.test_char_tmp (c char(5))')

  @classmethod
  def add_test_dimensions(cls):
    super(TestStringQueries, cls).add_test_dimensions()
    cls.TestMatrix.add_dimension(
      create_exec_option_dimension(disable_codegen_options=[True]))
    cls.TestMatrix.add_constraint(lambda v:\
        v.get_value('table_format').file_format in ['text'] and
        v.get_value('table_format').compression_codec in ['none'])

  def test_varchar(self, vector):
    self.run_test_case('QueryTest/chars', vector)
