Skip to content

Commit

Permalink
Update avro support
Browse files Browse the repository at this point in the history
  • Loading branch information
alamb committed Jan 6, 2022
1 parent 724b1c4 commit 1ddfb0f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions datafusion/src/avro_to_arrow/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.

use crate::arrow::datatypes::{DataType, IntervalUnit, Schema, TimeUnit};
use crate::arrow::datatypes::{DataType, IntervalUnit, Schema, TimeUnit, UnionMode};
use crate::error::{DataFusionError, Result};
use arrow::datatypes::Field;
use avro_rs::schema::Name;
Expand Down Expand Up @@ -103,7 +103,7 @@ fn schema_to_field_with_props(
.iter()
.map(|s| schema_to_field_with_props(s, None, has_nullable, None))
.collect::<Result<Vec<Field>>>()?;
DataType::Union(fields)
DataType::Union(fields, UnionMode::Dense)
}
}
AvroSchema::Record { name, fields, .. } => {
Expand Down Expand Up @@ -201,6 +201,7 @@ fn default_field_name(dt: &DataType) -> &str {
DataType::Interval(unit) => match unit {
IntervalUnit::YearMonth => "intervalyear",
IntervalUnit::DayTime => "intervalmonth",
IntervalUnit::MonthDayNano => "intervalmonthdaynano",
},
DataType::Binary => "varbinary",
DataType::FixedSizeBinary(_) => "fixedsizebinary",
Expand All @@ -211,7 +212,7 @@ fn default_field_name(dt: &DataType) -> &str {
DataType::FixedSizeList(_, _) => "fixed_size_list",
DataType::LargeList(_) => "largelist",
DataType::Struct(_) => "struct",
DataType::Union(_) => "union",
DataType::Union(_, _) => "union",
DataType::Dictionary(_, _) => "map",
DataType::Map(_, _) => unimplemented!("Map support not implemented"),
DataType::Decimal(_, _) => "decimal",
Expand Down

0 comments on commit 1ddfb0f

Please sign in to comment.