Skip to content

Commit 89adc88

Browse files
committed
Merge remote-tracking branch 'apache/main' into issue-10971
2 parents 206b274 + 5f02c8a commit 89adc88

File tree

10 files changed

+25
-20
lines changed

10 files changed

+25
-20
lines changed

datafusion-cli/src/catalog.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,13 +236,14 @@ mod tests {
236236
fn setup_context() -> (SessionContext, Arc<dyn SchemaProvider>) {
237237
let mut ctx = SessionContext::new();
238238
ctx.register_catalog_list(Arc::new(DynamicFileCatalog::new(
239-
ctx.state().catalog_list(),
239+
ctx.state().catalog_list().clone(),
240240
ctx.state_weak_ref(),
241241
)));
242242

243-
let provider =
244-
&DynamicFileCatalog::new(ctx.state().catalog_list(), ctx.state_weak_ref())
245-
as &dyn CatalogProviderList;
243+
let provider = &DynamicFileCatalog::new(
244+
ctx.state().catalog_list().clone(),
245+
ctx.state_weak_ref(),
246+
) as &dyn CatalogProviderList;
246247
let catalog = provider
247248
.catalog(provider.catalog_names().first().unwrap())
248249
.unwrap();

datafusion-cli/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ async fn main_inner() -> Result<()> {
180180
ctx.refresh_catalogs().await?;
181181
// install dynamic catalog provider that knows how to open files
182182
ctx.register_catalog_list(Arc::new(DynamicFileCatalog::new(
183-
ctx.state().catalog_list(),
183+
ctx.state().catalog_list().clone(),
184184
ctx.state_weak_ref(),
185185
)));
186186
// register `parquet_metadata` table function to get metadata from parquet files

datafusion/common/src/scalar/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1077,7 +1077,7 @@ impl ScalarValue {
10771077
DataType::Float64 => ScalarValue::Float64(Some(10.0)),
10781078
_ => {
10791079
return _not_impl_err!(
1080-
"Can't create a negative one scalar from data_type \"{datatype:?}\""
1080+
"Can't create a ten scalar from data_type \"{datatype:?}\""
10811081
);
10821082
}
10831083
})

datafusion/core/src/execution/context/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1856,7 +1856,7 @@ mod tests {
18561856

18571857
let catalog_list_weak = {
18581858
let state = ctx.state.read();
1859-
Arc::downgrade(&state.catalog_list())
1859+
Arc::downgrade(state.catalog_list())
18601860
};
18611861

18621862
drop(ctx);

datafusion/core/src/execution/session_state.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -807,8 +807,8 @@ impl SessionState {
807807
}
808808

809809
/// Return catalog list
810-
pub fn catalog_list(&self) -> Arc<dyn CatalogProviderList> {
811-
self.catalog_list.clone()
810+
pub fn catalog_list(&self) -> &Arc<dyn CatalogProviderList> {
811+
&self.catalog_list
812812
}
813813

814814
/// set the catalog list
@@ -840,8 +840,8 @@ impl SessionState {
840840
}
841841

842842
/// Return [SerializerRegistry] for extensions
843-
pub fn serializer_registry(&self) -> Arc<dyn SerializerRegistry> {
844-
self.serializer_registry.clone()
843+
pub fn serializer_registry(&self) -> &Arc<dyn SerializerRegistry> {
844+
&self.serializer_registry
845845
}
846846

847847
/// Return version of the cargo package that produced this query

datafusion/expr/src/expr.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,6 +1329,7 @@ impl Expr {
13291329
}
13301330

13311331
/// Return all referenced columns of this expression.
1332+
#[deprecated(since = "40.0.0", note = "use Expr::column_refs instead")]
13321333
pub fn to_columns(&self) -> Result<HashSet<Column>> {
13331334
let mut using_columns = HashSet::new();
13341335
expr_to_columns(self, &mut using_columns)?;

datafusion/expr/src/logical_plan/builder.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ use crate::logical_plan::{
3939
use crate::type_coercion::binary::{comparison_coercion, values_coercion};
4040
use crate::utils::{
4141
can_hash, columnize_expr, compare_sort_expr, expand_qualified_wildcard,
42-
expand_wildcard, find_valid_equijoin_key_pair, group_window_expr_by_sort_keys,
42+
expand_wildcard, expr_to_columns, find_valid_equijoin_key_pair,
43+
group_window_expr_by_sort_keys,
4344
};
4445
use crate::{
4546
and, binary_expr, logical_plan::tree_node::unwrap_arc, DmlStatement, Expr,
@@ -1070,14 +1071,16 @@ impl LogicalPlanBuilder {
10701071
let left_key = l.into();
10711072
let right_key = r.into();
10721073

1073-
let left_using_columns = left_key.to_columns()?;
1074+
let mut left_using_columns = HashSet::new();
1075+
expr_to_columns(&left_key, &mut left_using_columns)?;
10741076
let normalized_left_key = normalize_col_with_schemas_and_ambiguity_check(
10751077
left_key,
10761078
&[&[self.plan.schema(), right.schema()]],
10771079
&[left_using_columns],
10781080
)?;
10791081

1080-
let right_using_columns = right_key.to_columns()?;
1082+
let mut right_using_columns = HashSet::new();
1083+
expr_to_columns(&right_key, &mut right_using_columns)?;
10811084
let normalized_right_key = normalize_col_with_schemas_and_ambiguity_check(
10821085
right_key,
10831086
&[&[self.plan.schema(), right.schema()]],

datafusion/expr/src/udaf.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ impl AggregateUDF {
124124
}
125125

126126
/// Return the underlying [`AggregateUDFImpl`] trait object for this function
127-
pub fn inner(&self) -> Arc<dyn AggregateUDFImpl> {
128-
self.inner.clone()
127+
pub fn inner(&self) -> &Arc<dyn AggregateUDFImpl> {
128+
&self.inner
129129
}
130130

131131
/// Adds additional names that can be used to invoke this function, in

datafusion/expr/src/udf.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ impl ScalarUDF {
105105
}
106106

107107
/// Return the underlying [`ScalarUDFImpl`] trait object for this function
108-
pub fn inner(&self) -> Arc<dyn ScalarUDFImpl> {
109-
self.inner.clone()
108+
pub fn inner(&self) -> &Arc<dyn ScalarUDFImpl> {
109+
&self.inner
110110
}
111111

112112
/// Adds additional names that can be used to invoke this function, in

datafusion/expr/src/udwf.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ impl WindowUDF {
108108
}
109109

110110
/// Return the underlying [`WindowUDFImpl`] trait object for this function
111-
pub fn inner(&self) -> Arc<dyn WindowUDFImpl> {
112-
self.inner.clone()
111+
pub fn inner(&self) -> &Arc<dyn WindowUDFImpl> {
112+
&self.inner
113113
}
114114

115115
/// Adds additional names that can be used to invoke this function, in

0 commit comments

Comments
 (0)