| 22 | #include <arrow-glib/arrow-glib.h> |
| 23 | |
| 24 | static void |
| 25 | print_array(GArrowArray *array) |
| 26 | { |
| 27 | GArrowType value_type; |
| 28 | gint64 i, n; |
| 29 | |
| 30 | value_type = garrow_array_get_value_type(array); |
| 31 | |
| 32 | g_print("["); |
| 33 | n = garrow_array_get_length(array); |
| 34 | |
| 35 | #define ARRAY_CASE(type, Type, TYPE, format) \ |
| 36 | case GARROW_TYPE_##TYPE: \ |
| 37 | { \ |
| 38 | GArrow##Type##Array *real_array; \ |
| 39 | real_array = GARROW_##TYPE##_ARRAY(array); \ |
| 40 | for (i = 0; i < n; i++) { \ |
| 41 | if (i > 0) { \ |
| 42 | g_print(", "); \ |
| 43 | } \ |
| 44 | g_print(format, garrow_##type##_array_get_value(real_array, i)); \ |
| 45 | } \ |
| 46 | } \ |
| 47 | break |
| 48 | |
| 49 | switch (value_type) { |
| 50 | ARRAY_CASE(uint8, UInt8, UINT8, "%hhu"); |
| 51 | ARRAY_CASE(uint16, UInt16, UINT16, "%" G_GUINT16_FORMAT); |
| 52 | ARRAY_CASE(uint32, UInt32, UINT32, "%" G_GUINT32_FORMAT); |
| 53 | ARRAY_CASE(uint64, UInt64, UINT64, "%" G_GUINT64_FORMAT); |
| 54 | ARRAY_CASE(int8, Int8, INT8, "%hhd"); |
| 55 | ARRAY_CASE(int16, Int16, INT16, "%" G_GINT16_FORMAT); |
| 56 | ARRAY_CASE(int32, Int32, INT32, "%" G_GINT32_FORMAT); |
| 57 | ARRAY_CASE(int64, Int64, INT64, "%" G_GINT64_FORMAT); |
| 58 | ARRAY_CASE(float, Float, FLOAT, "%g"); |
| 59 | ARRAY_CASE(double, Double, DOUBLE, "%g"); |
| 60 | default: |
| 61 | break; |
| 62 | } |
| 63 | #undef ARRAY_CASE |
| 64 | |
| 65 | g_print("]\n"); |
| 66 | } |
| 67 | |
| 68 | static void |
| 69 | print_record_batch(GArrowRecordBatch *record_batch) |
no test coverage detected