mirror of
https://github.com/apache/impala.git
synced 2026-01-05 03:01:02 -05:00
Previously Impala disallowed LOAD DATA and INSERT on S3. This patch functionally enables LOAD DATA and INSERT on S3 without making major changes for the sake of improving performance over S3. This patch also enables both INSERT and LOAD DATA between file systems. S3 does not support the rename operation, so the staged files in S3 are copied instead of renamed, which contributes to the slow performance on S3. The FinalizeSuccessfulInsert() function now does not make any underlying assumptions of the filesystem it is on and works across all supported filesystems. This is done by adding a full URI field to the base directory for a partition in the TInsertPartitionStatus. Also, the HdfsOp class now does not assume a single filesystem and gets connections to the filesystems based on the URI of the file it is operating on. Added a python S3 client called 'boto3' to access S3 from the python tests. A new class called S3Client is introduced which creates wrappers around the boto3 functions and have the same function signatures as PyWebHdfsClient by deriving from a base abstract class BaseFileSystem so that they can be interchangeably through a 'generic_client'. test_load.py is refactored to use this generic client. The ImpalaTestSuite setup creates a client according to the TARGET_FILESYSTEM environment variable and assigns it to the 'generic_client'. P.S: Currently, the test_load.py runs 4x slower on S3 than on HDFS. Performance needs to be improved in future patches. INSERT performance is slower than on HDFS too. This is mainly because of an extra copy that happens between staging and the final location of a file. However, larger INSERTs come closer to HDFS permformance than smaller inserts. ACLs are not taken care of for S3 in this patch. It is something that still needs to be discussed before implementing. Change-Id: I94e15ad67752dce21c9b7c1dced6e114905a942d Reviewed-on: http://gerrit.cloudera.org:8080/2574 Reviewed-by: Sailesh Mukil <sailesh@cloudera.com> Tested-by: Internal Jenkins
51 lines
1.9 KiB
Python
51 lines
1.9 KiB
Python
# Copyright (c) 2015 Cloudera, Inc. All rights reserved.
|
|
# Validates table stored on the LocalFileSystem.
|
|
#
|
|
import pytest
|
|
from subprocess import check_call
|
|
from tests.common.impala_test_suite import ImpalaTestSuite
|
|
from tests.common.test_dimensions import create_single_exec_option_dimension
|
|
from tests.common.skip import SkipIf, SkipIfIsilon, SkipIfS3
|
|
from tests.util.filesystem_utils import get_fs_path
|
|
|
|
@SkipIf.default_fs # Run only when a non-default filesystem is available.
|
|
@SkipIfIsilon.untriaged # Missing coverage: Find out why this is failing.
|
|
class TestMultipleFilesystems(ImpalaTestSuite):
|
|
"""
|
|
Tests that tables and queries can span multiple filesystems.
|
|
"""
|
|
|
|
TEST_DB = 'multi_fs_db'
|
|
|
|
@classmethod
|
|
def get_workload(self):
|
|
return 'functional-query'
|
|
|
|
@classmethod
|
|
def add_test_dimensions(cls):
|
|
super(TestMultipleFilesystems, cls).add_test_dimensions()
|
|
cls.TestMatrix.add_dimension(create_single_exec_option_dimension())
|
|
|
|
cls.TestMatrix.add_constraint(lambda v:\
|
|
v.get_value('table_format').file_format == 'text' and \
|
|
v.get_value('table_format').compression_codec == 'none')
|
|
|
|
def setup_method(self, method):
|
|
self.cleanup_db(self.TEST_DB)
|
|
# Note: Purposely creates database on the default filesystem. Do not specify location.
|
|
self.client.execute("create database %s" % self.TEST_DB)
|
|
self._populate_hdfs_partitions()
|
|
|
|
def teardown_method(self, method):
|
|
self.cleanup_db(self.TEST_DB)
|
|
|
|
def _populate_hdfs_partitions(self):
|
|
""" Copy some data to defaultFS HDFS filesystem so that the test can verify tables
|
|
that span the default (HDFS) and secondary filesystem (e.g. S3A)."""
|
|
check_call(["hadoop", "fs", "-cp",
|
|
get_fs_path("/test-warehouse/alltypes_parquet"),
|
|
"/test-warehouse/%s.db/" % self.TEST_DB], shell=False)
|
|
|
|
def test_local_filesystem(self, vector):
|
|
self.run_test_case('QueryTest/multiple-filesystems', vector, use_db=self.TEST_DB)
|