Skip to content

Commit 1ddfb0f

Browse files
committed
Update avro support
1 parent 724b1c4 commit 1ddfb0f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

datafusion/src/avro_to_arrow/schema.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
use crate::arrow::datatypes::{DataType, IntervalUnit, Schema, TimeUnit};
18+
use crate::arrow::datatypes::{DataType, IntervalUnit, Schema, TimeUnit, UnionMode};
1919
use crate::error::{DataFusionError, Result};
2020
use arrow::datatypes::Field;
2121
use avro_rs::schema::Name;
@@ -103,7 +103,7 @@ fn schema_to_field_with_props(
103103
.iter()
104104
.map(|s| schema_to_field_with_props(s, None, has_nullable, None))
105105
.collect::<Result<Vec<Field>>>()?;
106-
DataType::Union(fields)
106+
DataType::Union(fields, UnionMode::Dense)
107107
}
108108
}
109109
AvroSchema::Record { name, fields, .. } => {
@@ -201,6 +201,7 @@ fn default_field_name(dt: &DataType) -> &str {
201201
DataType::Interval(unit) => match unit {
202202
IntervalUnit::YearMonth => "intervalyear",
203203
IntervalUnit::DayTime => "intervalmonth",
204+
IntervalUnit::MonthDayNano => "intervalmonthdaynano",
204205
},
205206
DataType::Binary => "varbinary",
206207
DataType::FixedSizeBinary(_) => "fixedsizebinary",
@@ -211,7 +212,7 @@ fn default_field_name(dt: &DataType) -> &str {
211212
DataType::FixedSizeList(_, _) => "fixed_size_list",
212213
DataType::LargeList(_) => "largelist",
213214
DataType::Struct(_) => "struct",
214-
DataType::Union(_) => "union",
215+
DataType::Union(_, _) => "union",
215216
DataType::Dictionary(_, _) => "map",
216217
DataType::Map(_, _) => unimplemented!("Map support not implemented"),
217218
DataType::Decimal(_, _) => "decimal",

0 commit comments

Comments
 (0)