MCPcopy Create free account
hub / github.com/apache/arrow / arrow_pretty_print

Function arrow_pretty_print

cpp/gdb_arrow.py:2410–2455  ·  view source on GitHub ↗
(val)

Source from the content-addressed store, hash-verified

2408
2409
2410def arrow_pretty_print(val):
2411 name = val.type.strip_typedefs().name
2412 if name is None:
2413 return
2414 name = name.partition('<')[0] # Remove template parameters
2415 printer = printers.get(name)
2416 if printer is not None:
2417 return printer(name, val)
2418
2419 if not name.startswith("arrow::"):
2420 return
2421 arrow_name = name[len("arrow::"):]
2422
2423 if arrow_name.endswith("Buffer"):
2424 try:
2425 val['data_']
2426 except Exception:
2427 # Not a Buffer?
2428 pass
2429 else:
2430 return BufferPrinter(arrow_name, val)
2431
2432 elif arrow_name.endswith("Type"):
2433 # Look up dynamic type, as it may be hidden behind a DataTypeClass
2434 # pointer or reference.
2435 try:
2436 type_id = int(val['id_'])
2437 except Exception:
2438 # Not a DataTypeClass?
2439 pass
2440 else:
2441 type_class = lookup_type_class(type_id)
2442 if type_class is not None:
2443 return type_class.type_printer(type_class.name, val)
2444
2445 elif arrow_name.endswith("Array"):
2446 return ArrayPrinter(val)
2447
2448 elif arrow_name.endswith("Scalar"):
2449 try:
2450 val['is_valid']
2451 except Exception:
2452 # Not a Scalar?
2453 pass
2454 else:
2455 return ScalarPrinter(val)
2456
2457
2458def main():

Callers

nothing calls this directly

Calls 6

lenFunction · 0.85
BufferPrinterClass · 0.85
lookup_type_classFunction · 0.85
ScalarPrinterClass · 0.85
ArrayPrinterClass · 0.70
getMethod · 0.45

Tested by

no test coverage detected