Updates the [`InferredDataType`] with the given string
(&mut self, string: &str)
| 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 |