|
1 | 1 | use std::collections::{HashMap, HashSet}; |
| 2 | +use std::fmt; |
2 | 3 | use std::str::FromStr; |
3 | 4 | // use std::io::{Cursor, Read}; |
4 | 5 | // use std::sync::Arc; |
@@ -225,6 +226,24 @@ impl From<String> for ReaderFeatures { |
225 | 226 | } |
226 | 227 | } |
227 | 228 |
|
| 229 | +impl AsRef<str> for ReaderFeatures { |
| 230 | + fn as_ref(&self) -> &str { |
| 231 | + match self { |
| 232 | + ReaderFeatures::ColumnMapping => "columnMapping", |
| 233 | + ReaderFeatures::DeleteionVecotrs => "deletionVectors", |
| 234 | + ReaderFeatures::TimestampWithoutTimezone => "timestampNtz", |
| 235 | + ReaderFeatures::V2Checkpoint => "v2Checkpoint", |
| 236 | + ReaderFeatures::Other(f) => f, |
| 237 | + } |
| 238 | + } |
| 239 | +} |
| 240 | + |
| 241 | +impl fmt::Display for ReaderFeatures { |
| 242 | + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| 243 | + write!(f, "{}", self.as_ref()) |
| 244 | + } |
| 245 | +} |
| 246 | + |
228 | 247 | /// Features table writers can support as well as let users know |
229 | 248 | /// what is supported |
230 | 249 | #[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq, Hash)] |
@@ -303,6 +322,33 @@ impl From<String> for WriterFeatures { |
303 | 322 | } |
304 | 323 | } |
305 | 324 |
|
| 325 | +impl AsRef<str> for WriterFeatures { |
| 326 | + fn as_ref(&self) -> &str { |
| 327 | + match self { |
| 328 | + WriterFeatures::AppendOnly => "appendOnly", |
| 329 | + WriterFeatures::Invariants => "invariants", |
| 330 | + WriterFeatures::CheckConstraints => "checkConstraints", |
| 331 | + WriterFeatures::ChangeDataFeed => "changeDataFeed", |
| 332 | + WriterFeatures::GeneratedColumns => "generatedColumns", |
| 333 | + WriterFeatures::ColumnMapping => "columnMapping", |
| 334 | + WriterFeatures::IdentityColumns => "identityColumns", |
| 335 | + WriterFeatures::DeleteionVecotrs => "deletionVectors", |
| 336 | + WriterFeatures::RowTracking => "rowTracking", |
| 337 | + WriterFeatures::TimestampWithoutTimezone => "timestampNtz", |
| 338 | + WriterFeatures::DomainMetadata => "domainMetadata", |
| 339 | + WriterFeatures::V2Checkpoint => "v2Checkpoint", |
| 340 | + WriterFeatures::IcebergCompatV1 => "icebergCompatV1", |
| 341 | + WriterFeatures::Other(f) => f, |
| 342 | + } |
| 343 | + } |
| 344 | +} |
| 345 | + |
| 346 | +impl fmt::Display for WriterFeatures { |
| 347 | + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| 348 | + write!(f, "{}", self.as_ref()) |
| 349 | + } |
| 350 | +} |
| 351 | + |
306 | 352 | #[cfg(all(not(feature = "parquet2"), feature = "parquet"))] |
307 | 353 | impl From<&parquet::record::Field> for WriterFeatures { |
308 | 354 | fn from(value: &parquet::record::Field) -> Self { |
|
0 commit comments