alamb commented on a change in pull request #1465:
URL: https://github.com/apache/arrow-datafusion/pull/1465#discussion_r785020888
##########
File path: datafusion/src/physical_plan/expressions/cast.rs
##########
@@ -158,14 +158,66 @@ pub fn cast(
#[cfg(test)]
mod tests {
use super::*;
+ use crate::arrow::array::{DecimalArray, DecimalBuilder};
use crate::error::Result;
use crate::physical_plan::expressions::col;
use arrow::array::{StringArray, Time64NanosecondArray};
use arrow::{
- array::{Array, Int32Array, Int64Array, TimestampNanosecondArray,
UInt32Array},
+ array::{
+ Array, Float32Array, Float64Array, Int16Array, Int32Array,
Int64Array,
+ Int8Array, TimestampNanosecondArray, UInt32Array,
+ },
datatypes::*,
};
+ // runs an end-to-end test of physical type cast
+ // 1. construct a record batch with a column "a" of type A
+ // 2. construct a physical expression of CAST(a AS B)
+ // 3. evaluate the expression
+ // 4. verify that the resulting expression is of type B
+ // 5. verify that the resulting values are downcastable and correct
+ macro_rules! generic_decimal_to_other_test_cast {
Review comment:
its unfortunate that this code shares so much with `generic_test_cast`
(seems like everything except the creation of the array). I wonder if it would
be possible to refactor the validation so that it could be shared.
--
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]