|
2 | 2 |
|
3 | 3 | namespace Iceberg |
4 | 4 | { |
5 | | -#define DEFINE_ICEBERG_FIELD_NAME(name, strval) constexpr const char * F##name = #strval; |
6 | | -#define DEFINE_ICEBERG_SUB_FIELD_NAME(name, subname) constexpr const char * F##name##0##subname = #name "." #subname; |
7 | | -#define DEFINE_ICEBERG_FIELD_NAME_SAME(name) constexpr const char * F##name = #name; |
| 5 | +/// This file define the field name appearing in Iceberg files. |
| 6 | +#define DEFINE_ICEBERG_FIELD_ALIAS(name, strval) constexpr const char * f_##name = #strval; |
| 7 | +#define DEFINE_ICEBERG_FIELD_COMPOUND(name, subname) constexpr const char * c_##name##_##subname = #name "." #subname; |
| 8 | +#define DEFINE_ICEBERG_FIELD(name) constexpr const char * f_##name = #name; |
8 | 9 |
|
9 | | -DEFINE_ICEBERG_FIELD_NAME_SAME(sequence_number); |
10 | | -DEFINE_ICEBERG_FIELD_NAME_SAME(manifest_path); |
11 | | -DEFINE_ICEBERG_FIELD_NAME(format_version, format-version); |
12 | | -DEFINE_ICEBERG_FIELD_NAME(current_snapshot_id, current-snapshot-id); |
13 | | -DEFINE_ICEBERG_FIELD_NAME(snapshot_id, snapshot-id); |
14 | | -DEFINE_ICEBERG_FIELD_NAME(schema_id, schema-id); |
15 | | -DEFINE_ICEBERG_FIELD_NAME(current_schema_id, current-schema-id); |
16 | | -DEFINE_ICEBERG_FIELD_NAME(table_uuid, table-uuid); |
17 | | -DEFINE_ICEBERG_FIELD_NAME(total_records, total-records); |
18 | | -DEFINE_ICEBERG_FIELD_NAME(total_files_size, total-files-size); |
19 | | -DEFINE_ICEBERG_FIELD_NAME(manifest_list, manifest-list); |
20 | | -DEFINE_ICEBERG_FIELD_NAME(snapshot_log, snapshot-log); |
21 | | -DEFINE_ICEBERG_FIELD_NAME(timestamp_ms, timestamp-ms); |
22 | | -DEFINE_ICEBERG_FIELD_NAME_SAME(location); |
23 | | -DEFINE_ICEBERG_FIELD_NAME_SAME(snapshots); |
24 | | -DEFINE_ICEBERG_FIELD_NAME_SAME(schemas); |
25 | | -DEFINE_ICEBERG_FIELD_NAME(last_updated_ms, last-updated-ms); |
26 | | -DEFINE_ICEBERG_FIELD_NAME(source_id, source-id); |
27 | | -DEFINE_ICEBERG_FIELD_NAME_SAME(transform); |
28 | | -DEFINE_ICEBERG_FIELD_NAME_SAME(status); |
29 | | -DEFINE_ICEBERG_FIELD_NAME_SAME(data_file); |
30 | | -DEFINE_ICEBERG_SUB_FIELD_NAME(data_file, file_path); |
31 | | -DEFINE_ICEBERG_SUB_FIELD_NAME(data_file, content); |
32 | | -DEFINE_ICEBERG_SUB_FIELD_NAME(data_file, partition); |
33 | | -DEFINE_ICEBERG_SUB_FIELD_NAME(data_file, value_counts); |
34 | | -DEFINE_ICEBERG_SUB_FIELD_NAME(data_file, column_sizes); |
35 | | -DEFINE_ICEBERG_SUB_FIELD_NAME(data_file, null_value_counts); |
36 | | -DEFINE_ICEBERG_SUB_FIELD_NAME(data_file, lower_bounds); |
37 | | -DEFINE_ICEBERG_SUB_FIELD_NAME(data_file, upper_bounds); |
| 10 | +/// These variables begin with 'f_', following the field name in Iceberg files. |
| 11 | +DEFINE_ICEBERG_FIELD(data_file); |
| 12 | +DEFINE_ICEBERG_FIELD(location); |
| 13 | +DEFINE_ICEBERG_FIELD(manifest_path); |
| 14 | +DEFINE_ICEBERG_FIELD(schemas); |
| 15 | +DEFINE_ICEBERG_FIELD(sequence_number); |
| 16 | +DEFINE_ICEBERG_FIELD(snapshots); |
| 17 | +DEFINE_ICEBERG_FIELD(status); |
| 18 | +DEFINE_ICEBERG_FIELD(summary); |
| 19 | +DEFINE_ICEBERG_FIELD(transform); |
| 20 | +/// These variables replace `-` with underscore `_` to be compatible with c++ code. |
| 21 | +DEFINE_ICEBERG_FIELD_ALIAS(format_version, format-version); |
| 22 | +DEFINE_ICEBERG_FIELD_ALIAS(current_snapshot_id, current-snapshot-id); |
| 23 | +DEFINE_ICEBERG_FIELD_ALIAS(snapshot_id, snapshot-id); |
| 24 | +DEFINE_ICEBERG_FIELD_ALIAS(parent_snapshot_id, parent-snapshot-id); |
| 25 | +DEFINE_ICEBERG_FIELD_ALIAS(snapshot_log, snapshot-log); |
| 26 | +DEFINE_ICEBERG_FIELD_ALIAS(schema_id, schema-id); |
| 27 | +DEFINE_ICEBERG_FIELD_ALIAS(current_schema_id, current-schema-id); |
| 28 | +DEFINE_ICEBERG_FIELD_ALIAS(table_uuid, table-uuid); |
| 29 | +DEFINE_ICEBERG_FIELD_ALIAS(total_records, total-records); |
| 30 | +DEFINE_ICEBERG_FIELD_ALIAS(total_files_size, total-files-size); |
| 31 | +DEFINE_ICEBERG_FIELD_ALIAS(manifest_list, manifest-list); |
| 32 | +DEFINE_ICEBERG_FIELD_ALIAS(timestamp_ms, timestamp-ms); |
| 33 | +DEFINE_ICEBERG_FIELD_ALIAS(last_updated_ms, last-updated-ms); |
| 34 | +DEFINE_ICEBERG_FIELD_ALIAS(source_id, source-id); |
| 35 | +/// These are compound fields like `data_file.file_path`, we use prefix 'c_' to distingish them. |
| 36 | +DEFINE_ICEBERG_FIELD_COMPOUND(data_file, file_path); |
| 37 | +DEFINE_ICEBERG_FIELD_COMPOUND(data_file, content); |
| 38 | +DEFINE_ICEBERG_FIELD_COMPOUND(data_file, partition); |
| 39 | +DEFINE_ICEBERG_FIELD_COMPOUND(data_file, value_counts); |
| 40 | +DEFINE_ICEBERG_FIELD_COMPOUND(data_file, column_sizes); |
| 41 | +DEFINE_ICEBERG_FIELD_COMPOUND(data_file, null_value_counts); |
| 42 | +DEFINE_ICEBERG_FIELD_COMPOUND(data_file, lower_bounds); |
| 43 | +DEFINE_ICEBERG_FIELD_COMPOUND(data_file, upper_bounds); |
38 | 44 | } |
0 commit comments