MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / humanize

Method humanize

src/transform/src/analysis.rs:985–1000  ·  view source on GitHub ↗

Humanize the column to a [`String`], returns an empty [`String`] for unknown columns (or columns named `UNKNOWN_COLUMN_NAME`).

(&self, humanizer: &dyn ExprHumanizer)

Source from the content-addressed store, hash-verified

983 /// Humanize the column to a [`String`], returns an empty [`String`] for
984 /// unknown columns (or columns named `UNKNOWN_COLUMN_NAME`).
985 pub fn humanize(&self, humanizer: &dyn ExprHumanizer) -> String {
986 match self {
987 Self::Global(id, c) => humanizer.humanize_column(*id, *c).unwrap_or_default(),
988 Self::Aggregate(func, expr) => {
989 let func = func.name();
990 let expr = expr.humanize(humanizer);
991 if expr.is_empty() {
992 String::from(func)
993 } else {
994 format!("{func}_{expr}")
995 }
996 }
997 Self::Annotated(name) => name.to_string(),
998 Self::Unknown => String::new(),
999 }
1000 }
1001
1002 /// Clone this column name if it is known, otherwise try to use the provided
1003 /// name if it is available.

Callers 1

annotate_planFunction · 0.45

Calls 4

humanize_columnMethod · 0.45
nameMethod · 0.45
is_emptyMethod · 0.45
to_stringMethod · 0.45

Tested by

no test coverage detected