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

Method do_summary

shell/impala_shell/impala_shell.py:849–891  ·  view source on GitHub ↗
(self, args)

Source from the content-addressed store, hash-verified

847 return status
848
849 def do_summary(self, args):
850 split_args = args.split()
851 if len(split_args) > 1:
852 print("'summary' only accepts 0 or 1 arguments", file=sys.stderr)
853 return CmdStatus.ERROR
854 if not self.last_query_handle:
855 print("Could not retrieve summary: no previous query.", file=sys.stderr)
856 return CmdStatus.ERROR
857
858 display_mode = QueryAttemptDisplayModes.LATEST
859 if len(split_args) == 1:
860 display_mode = self.get_query_attempt_display_mode(split_args[0])
861 if display_mode is None:
862 return CmdStatus.ERROR
863
864 try:
865 summary, failed_summary = self.imp_client.get_summary(self.last_query_handle)
866 except RPCException as e:
867 error_pattern = re.compile("Query id [a-f0-9]+:[a-f0-9]+ not found.")
868 if error_pattern.match(e.value):
869 print("Could not retrieve summary for query.", file=sys.stderr)
870 else:
871 print(e, file=sys.stderr)
872 return CmdStatus.ERROR
873 if summary.nodes is None:
874 print("Summary not available", file=sys.stderr)
875 return CmdStatus.SUCCESS
876
877 if display_mode == QueryAttemptDisplayModes.ALL:
878 print("Query Summary:")
879 self.print_exec_summary(summary)
880 if failed_summary:
881 print("Failed Query Summary:")
882 self.print_exec_summary(failed_summary)
883 elif display_mode == QueryAttemptDisplayModes.LATEST:
884 self.print_exec_summary(summary)
885 elif display_mode == QueryAttemptDisplayModes.ORIGINAL:
886 if failed_summary:
887 self.print_exec_summary(failed_summary)
888 else:
889 print("No failed summary found")
890 else:
891 raise FatalShellException("Invalid value for query summary display mode")
892
893 @staticmethod
894 def get_query_attempt_display_mode(arg_mode):

Callers

nothing calls this directly

Calls 5

print_exec_summaryMethod · 0.95
FatalShellExceptionClass · 0.85
matchMethod · 0.80
get_summaryMethod · 0.45

Tested by

no test coverage detected