niebayes opened a new issue, #15210:
URL: https://github.com/apache/datafusion/issues/15210
### Describe the bug
If a DataFusion schema contains a timestamp column with timezone other than
"UTC", the roundtrip fails.
Specifically, converts the schema to substrait named struct and then
converts the named struct back to schema, the reconstructed schema must have a
timestamp column with timezone being "UTC", other than the original timezone.
### To Reproduce
#[test]
fn named_struct_names() -> Result<()> {
let schema = DFSchemaRef::new(DFSchema::try_from(Schema::new(vec![
Field::new("int", DataType::Int32, true),
Field::new(
"struct",
DataType::Struct(Fields::from(vec![Field::new(
"inner",
DataType::List(Arc::new(Field::new_list_field(DataType::Utf8, true))),
true,
)])),
true,
),
Field::new("trailer", DataType::Float64, true),
Field::new("time", DataType::Timestamp(TimeUnit::Second, None),
true),
Field::new(
"time_with_tz",
DataType::Timestamp(TimeUnit::Second, Some("+00:00".into())),
true,
),
]))?);
let named_struct = to_substrait_named_struct(&schema)?;
// Struct field names should be flattened DFS style
// List field names should be omitted
assert_eq!(
named_struct.names,
vec!["int", "struct", "inner", "trailer", "time", "time_with_tz"]
);
let roundtrip_schema =
from_substrait_named_struct(&test_consumer(), &named_struct)?;
assert_eq!(schema.as_ref(), &roundtrip_schema);
Ok(())
}
### Expected behavior
_No response_
### Additional context
_No response_
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]