Ejemplo n.º 1
0
    def test_show_tables(self):
        # Set max limit to 3
        resets = [HS2_GET_TABLES_MAX.set_for_testing(3)]

        try:
            hql = """
        CREATE TABLE test_show_tables_1 (a int) COMMENT 'Test for show_tables';
        CREATE TABLE test_show_tables_2 (a int) COMMENT 'Test for show_tables';
        CREATE TABLE test_show_tables_3 (a int) COMMENT 'Test for show_tables';
      """
            resp = _make_query(self.client, hql, database=self.db_name)
            resp = wait_for_query_to_finish(self.client, resp, max=30.0)

            # Table should have been created
            response = self.client.get(
                "/metastore/tables/%s?filter=show_tables" % self.db_name)
            assert_equal(200, response.status_code)
            assert_equal(len(response.context['tables']), 3)
            assert_equal(response.context['has_metadata'], True)
            assert_true('name' in response.context["tables"][0])
            assert_true('comment' in response.context["tables"][0])
            assert_true('type' in response.context["tables"][0])

            hql = """
        CREATE TABLE test_show_tables_4 (a int) COMMENT 'Test for show_tables';
        CREATE TABLE test_show_tables_5 (a int) COMMENT 'Test for show_tables';
      """
            resp = _make_query(self.client, hql, database=self.db_name)
            resp = wait_for_query_to_finish(self.client, resp, max=30.0)

            # Table should have been created
            response = self.client.get(
                "/metastore/tables/%s?filter=show_tables" % self.db_name)
            assert_equal(200, response.status_code)
            assert_equal(len(response.context['tables']), 5)
            assert_equal(response.context['has_metadata'], False)
            assert_true('name' in response.context["tables"][0])
            assert_false('comment' in response.context["tables"][0],
                         response.context["tables"])
            assert_false('type' in response.context["tables"][0])

            hql = """
        CREATE INDEX test_index ON TABLE test_show_tables_1 (a) AS 'COMPACT' WITH DEFERRED REBUILD;
      """
            resp = _make_query(self.client,
                               hql,
                               wait=True,
                               local=False,
                               max=30.0,
                               database=self.db_name)

            # By default, index table should not appear in show tables view
            response = self.client.get("/metastore/tables/%s" % self.db_name)
            assert_equal(200, response.status_code)
            assert_false('test_index' in response.context['tables'])
        finally:
            for reset in resets:
                reset()
Ejemplo n.º 2
0
  def test_show_tables(self):
    # Set max limit to 3
    resets = [
      HS2_GET_TABLES_MAX.set_for_testing(3)
    ]

    try:
      hql = """
        CREATE TABLE test_show_tables_1 (a int) COMMENT 'Test for show_tables';
        CREATE TABLE test_show_tables_2 (a int) COMMENT 'Test for show_tables';
        CREATE TABLE test_show_tables_3 (a int) COMMENT 'Test for show_tables';
      """
      resp = _make_query(self.client, hql, database=self.db_name)
      resp = wait_for_query_to_finish(self.client, resp, max=30.0)

      # Table should have been created
      response = self.client.get("/metastore/tables/%s?filter=show_tables" % self.db_name)
      assert_equal(200, response.status_code)
      assert_equal(len(response.context['tables']), 3)
      assert_equal(response.context['has_metadata'], True)
      assert_true('name' in response.context["tables"][0])
      assert_true('comment' in response.context["tables"][0])
      assert_true('type' in response.context["tables"][0])

      hql = """
        CREATE TABLE test_show_tables_4 (a int) COMMENT 'Test for show_tables';
        CREATE TABLE test_show_tables_5 (a int) COMMENT 'Test for show_tables';
      """
      resp = _make_query(self.client, hql, database=self.db_name)
      resp = wait_for_query_to_finish(self.client, resp, max=30.0)

      # Table should have been created
      response = self.client.get("/metastore/tables/%s?filter=show_tables" % self.db_name)
      assert_equal(200, response.status_code)
      assert_equal(len(response.context['tables']), 5)
      assert_equal(response.context['has_metadata'], False)
      assert_true('name' in response.context["tables"][0])
      assert_false('comment' in response.context["tables"][0], response.context["tables"])
      assert_false('type' in response.context["tables"][0])

      hql = """
        CREATE INDEX test_index ON TABLE test_show_tables_1 (a) AS 'COMPACT' WITH DEFERRED REBUILD;
      """
      resp = _make_query(self.client, hql, wait=True, local=False, max=30.0, database=self.db_name)

      # By default, index table should not appear in show tables view
      response = self.client.get("/metastore/tables/%s" % self.db_name)
      assert_equal(200, response.status_code)
      assert_false('test_index' in response.context['tables'])
    finally:
      for reset in resets:
        reset()
