Skip to content

Commit

Permalink
add date support
Browse files Browse the repository at this point in the history
  • Loading branch information
andygrove committed Mar 14, 2019
1 parent 5a3368c commit 80cf303
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion rust/parquet/src/reader/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use crate::basic::{LogicalType, Repetition, Type as PhysicalType};
use crate::errors::{ParquetError::ArrowError, Result};
use crate::schema::types::{SchemaDescPtr, Type, TypePtr};

use arrow::datatypes::{DataType, Field, Schema};
use arrow::datatypes::{DataType, DateUnit, Field, Schema};

/// Convert parquet schema to arrow schema.
pub fn parquet_to_arrow_schema(parquet_schema: SchemaDescPtr) -> Result<Schema> {
Expand Down Expand Up @@ -197,6 +197,7 @@ impl ParquetTypeConverter {
LogicalType::INT_8 => Ok(DataType::Int8),
LogicalType::INT_16 => Ok(DataType::Int16),
LogicalType::INT_32 => Ok(DataType::Int32),
LogicalType::DATE => Ok(DataType::Date32(DateUnit::Millisecond)),
other => Err(ArrowError(format!(
"Unable to convert parquet logical type {}",
other
Expand All @@ -209,6 +210,7 @@ impl ParquetTypeConverter {
LogicalType::NONE => Ok(DataType::Int64),
LogicalType::INT_64 => Ok(DataType::Int64),
LogicalType::UINT_64 => Ok(DataType::UInt64),
LogicalType::DATE => Ok(DataType::Date64(DateUnit::Millisecond)),
other => Err(ArrowError(format!(
"Unable to convert parquet logical type {}",
other
Expand Down

0 comments on commit 80cf303

Please sign in to comment.