MCPcopy Create free account
hub / github.com/apache/paimon-rust / new

Method new

crates/paimon/src/spec/schema.rs:49–64  ·  view source on GitHub ↗

Create a TableSchema from a Schema with the given ID. Reference:

(id: i64, schema: &Schema)

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 8

to_vecMethod · 0.80
partition_keysMethod · 0.80
primary_keysMethod · 0.80
commentMethod · 0.80
validate_create_modeMethod · 0.80
fieldsMethod · 0.45
optionsMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected