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

Method _format_outputstream

shell/impala_shell/impala_shell.py:1357–1375  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1355 return ret
1356
1357 def _format_outputstream(self):
1358 column_names = self.imp_client.get_column_names(self.last_query_handle)
1359 if sys.version_info.major == 2:
1360 column_names = [
1361 col.decode("utf8", errors="replace") if isinstance(col, str) else col
1362 for col in column_names]
1363 if self.write_delimited:
1364 formatter = DelimitedOutputFormatter(field_delim=self.output_delimiter)
1365 self.output_stream = OutputStream(formatter, filename=self.output_file)
1366 # print the column names
1367 if self.print_header:
1368 self.output_stream.write([column_names])
1369 elif self.vertical:
1370 formatter = VerticalOutputFormatter(column_names)
1371 self.output_stream = OutputStream(formatter, filename=self.output_file)
1372 else:
1373 prettytable = self.construct_table_with_header(column_names)
1374 formatter = PrettyOutputFormatter(prettytable)
1375 self.output_stream = OutputStream(formatter, filename=self.output_file)
1376
1377 def _periodic_wait_callback(self):
1378 """If enough time elapsed since the last call to the periodic callback,

Callers 1

_execute_stmtMethod · 0.95

Calls 8

OutputStreamClass · 0.90
decodeMethod · 0.80
get_column_namesMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected