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

Method test_load_data

tests/metadata/test_hdfs_encryption.py:104–139  ·  view source on GitHub ↗
(self, vector)

Source from the content-addressed store, hash-verified

102 self.hdfs_client.delete_file_dir(TMP_DIR, recursive=True)
103
104 def test_load_data(self, vector):
105 key_tbl_dir = vector.get_value('key_tbl_dir')
106 key_load_dir = vector.get_value('key_load_dir')
107
108 if vector.get_value('partitioned'):
109 src_file = "/test-warehouse/alltypes/year=2010/month=1/100101.txt"
110 src_tbl_schema = "functional.alltypes"
111 else:
112 src_file = "/test-warehouse/tinytable/data.csv"
113 src_tbl_schema = "functional.tinytable"
114
115 if key_load_dir is not None:
116 rc, stdout, stderr = exec_process(
117 'hdfs crypto -createZone -keyName %s -path %s' % (key_load_dir, TMP_DIR))
118 assert rc == 0, 'Error executing hdfs crypto: %s %s' % (stdout, stderr)
119
120 # hdfs_client doesn't support copy
121 rc, stdout, stderr = exec_process('hdfs dfs -cp %s %s' % (src_file, TMP_DIR))
122 assert rc == 0, 'Error executing hdfs cp: %s %s' % (stdout, stderr)
123
124 self.client.execute('create table tbl like %s' % (src_tbl_schema))
125
126 if key_tbl_dir is not None:
127 rc, stdout, stderr = exec_process(
128 'hdfs crypto -createZone -keyName %s -path /test-warehouse/%s.db/tbl' %
129 (key_tbl_dir, TEST_DB))
130 assert rc == 0, 'Error executing hdfs crypto: %s %s' % (stdout, stderr)
131
132 if vector.get_value('partitioned'):
133 # insert a single value to create the partition spec
134 self.client.execute('insert into tbl partition (year=2010, month=1) '\
135 'values (0,true,0,0,0,0,0,0,NULL,NULL,NULL)')
136 self.client.execute('load data inpath \'%s\' into table tbl '\
137 'partition(year=2010, month=1)' % (TMP_DIR))
138 else:
139 self.client.execute('load data inpath \'%s\' into table tbl ' % (TMP_DIR))
140
141 @pytest.mark.execute_serially
142 def test_drop_partition_encrypt(self):

Callers

nothing calls this directly

Calls 3

exec_processFunction · 0.90
get_valueMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected