MCPcopy Create free account
hub / github.com/cosdata/cosdata / fields_to_dimensions

Function fields_to_dimensions

src/metadata/mod.rs:128–144  ·  view source on GitHub ↗

Returns metadata dimensions based on the fields Note that the base dimensions will be implicitly included as the first item in the returned vector

(
    schema: &MetadataSchema,
    metadata_fields: Option<&MetadataFields>,
)

Source from the content-addressed store, hash-verified

126/// Note that the base dimensions will be implicitly included as the
127/// first item in the returned vector
128pub fn fields_to_dimensions(
129 schema: &MetadataSchema,
130 metadata_fields: Option<&MetadataFields>,
131) -> Result<Vec<MetadataDimensions>, Error> {
132 let mut result = vec![];
133 // First add base dimensions
134 result.push(schema.base_dimensions());
135
136 if let Some(fields) = metadata_fields {
137 let weighted_dims = schema.weighted_dimensions(fields, HIGH_WEIGHT)?;
138 for wd in weighted_dims.into_iter() {
139 result.push(wd);
140 }
141 }
142
143 Ok(result)
144}
145
146fn gen_combinations(vs: &Vec<Vec<u16>>) -> Vec<Vec<u16>> {
147 if vs.is_empty() {

Callers 1

metadata_replica_setFunction · 0.85

Calls 3

base_dimensionsMethod · 0.80
weighted_dimensionsMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected