| 55 | |
| 56 | impl SessionStateBuilderSpark for SessionStateBuilder { |
| 57 | fn with_spark_features(mut self) -> Self { |
| 58 | self.expr_planners() |
| 59 | .get_or_insert_with(Vec::new) |
| 60 | // planners are evaluated in order of insertion. Push Apache Spark function planner to the front |
| 61 | // to take precedence over others |
| 62 | .insert(0, Arc::new(SparkFunctionPlanner)); |
| 63 | |
| 64 | self.scalar_functions() |
| 65 | .get_or_insert_with(Vec::new) |
| 66 | .extend(all_default_scalar_functions()); |
| 67 | |
| 68 | self.aggregate_functions() |
| 69 | .get_or_insert_with(Vec::new) |
| 70 | .extend(all_default_aggregate_functions()); |
| 71 | |
| 72 | self.window_functions() |
| 73 | .get_or_insert_with(Vec::new) |
| 74 | .extend(all_default_window_functions()); |
| 75 | |
| 76 | self.table_functions() |
| 77 | .get_or_insert_with(HashMap::new) |
| 78 | .extend( |
| 79 | all_default_table_functions() |
| 80 | .into_iter() |
| 81 | .map(|f| (f.name().to_string(), f)), |
| 82 | ); |
| 83 | |
| 84 | self |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | #[cfg(test)] |