Skip to content

Commit 2b2a1f6

Browse files
committed
refactor: Move COUNT_STAR_EXPANSION to datafusion_common
1 parent d9f1af3 commit 2b2a1f6

File tree

6 files changed

+36
-11
lines changed

6 files changed

+36
-11
lines changed

datafusion-cli/Cargo.lock

Lines changed: 8 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

datafusion/common/src/utils/expr.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
//! Expression utilities
19+
20+
use crate::ScalarValue;
21+
22+
/// The value to which `COUNT(*)` is expanded to in
23+
/// `COUNT(<constant>)` expressions
24+
pub const COUNT_STAR_EXPANSION: ScalarValue = ScalarValue::Int64(Some(1));

datafusion/common/src/utils/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
//! This module provides the bisect function, which implements binary search.
1919
20+
pub mod expr;
2021
pub mod memory;
2122
pub mod proxy;
2223

datafusion/expr/src/utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ use datafusion_common::tree_node::{
3535
use datafusion_common::utils::get_at_indices;
3636
use datafusion_common::{
3737
internal_err, plan_datafusion_err, plan_err, Column, DFSchema, DFSchemaRef, Result,
38-
ScalarValue, TableReference,
38+
TableReference,
3939
};
4040

4141
use sqlparser::ast::{ExceptSelectItem, ExcludeSelectItem, WildcardAdditionalOptions};
4242

4343
/// The value to which `COUNT(*)` is expanded to in
4444
/// `COUNT(<constant>)` expressions
45-
pub const COUNT_STAR_EXPANSION: ScalarValue = ScalarValue::Int64(Some(1));
45+
pub use datafusion_common::utils::expr::COUNT_STAR_EXPANSION;
4646

4747
/// Recursively walk a list of expression trees, collecting the unique set of columns
4848
/// referenced in the expression

datafusion/physical-optimizer/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,5 @@ workspace = true
3434
[dependencies]
3535
datafusion-common = { workspace = true, default-features = true }
3636
datafusion-execution = { workspace = true }
37-
datafusion-expr = { workspace = true }
3837
datafusion-physical-expr = { workspace = true }
3938
datafusion-physical-plan = { workspace = true }

datafusion/physical-optimizer/src/aggregate_statistics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use datafusion_physical_plan::{expressions, AggregateExpr, ExecutionPlan, Statis
2828
use crate::PhysicalOptimizerRule;
2929
use datafusion_common::stats::Precision;
3030
use datafusion_common::tree_node::{Transformed, TransformedResult, TreeNode};
31-
use datafusion_expr::utils::COUNT_STAR_EXPANSION;
31+
use datafusion_common::utils::expr::COUNT_STAR_EXPANSION;
3232
use datafusion_physical_plan::placeholder_row::PlaceholderRowExec;
3333
use datafusion_physical_plan::udaf::AggregateFunctionExpr;
3434

0 commit comments

Comments
 (0)