MCPcopy Create free account
hub / github.com/apache/datafusion / generate_timezone

Method generate_timezone

test-utils/src/array_gen/primitive.rs:106–116  ·  view source on GitHub ↗

Generates a random timezone or returns `None`. Returns: - `Some(Arc )` containing the timezone name. - `None` if no timezone is selected.

()

Source from the content-addressed store, hash-verified

104 /// - `Some(Arc<String>)` containing the timezone name.
105 /// - `None` if no timezone is selected.
106 fn generate_timezone() -> Option<Arc<str>> {
107 let mut rng = rng();
108
109 // Allows for timezones + None
110 let mut timezone_options: Vec<Option<&Tz>> = vec![None];
111 timezone_options.extend(TZ_VARIANTS.iter().map(Some));
112
113 let selected_option = timezone_options.choose(&mut rng).cloned().flatten(); // random timezone/None
114
115 selected_option.map(|tz| Arc::from(tz.name()))
116 }
117}

Callers

nothing calls this directly

Calls 6

flattenMethod · 0.80
extendMethod · 0.45
mapMethod · 0.45
iterMethod · 0.45
clonedMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected