MCPcopy Create free account
hub / github.com/apache/impala / setup_method

Method setup_method

tests/metadata/test_load.py:64–103  ·  view source on GitHub ↗
(self, method)

Source from the content-addressed store, hash-verified

62 super().teardown_method(method)
63
64 def setup_method(self, method):
65 super().setup_method(method)
66 # Defensively clean the data dirs if they exist.
67 self._clean_test_tables()
68
69 # Create staging directories for load data inpath. The staging directory is laid out
70 # as follows:
71 # - It has 6 sub directories, numbered 1-6
72 # - The directories are populated with files from a subset of partitions in
73 # existing partitioned tables.
74 # - Sub Directories 1-4 have single files copied from alltypes/
75 # - Sub Directories 5-6 have multiple files (4) copied from alltypesaggmultifiles
76 # - Sub Directory 3 also has hidden files, in both supported formats.
77 # - All sub-dirs contain a hidden directory
78 for i in range(1, 6):
79 stagingDir = '{0}/{1}'.format(STAGING_PATH, i)
80 self.filesystem_client.make_dir(stagingDir, permission=777)
81 self.filesystem_client.make_dir('{0}/_hidden_dir'.format(stagingDir),
82 permission=777)
83 # Copy single file partitions from alltypes.
84 for i in range(1, 4):
85 self.filesystem_client.copy(ALLTYPES_PATH,
86 "{0}/{1}/100101.txt".format(STAGING_PATH, i))
87 # Copy multi file partitions from alltypesaggmultifiles.
88 file_names = self.filesystem_client.ls(MULTIAGG_PATH)
89 for i in range(4, 6):
90 for file_ in file_names:
91 self.filesystem_client.copy(
92 "{0}/{1}".format(MULTIAGG_PATH, file_),
93 '{0}/{1}/{2}'.format(STAGING_PATH, i, file_))
94
95 # Create two hidden files, with a leading . and _
96 for file_ in HIDDEN_FILES:
97 self.filesystem_client.copy(ALLTYPES_PATH, file_)
98
99 # Create both the test tables.
100 self.client.execute("create table functional.{0} like functional.alltypes"
101 " location '{1}/{0}'".format(TEST_TBL_PART, WAREHOUSE))
102 self.client.execute("create table functional.{0} like functional.alltypesnopart"
103 " location '{1}/{0}'".format(TEST_TBL_NOPART, WAREHOUSE))
104
105 def test_load(self, vector):
106 self.run_test_case('QueryTest/load', vector)

Callers 1

setup_methodMethod · 0.45

Calls 7

_clean_test_tablesMethod · 0.95
rangeFunction · 0.85
formatMethod · 0.45
make_dirMethod · 0.45
copyMethod · 0.45
lsMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected