MCPcopy Create free account
hub / github.com/apache/arrow-rs / update

Method update

arrow-csv/src/reader/mod.rs:254–269  ·  view source on GitHub ↗

Updates the [`InferredDataType`] with the given string

(&mut self, string: &str)

Source from the content-addressed store, hash-verified

252
253 /// Updates the [`InferredDataType`] with the given string
254 fn update(&mut self, string: &str) {
255 self.packed |= if string.starts_with('"') {
256 1 << 8 // Utf8
257 } else if let Some(m) = REGEX_SET.matches(string).into_iter().next() {
258 if m == 1 && string.len() >= 19 && string.parse::<i64>().is_err() {
259 // if overflow i64, fallback to utf8
260 1 << 8
261 } else {
262 1 << m
263 }
264 } else if string == "NaN" || string == "nan" || string == "inf" || string == "-inf" {
265 1 << 2 // Float64
266 } else {
267 1 << 8 // Utf8
268 }
269 }
270}
271
272/// The format specification for the CSV file

Callers 4

infer_schemaMethod · 0.80
infer_field_schemaFunction · 0.80
test_inferenceFunction · 0.80

Calls 3

nextMethod · 0.45
into_iterMethod · 0.45
lenMethod · 0.45

Tested by 1

test_inferenceFunction · 0.64