Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(query): remove legacy crate codes #8412

Merged
merged 48 commits into from
Oct 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
76a0cab
merge
b41sh Oct 27, 2022
d375987
fix
b41sh Oct 27, 2022
226b719
merge
b41sh Oct 27, 2022
614f613
refactor(query): add comments
sundy-li Oct 26, 2022
ea61ca6
merge
b41sh Oct 27, 2022
71f01b5
refactor(query): add visitor
sundy-li Oct 26, 2022
c874c14
refactor(query): add monotonicity check
sundy-li Oct 26, 2022
5675401
refactor(query): add monotonicity check
sundy-li Oct 26, 2022
516ff05
merge
b41sh Oct 27, 2022
4bc4363
implement get_cluster_keys
b41sh Oct 27, 2022
deb6f3d
refactor(query): add append
sundy-li Oct 27, 2022
7787d3d
refactor(query): add append
sundy-li Oct 27, 2022
210269f
merge
b41sh Oct 27, 2022
aea1f74
merge
b41sh Oct 27, 2022
04f8f15
refactor(query): remove column_name
b41sh Oct 27, 2022
355713b
refactor(query): update hive
sundy-li Oct 27, 2022
c5fdd48
merge
b41sh Oct 27, 2022
2162ade
refactor(query): use SyncTypeChecker
b41sh Oct 27, 2022
13d363e
fix
b41sh Oct 27, 2022
b7aa4f2
refactor(query): PhysicalScalarParser add table
b41sh Oct 27, 2022
0582286
fix clippy
b41sh Oct 28, 2022
580f249
refactor(query): add expression
sundy-li Oct 28, 2022
7b5cf92
refactor(query): add expression
sundy-li Oct 28, 2022
ee36eb8
refactor(query): add expression
sundy-li Oct 28, 2022
7378bfa
refactor(query): rename to expression_parser
sundy-li Oct 28, 2022
97fac58
refactor(query): refactor fuse
sundy-li Oct 28, 2022
5ceb2e7
refactor(query): refactor services
sundy-li Oct 28, 2022
16d6ee8
merge
b41sh Oct 28, 2022
923358e
refactor(query): refactor
sundy-li Oct 28, 2022
a60ede8
refactor(query): refactor
sundy-li Oct 28, 2022
36eb297
refactor(query): refactor
sundy-li Oct 28, 2022
0d1fb5b
refactor(query): merge main
sundy-li Oct 28, 2022
d92409d
refactor(query): fix bug
sundy-li Oct 28, 2022
66ee67a
refactor(query): fix bugs
sundy-li Oct 28, 2022
73bb7fe
refactor(query): fix tests
sundy-li Oct 28, 2022
870c3e0
refactor(query): fix nullable filter
sundy-li Oct 29, 2022
b20dd9c
refactor(query): fix pretty name
sundy-li Oct 29, 2022
8f01427
refactor(query): fix tests
sundy-li Oct 29, 2022
d3e56af
refactor(query): fix tests
sundy-li Oct 29, 2022
22e4b0f
refactor(query): fix main
sundy-li Oct 29, 2022
e0ec48b
refactor(query): fix main
sundy-li Oct 29, 2022
1ac0200
fix
b41sh Oct 29, 2022
05f945c
refactor(query): fix unit test
b41sh Oct 30, 2022
3ab9e25
refactor(query): fix taplo
b41sh Oct 30, 2022
a760be3
refactor(query): fix clippy
b41sh Oct 30, 2022
96dce85
refactor(query): fix test
b41sh Oct 30, 2022
aacb4cd
refactor(query): fix tests
sundy-li Oct 31, 2022
452c5a5
Merge branch 'main' into remove-expression-executor
mergify[bot] Oct 31, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 15 additions & 72 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,12 @@ members = [
"src/query/formats",
"src/query/functions",
"src/query/functions-v2",
"src/query/legacy-parser",
"src/query/management",
"src/query/planner",
"src/query/pipeline/core",
"src/query/pipeline/sinks",
"src/query/pipeline/sources",
"src/query/pipeline/transforms",
"src/query/legacy-expression",
"src/query/legacy-planners",
"src/query/settings",
"src/query/sql",
"src/query/storages/cache",
Expand Down
1 change: 0 additions & 1 deletion src/query/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Databend Query is a Distributed Query Engine at scale.
- [`formats`](./formats/), the serialization and deserialization of data in various formats to the outside.
- [`functions`](./functions/), scalar functions and aggregate functions, etc., will be gradually migrated to `functions-v2`.
- [`functions-v2`](./functions-v2/), scalar functions and aggregate functions, etc., based on `expression`.
- [`legacy-parser`](./legacy-parser/), the old parser, which will be replaced by ast, built with sqlparser-rs.
- [`menagement`](./menagement/) for clusters, quotas, etc.
- [`pipeline`](./pipeline/) implements the scheduling framework for physical operators.
- [`planners`](./planners/) builds an execution plan from the user's SQL statement and represents the query with different types of relational operators.
Expand Down
3 changes: 1 addition & 2 deletions src/query/catalog/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@ common-datavalues = { path = "../datavalues" }
common-exception = { path = "../../common/exception" }
common-functions = { path = "../functions" }
common-io = { path = "../../common/io" }
common-legacy-expression = { path = "../legacy-expression" }
common-legacy-planners = { path = "../legacy-planners" }
common-meta-app = { path = "../../meta/app" }
common-meta-types = { path = "../../meta/types" }
common-pipeline-core = { path = "../pipeline/core" }
common-planner = { path = "../planner" }
common-settings = { path = "../settings" }
common-storage = { path = "../../common/storage" }

Expand Down
16 changes: 8 additions & 8 deletions src/query/catalog/src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ use common_datavalues::DataSchemaRef;
use common_datavalues::DataValue;
use common_exception::ErrorCode;
use common_exception::Result;
use common_legacy_expression::LegacyExpression;
use common_legacy_planners::DeletePlan;
use common_legacy_planners::Extras;
use common_legacy_planners::Partitions;
use common_legacy_planners::ReadDataSourcePlan;
use common_legacy_planners::Statistics;
use common_meta_app::schema::TableInfo;
use common_meta_types::MetaId;
use common_pipeline_core::Pipeline;
use common_planner::extras::Extras;
use common_planner::extras::Statistics;
use common_planner::plans::DeletePlan;
use common_planner::Expression;
use common_planner::Partitions;
use common_planner::ReadDataSourcePlan;
use common_storage::StorageMetrics;

use crate::table::column_stats_provider_impls::DummyColumnStatisticsProvider;
Expand Down Expand Up @@ -90,7 +90,7 @@ pub trait Table: Sync + Send {
false
}

fn cluster_keys(&self) -> Vec<LegacyExpression> {
fn cluster_keys(&self) -> Vec<Expression> {
vec![]
}

Expand Down Expand Up @@ -136,7 +136,7 @@ pub trait Table: Sync + Send {
)))
}