Ejemplo n.º 3
0
    def test_show_tables(self):
        if is_live_cluster():
            raise SkipTest('HUE-2902: Test is not re-entrant')

        # Set max limit to 3
        resets = [HS2_GET_TABLES_MAX.set_for_testing(3)]

        try:
            hql = """
        CREATE TABLE test_show_tables_1 (a int) COMMENT 'Test for show_tables';
        CREATE TABLE test_show_tables_2 (a int) COMMENT 'Test for show_tables';
        CREATE TABLE test_show_tables_3 (a int) COMMENT 'Test for show_tables';
      """
            resp = _make_query(self.client, hql, database=self.db_name)
            resp = wait_for_query_to_finish(self.client, resp, max=30.0)

            # Table should have been created
            response = self.client.get(
                "/metastore/tables/%s?filter=show_tables" % self.db_name)
            assert_equal(200, response.status_code)
            assert_equal(len(response.context['tables']), 3)
            assert_equal(response.context['has_metadata'], True)
            assert_true('name' in response.context["tables"][0])
            assert_true('comment' in response.context["tables"][0])
            assert_true('type' in response.context["tables"][0])

            hql = """
        CREATE TABLE test_show_tables_4 (a int) COMMENT 'Test for show_tables';
        CREATE TABLE test_show_tables_5 (a int) COMMENT 'Test for show_tables';
      """
            resp = _make_query(self.client, hql, database=self.db_name)
            resp = wait_for_query_to_finish(self.client, resp, max=30.0)

            # Table should have been created
            response = self.client.get(
                "/metastore/tables/%s?filter=show_tables" % self.db_name)
            assert_equal(200, response.status_code)
            assert_equal(len(response.context['tables']), 5)
            assert_equal(response.context['has_metadata'], False)
            assert_true('name' in response.context["tables"][0])
            assert_false('comment' in response.context["tables"][0],
                         response.context["tables"])
            assert_false('type' in response.context["tables"][0])
        finally:
            for reset in resets:
                reset()
Ejemplo n.º 4
0
  def test_show_tables(self):
    if is_live_cluster():
      raise SkipTest('HUE-2902: Test is not re-entrant')

    # Set max limit to 3
    resets = [
      HS2_GET_TABLES_MAX.set_for_testing(3)
    ]

    try:
      hql = """
        CREATE TABLE test_show_tables_1 (a int) COMMENT 'Test for show_tables';
        CREATE TABLE test_show_tables_2 (a int) COMMENT 'Test for show_tables';
        CREATE TABLE test_show_tables_3 (a int) COMMENT 'Test for show_tables';
      """
      resp = _make_query(self.client, hql, database=self.db_name)
      resp = wait_for_query_to_finish(self.client, resp, max=30.0)

      # Table should have been created
      response = self.client.get("/metastore/tables/%s?filter=show_tables" % self.db_name)
      assert_equal(200, response.status_code)
      assert_equal(len(response.context['tables']), 3)
      assert_equal(response.context['has_metadata'], True)
      assert_true('name' in response.context["tables"][0])
      assert_true('comment' in response.context["tables"][0])
      assert_true('type' in response.context["tables"][0])

      hql = """
        CREATE TABLE test_show_tables_4 (a int) COMMENT 'Test for show_tables';
        CREATE TABLE test_show_tables_5 (a int) COMMENT 'Test for show_tables';
      """
      resp = _make_query(self.client, hql, database=self.db_name)
      resp = wait_for_query_to_finish(self.client, resp, max=30.0)

      # Table should have been created
      response = self.client.get("/metastore/tables/%s?filter=show_tables" % self.db_name)
      assert_equal(200, response.status_code)
      assert_equal(len(response.context['tables']), 5)
      assert_equal(response.context['has_metadata'], False)
      assert_true('name' in response.context["tables"][0])
      assert_false('comment' in response.context["tables"][0], response.context["tables"])
      assert_false('type' in response.context["tables"][0])
    finally:
      for reset in resets:
        reset()