Create a TableSchema from a Schema with the given ID. Reference:
(id: i64, schema: &Schema)
| 47 | /// |
| 48 | /// Reference: <https://github.com/apache/paimon/blob/release-0.8.2/paimon-core/src/main/java/org/apache/paimon/schema/TableSchema.java#L373> |
| 49 | pub fn new(id: i64, schema: &Schema) -> Self { |
| 50 | let fields = schema.fields().to_vec(); |
| 51 | let highest_field_id = Self::current_highest_field_id(&fields); |
| 52 | |
| 53 | Self { |
| 54 | version: Self::CURRENT_VERSION, |
| 55 | id, |
| 56 | fields, |
| 57 | highest_field_id, |
| 58 | partition_keys: schema.partition_keys().to_vec(), |
| 59 | primary_keys: schema.primary_keys().to_vec(), |
| 60 | options: schema.options().clone(), |
| 61 | comment: schema.comment().map(|s| s.to_string()), |
| 62 | time_millis: chrono::Utc::now().timestamp_millis(), |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | /// Get the highest field ID from a list of fields. |
| 67 | pub fn current_highest_field_id(fields: &[DataField]) -> i32 { |
nothing calls this directly
no test coverage detected