Skip to content

Commit

Permalink
Merge pull request #2904 from mshauneu/angle
Browse files Browse the repository at this point in the history
angles function not support NULL input like MySQL #2844
  • Loading branch information
BohuTANG authored Nov 20, 2021
2 parents 2984e24 + acf76ba commit 4ecf18d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion common/functions/src/scalars/maths/angle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ where T: AngleConvertFunction + Clone + Sync + Send + 'static
}

fn return_type(&self, args: &[DataType]) -> Result<DataType> {
if is_numeric(&args[0]) || args[0] == DataType::String {
if is_numeric(&args[0]) || args[0] == DataType::String || args[0] == DataType::Null {
Ok(DataType::Float64)
} else {
Err(ErrorCode::IllegalDataType(format!(
Expand Down
8 changes: 4 additions & 4 deletions common/functions/tests/it/scalars/maths/angle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,18 @@ fn test_angle_function() -> Result<()> {
name: "degress-passed",
display: "degrees",
nullable: false,
columns: Series::new(vec![PI, PI / 2.0]).into(),
columns: Series::new([Some(PI), Some(PI / 2.0), None]).into(),
func: DegressFunction::try_create("degrees")?,
expect: Series::new(vec![180_f64, 90.0]).into(),
expect: Series::new([Some(180_f64), Some(90.0), None]).into(),
error: "",
},
Test {
name: "radians-passed",
display: "radians",
nullable: false,
columns: Series::new(vec![180]).into(),
columns: Series::new([Some(180), None]).into(),
func: RadiansFunction::try_create("radians")?,
expect: Series::new(vec![PI]).into(),
expect: Series::new([Some(PI), None]).into(),
error: "",
},
];
Expand Down

0 comments on commit 4ecf18d

Please sign in to comment.