fn table_args(&self) -> Option<Vec<LegacyExpression>> {
fn table_args(&self) -> Option<Vec<DataValue>> {
None
}

Expand Down
4 changes: 2 additions & 2 deletions src/query/catalog/src/table_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use common_legacy_expression::LegacyExpression;
use common_datavalues::DataValue;

pub type TableArgs = Option<Vec<LegacyExpression>>;
pub type TableArgs = Option<Vec<DataValue>>;
6 changes: 3 additions & 3 deletions src/query/catalog/src/table_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ use common_datablocks::DataBlock;
use common_exception::Result;
use common_functions::scalars::FunctionContext;
use common_io::prelude::FormatSettings;
use common_legacy_planners::PartInfoPtr;
use common_legacy_planners::Partitions;
use common_legacy_planners::ReadDataSourcePlan;
use common_meta_types::RoleInfo;
use common_meta_types::UserInfo;
use common_planner::PartInfoPtr;
use common_planner::Partitions;
use common_planner::ReadDataSourcePlan;
use common_settings::Settings;
use common_storage::DataOperator;
use common_storage::StorageMetrics;
Expand Down
9 changes: 7 additions & 2 deletions src/query/datablocks/src/data_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,10 @@ impl DataBlock {
}

#[inline]
pub fn remove_column(self, name: &str) -> Result<Self> {
pub fn remove_column_index(self, idx: usize) -> Result<Self> {
let mut columns = self.columns.clone();
let mut fields = self.schema().fields().clone();

let idx = self.schema.index_of(name)?;
columns.remove(idx);
fields.remove(idx);
let new_schema = Arc::new(DataSchema::new(fields));
Expand All @@ -220,6 +219,12 @@ impl DataBlock {
})
}

#[inline]
pub fn remove_column(self, name: &str) -> Result<Self> {
let idx = self.schema.index_of(name)?;
self.remove_column_index(idx)
}

#[inline]
pub fn resort(self, schema: DataSchemaRef) -> Result<Self> {
let mut columns = Vec::with_capacity(self.num_columns());
Expand Down
14 changes: 13 additions & 1 deletion src/query/datavalues/src/columns/primitive/primitive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,17 @@ impl<T: PrimitiveType> PrimitiveColumn<T> {
// for all the timestamp column we will cast to int64 with microsecond precision
ArrowDataType::Timestamp(x, _) => {
let p = convert_precision_to_micros(x);

if p == (1, 1) {
let array = array.as_any().downcast_ref::<PrimitiveArray<T>>().unwrap();
return Self::new(array.clone());
}

let array = array
.as_any()
.downcast_ref::<PrimitiveArray<i64>>()
.expect("primitive cast should be ok");

let array = unary(array, |x| x * p.0 / p.1, expected_arrow);

Self::from_arrow_array(&array)
Expand All @@ -104,11 +111,16 @@ impl<T: PrimitiveType> PrimitiveColumn<T> {
.expect("primitive cast should be ok");

let array = unary(array, |x| x as i64 * p.0 / p.1, expected_arrow);

Self::from_arrow_array(&array)
}
ArrowDataType::Time64(x) => {
let p = convert_precision_to_micros(x);

if p == (1, 1) {
let array = array.as_any().downcast_ref::<PrimitiveArray<T>>().unwrap();
return Self::new(array.clone());
}

let array = array
.as_any()
.downcast_ref::<PrimitiveArray<i64>>()
Expand Down
Loading