viirya commented on code in PR #107:
URL:
https://github.com/apache/arrow-datafusion-comet/pull/107#discussion_r1501751149
##########
core/src/execution/datafusion/expressions/cast.rs:
##########
@@ -75,8 +75,40 @@ impl Cast {
fn cast_array(&self, array: ArrayRef) -> DataFusionResult<ArrayRef> {
let array = array_with_timezone(array, self.timezone.clone(),
Some(&self.data_type));
let from_type = array.data_type();
- let cast_result = cast_with_options(&array, &self.data_type,
&CAST_OPTIONS)?;
- Ok(spark_cast(cast_result, from_type, &self.data_type))
+ let to_type = &self.data_type;
+ let cast_result = match (from_type, to_type) {
+ (DataType::Utf8, DataType::Boolean) =>
Self::spark_cast_utf8_to_boolean::<i32>(&array),
+ (DataType::LargeUtf8, DataType::Boolean) => {
+ Self::spark_cast_utf8_to_boolean::<i64>(&array)
+ }
+ _ => cast_with_options(&array, &self.data_type, &CAST_OPTIONS)?,
+ };
+ let result = spark_cast(cast_result, from_type, &self.data_type);
Review Comment:
```suggestion
let result = spark_cast(cast_result, from_type, to_type);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]