alamb commented on code in PR #8290:
URL: https://github.com/apache/arrow-rs/pull/8290#discussion_r2341561173


##########
arrow-schema/src/datatype_format.rs:
##########
@@ -0,0 +1,263 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::{collections::HashMap, fmt};
+
+use crate::DataType;
+
+impl fmt::Display for DataType {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        // NOTE: `Display` and `Debug` formatting are ALWAYS the same,

Review Comment:
   > B) Replace all uses of {:?} with {} when printing datatypes in datafusion, 
arrow, and other third party crates.
   This is VERY hard to do, as I know of no automated tool to find all these 
places.
   
   I think grepping for `type:?}` and  `{:?}` would catch most of them. Maybe a 
good think to ask some AI tool to do
   
   
   
   ```shell
   (venv) andrewlamb@Andrews-MacBook-Pro-3:~/Software/arrow-rs$ grep -r 
'type:?' `find . -name '*.rs'`
   ./arrow-schema/src/datatype_parse.rs:        println!("Input 
'{data_type_string}' ({data_type:?})");
   ./arrow-schema/src/datatype_parse.rs:            println!("Parsing 
'{data_type_string}', expecting '{expected_data_type:?}'");
   ./arrow-data/src/transform/run.rs:        _ => panic!("Invalid run end type 
for RunEndEncoded array: {run_end_type:?}"),
   ./arrow-data/src/transform/run.rs:                _ => panic!("Invalid run 
end type for RunEndEncoded array: {dest_run_end_type:?}",),
   ./arrow-ipc/src/compression.rs:                "compression type 
{other_type:?} not supported "
   ./arrow-string/src/like.rs:                        "{value_type:?} «{value}» 
like {pattern_type:?} «{pattern}»"
   ./arrow-string/src/like.rs:                        "{value_type:?} «{value}» 
ilike {pattern_type:?} «{pattern}»"
   ./arrow-string/src/like.rs:                        "{value_type:?} «{value}» 
nlike {pattern_type:?} «{pattern}»"
   ./arrow-string/src/like.rs:                        "{value_type:?} «{value}» 
nilike {pattern_type:?} «{pattern}»"
   ./arrow-csv/src/reader/mod.rs:                            "Unsupported 
dictionary key type {key_type:?}"
   ./arrow-row/src/list.rs:                "Expected FixedSizeListArray, found: 
{list_type:?}",
   ./arrow-array/src/array/fixed_size_list_array.rs:                
panic!("FixedSizeListArray data should contain a FixedSizeList data type, got 
{data_type:?}")
   ./arrow-array/src/array/primitive_array.rs:        write!(f, 
"PrimitiveArray<{data_type:?}>\n[\n")?;
   ./arrow-array/src/array/primitive_array.rs:                            "Cast 
error: Failed to convert {v} to temporal for {data_type:?}"
   ./arrow-array/src/array/primitive_array.rs:                            "Cast 
error: Failed to convert {v} to temporal for {data_type:?}"
   ./arrow-array/src/record_batch.rs:                "column types must match 
schema types, expected {field_type:?} but found {col_type:?} at column index 
{i}")));
   ./arrow-array/src/ffi.rs:                "The datatype \"{data_type:?}\" 
doesn't expect buffer at index 0. Please verify that the C data interface is 
correctly implemented."
   ./arrow-array/src/ffi.rs:                "The datatype \"{data_type:?}\" 
expects 2 buffers, but requested {i}. Please verify that the C data interface 
is correctly implemented."
   ./arrow-array/src/ffi.rs:                "The datatype \"{data_type:?}\" 
expects 2 buffers, but requested {i}. Please verify that the C data interface 
is correctly implemented."
   ./arrow-array/src/ffi.rs:                "The datatype \"{data_type:?}\" 
expects 2 buffers, but requested {i}. Please verify that the C data interface 
is correctly implemented."
   ./arrow-array/src/ffi.rs:                "The datatype \"{data_type:?}\" 
expects 2 buffers, but requested {i}. Please verify that the C data interface 
is correctly implemented."
   ./arrow-array/src/ffi.rs:                "The datatype \"{data_type:?}\" 
expects 3 buffers, but requested {i}. Please verify that the C data interface 
is correctly implemented."
   ./arrow-array/src/ffi.rs:                "The datatype \"{data_type:?}\" 
expects 3 buffers, but requested {i}. Please verify that the C data interface 
is correctly implemented."
   ./arrow-array/src/ffi.rs:                "The datatype \"{data_type:?}\" 
expects 1 buffer, but requested {i}. Please verify that the C data interface is 
correctly implemented."
   ./arrow-array/src/ffi.rs:                "The datatype \"{data_type:?}\" 
expects 2 buffer, but requested {i}. Please verify that the C data interface is 
correctly implemented."
   ./arrow-array/src/ffi.rs:                "The datatype \"{data_type:?}\" 
doesn't expect buffer at index 0. Please verify that the C data interface is 
correctly implemented."
   ./arrow-array/src/ffi.rs:                "The datatype \"{data_type:?}\" is 
still not supported in Rust implementation"
   ./arrow-array/src/builder/mod.rs:                    panic!("Data type {t:?} 
with key type {key_type:?} is not currently supported")
   ./arrow-cast/src/cast/mod.rs:                "Casting from dictionary type 
{from_type:?} to {to_type:?} not supported",
   ./arrow-cast/src/cast/mod.rs:                "Casting from type 
{from_type:?} to dictionary type {to_type:?} not supported",
   ./arrow-cast/src/cast/mod.rs:            "Casting from {from_type:?} to 
{to_type:?} not supported"
   ./arrow-cast/src/cast/mod.rs:            "Casting from {from_type:?} to 
{to_type:?} not supported"
   ./arrow-cast/src/cast/mod.rs:                "Casting from {from_type:?} to 
{to_type:?} not supported",
   ./arrow-cast/src/cast/mod.rs:                "Casting from {from_type:?} to 
{to_type:?} not supported",
   ./arrow-cast/src/cast/mod.rs:                "Casting from {from_type:?} to 
{to_type:?} not supported",
   ./arrow-cast/src/cast/mod.rs:                "Casting from {from_type:?} to 
{to_type:?} not supported",
   ./arrow-cast/src/cast/mod.rs:                "Casting from {from_type:?} to 
{to_type:?} not supported",
   ./arrow-cast/src/cast/mod.rs:                "Casting from {from_type:?} to 
{to_type:?} not supported",
   ./arrow-cast/src/cast/mod.rs:                "Casting from {from_type:?} to 
{to_type:?} not supported",
   ./arrow-cast/src/cast/mod.rs:                "Casting from {from_type:?} to 
{to_type:?} not supported",
   ./arrow-cast/src/cast/mod.rs:            "Casting from {from_type:?} to 
{to_type:?} not supported",
   ./arrow-cast/src/cast/mod.rs:            "Casting from {from_type:?} to 
{to_type:?} not supported",
   ./arrow-cast/src/cast/mod.rs:            "Casting from {from_type:?} to 
{to_type:?} not supported"
   ./arrow-cast/src/cast/mod.rs:            "Casting from {from_type:?} to 
{to_type:?} not supported"
   ./arrow-cast/src/cast/dictionary.rs:                        "Unsupported 
type {to_index_type:?} for dictionary index"
   ./arrow-cast/src/cast/dictionary.rs:            "Unsupported output type for 
dictionary packing: {dict_value_type:?}"
   ./parquet/benches/arrow_reader_row_filter.rs:            let benchmark_name 
= format!("{filter_type:?}/{proj_case}",);
   ./parquet/src/record/reader.rs:                        "Map key type is 
expected to be a primitive type, but found {key_type:?}"
   ./parquet/src/arrow/arrow_reader/mod.rs:                    "data type: 
{data_type:?}, expected: {expected_err}, got: {err}"
   ./parquet/src/arrow/arrow_reader/mod.rs:                    "data type: 
{data_type:?}, expected: {expected_err}, got: {err}"
   ./parquet/src/arrow/arrow_writer/mod.rs:                    "Attempting to 
write an Arrow type {data_type:?} to parquet that is not yet implemented"
   ./parquet/src/arrow/buffer/view_buffer.rs:            _ => 
panic!("Unsupported data type: {data_type:?}"),
   ./parquet/src/schema/visitor.rs:                panic!("{list_type:?} is a 
list type and must be a group type")
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to