Skip to content

Commit

Permalink
support ArrowDataType::Utf8View.
Browse files Browse the repository at this point in the history
  • Loading branch information
youngsofun committed Nov 12, 2024
1 parent 5aaad97 commit 5c5efad
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion sql/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,9 @@ impl TryFrom<&Arc<ArrowField>> for Field {
ArrowDataType::Binary
| ArrowDataType::LargeBinary
| ArrowDataType::FixedSizeBinary(_) => DataType::Binary,
ArrowDataType::Utf8 | ArrowDataType::LargeUtf8 => DataType::String,
ArrowDataType::Utf8 | ArrowDataType::LargeUtf8 | ArrowDataType::Utf8View => {
DataType::String
}
ArrowDataType::Timestamp(_, _) => DataType::Timestamp,
ArrowDataType::Date32 => DataType::Date,
ArrowDataType::Decimal128(p, s) => {
Expand Down
6 changes: 5 additions & 1 deletion sql/src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ use crate::{
schema::{DecimalDataType, DecimalSize},
};

use arrow_array::StringViewArray;
use geozero::wkb::FromWkb;
use geozero::wkb::WkbDialect;
use geozero::wkt::Ewkt;
Expand Down Expand Up @@ -402,7 +403,10 @@ impl TryFrom<(&ArrowField, &Arc<dyn ArrowArray>, usize)> for Value {
Some(array) => Ok(Value::String(array.value(seq).to_string())),
None => Err(ConvertError::new("large string", format!("{:?}", array)).into()),
},

ArrowDataType::Utf8View => match array.as_any().downcast_ref::<StringViewArray>() {
Some(array) => Ok(Value::String(array.value(seq).to_string())),
None => Err(ConvertError::new("string view", format!("{:?}", array)).into()),
},
// we only support timestamp in microsecond in databend
ArrowDataType::Timestamp(unit, tz) => {
match array.as_any().downcast_ref::<TimestampMicrosecondArray>() {
Expand Down

0 comments on commit 5c5efad

Please sign in to comment.