Skip to content

Commit 97ca610

Browse files
committed
Use psuedo type for composite
1 parent 99866b4 commit 97ca610

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

datafusion-postgres/src/datatypes.rs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ pub(crate) fn into_pg_type(df_type: &DataType) -> PgWireResult<Type> {
6666
DataType::Float64 => Type::FLOAT8_ARRAY,
6767
DataType::Utf8 => Type::VARCHAR_ARRAY,
6868
DataType::LargeUtf8 => Type::TEXT_ARRAY,
69-
struct_type @ DataType::Struct(_) => Type::new(
69+
DataType::Struct(_) => Type::new(
7070
Type::RECORD_ARRAY.name().into(),
7171
Type::RECORD_ARRAY.oid(),
72-
Kind::Array(into_pg_type(struct_type)?),
72+
Type::RECORD_ARRAY.kind().clone(),
7373
Type::RECORD_ARRAY.schema().into(),
7474
),
7575
list_type => {
@@ -90,16 +90,12 @@ pub(crate) fn into_pg_type(df_type: &DataType) -> PgWireResult<Type> {
9090
.reduce(|a, b| a + ", " + &b)
9191
.map(|x| format!("({x})"))
9292
.unwrap_or("()".to_string());
93-
let kind = Kind::Composite(
94-
fields
95-
.iter()
96-
.map(|x| {
97-
into_pg_type(x.data_type())
98-
.map(|_type| postgres_types::Field::new(x.name().clone(), _type))
99-
})
100-
.collect::<Result<Vec<_>, PgWireError>>()?,
101-
);
102-
Type::new(name, Type::RECORD.oid(), kind, Type::RECORD.schema().into())
93+
Type::new(
94+
name,
95+
Type::RECORD.oid(),
96+
Type::RECORD.kind().clone(),
97+
Type::RECORD.schema().into(),
98+
)
10399
}
104100
_ => {
105101
return Err(PgWireError::UserError(Box::new(ErrorInfo::new(

0 commit comments

Comments
 (0)