Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiayu Liu committed May 21, 2021
1 parent a1eae86 commit f5e64de
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions datafusion/src/physical_plan/window_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,12 @@ pub enum WindowFunction {
impl FromStr for WindowFunction {
type Err = DataFusionError;
fn from_str(name: &str) -> Result<WindowFunction> {
if let Ok(aggregate) = AggregateFunction::from_str(name) {
let name = name.to_lowercase();
if let Ok(aggregate) = AggregateFunction::from_str(name.as_str()) {
Ok(WindowFunction::AggregateFunction(aggregate))
} else if let Ok(built_in_function) = BuiltInWindowFunction::from_str(name) {
} else if let Ok(built_in_function) =
BuiltInWindowFunction::from_str(name.as_str())
{
Ok(WindowFunction::BuiltInWindowFunction(built_in_function))
} else {
Err(DataFusionError::Plan(format!(
Expand Down Expand Up @@ -180,7 +183,7 @@ mod tests {
use super::*;

#[test]
fn test_window_function_from_str_to_str_round_trip_eq() -> Result<()> {
fn test_window_function_case_insensitive() -> Result<()> {
let names = vec![
"row_number",
"rank",
Expand All @@ -201,8 +204,6 @@ mod tests {
];
for name in names {
let fun = WindowFunction::from_str(name)?;
assert_eq!(fun.to_string(), name.to_uppercase());

let fun2 = WindowFunction::from_str(name.to_uppercase().as_str())?;
assert_eq!(fun, fun2);
}
Expand Down

0 comments on commit f5e64de

Please sign in to comment.