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

Function decode_profile_line

lib/python/impala_py_lib/profiles.py:30–51  ·  view source on GitHub ↗
(line)

Source from the content-addressed store, hash-verified

28
29
30def decode_profile_line(line):
31 space_separated = line.split(" ")
32 if len(space_separated) == 3:
33 ts = int(space_separated[0])
34 print(datetime.datetime.fromtimestamp(ts / 1000.0).isoformat(), space_separated[1])
35 base64_encoded = space_separated[2]
36 elif len(space_separated) == 1:
37 base64_encoded = space_separated[0]
38 else:
39 raise Exception("Unexpected line: " + line)
40 possibly_compressed = base64.b64decode(base64_encoded)
41 # Handle both compressed and uncompressed Thrift profiles
42 try:
43 thrift = zlib.decompress(possibly_compressed)
44 except zlib.error:
45 thrift = possibly_compressed
46
47 tree = TRuntimeProfileTree()
48 deserialize(tree, thrift, protocol_factory=TCompactProtocol.TCompactProtocolFactory())
49 tree.validate()
50
51 return tree

Callers

nothing calls this directly

Calls 3

deserializeFunction · 0.85
validateMethod · 0.65
TRuntimeProfileTreeClass · 0.50

Tested by

no test coverage detected