Apache DataFusion SQL Query Engine
Move SQL Query Planner into new `datafusion-sql` crate (#2588)
Andy Grovedde6f71202ab
diff --git a/Cargo.toml b/Cargo.tomlindex 813d9e94f5..db2cc46e90 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -25,6 +25,7 @@ members = ["datafusion/physical-expr","datafusion/proto","datafusion/row",+ "datafusion/sql","datafusion-examples","benchmarks",]diff --git a/datafusion/core/Cargo.toml b/datafusion/core/Cargo.tomlindex 6c541059b5..f8170443e2 100644--- a/datafusion/core/Cargo.toml+++ b/datafusion/core/Cargo.toml@@ -51,7 +51,7 @@ regex_expressions = ["datafusion-physical-expr/regex_expressions"]# Used to enable schedulerscheduler = ["rayon"]simd = ["arrow/simd"]-unicode_expressions = ["datafusion-physical-expr/regex_expressions"]+unicode_expressions = ["datafusion-physical-expr/regex_expressions", "datafusion-sql/unicode_expressions"][dependencies]ahash = { version = "0.7", default-features = false }@@ -65,6 +65,7 @@ datafusion-expr = { path = "../expr", version = "8.0.0" }datafusion-jit = { path = "../jit", version = "8.0.0", optional = true }datafusion-physical-expr = { path = "../physical-expr", version = "8.0.0" }datafusion-row = { path = "../row", version = "8.0.0" }+datafusion-sql = { path = "../sql", version = "8.0.0" }futures = "0.3"hashbrown = { version = "0.12", features = ["raw"] }lazy_static = { version = "^1.4.0" }diff --git a/datafusion/core/src/catalog/mod.rs b/datafusion/core/src/catalog/mod.rsindex b9bf03e4f9..0720f451ec 100644--- a/datafusion/core/src/catalog/mod.rs+++ b/datafusion/core/src/catalog/mod.rs@@ -23,109 +23,4 @@ pub mod catalog;pub mod information_schema;pub mod schema;-/// Represents a resolved path to a table of the form "catalog.schema.table"-#[derive(Clone, Copy)]-pub struct ResolvedTableReference<'a> {- /// The catalog (aka database) containing the table- pub catalog: &'a str,- /// The schema containing the table- pub schema: &'a str,- /// The table name- pub table: &'a str,-}--/// Represents a path to a table that may require further resolution-#[derive(Clone, Copy)]-pub enum TableReference<'a> {- /// An unqualified table reference, e.g. "table"- Bare {- /// The table name- table: &'a str,- },- /// A partially resolved table reference, e.g. "schema.table"- Partial {- /// The schema containing the table- schema: &'a str,- /// The table name- table: &'a str,- },- /// A fully resolved table reference, e.g. "catalog.schema.table"- Full {- /// The catalog (aka database) containing the table- catalog: &'a str,- /// The schema containing the table- schema: &'a str,- /// The table name- table: &'a str,- },-}--impl<'a> TableReference<'a> {- /// Retrieve the actual table name, regardless of qualification- pub fn table(&self) -> &str {- match self {- Self::Full { table, .. }- | Self::Partial { table, .. }- | Self::Bare { table } => table,- }- }-- /// Given a default catalog and schema, ensure this table reference is fully resolved- pub fn resolve(- self,- default_catalog: &'a str,- default_schema: &'a str,- ) -> ResolvedTableReference<'a> {- match self {- Self::Full {- catalog,- schema,- table,- } => ResolvedTableReference {- catalog,- schema,- table,- },- Self::Partial { schema, table } => ResolvedTableReference {- catalog: default_catalog,- schema,- table,- },- Self::Bare { table } => ResolvedTableReference {- catalog: default_catalog,- schema: default_schema,- table,- },- }- }-}--impl<'a> From<&'a str> for TableReference<'a> {- fn from(s: &'a str) -> Self {- let parts: Vec<&str> = s.split('.').collect();-- match parts.len() {- 1 => Self::Bare { table: s },- 2 => Self::Partial {- schema: parts[0],- table: parts[1],- },- 3 => Self::Full {- catalog: parts[0],- schema: parts[1],- table: parts[2],- },- _ => Self::Bare { table: s },- }- }-}--impl<'a> From<ResolvedTableReference<'a>> for TableReference<'a> {- fn from(resolved: ResolvedTableReference<'a>) -> Self {- Self::Full {- catalog: resolved.catalog,- schema: resolved.schema,- table: resolved.table,- }- }-}+pub use datafusion_sql::{ResolvedTableReference, TableReference};diff --git a/datafusion/core/src/execution/context.rs b/datafusion/core/src/execution/context.rsindex 629adf137f..619ac13b13 100644--- a/datafusion/core/src/execution/context.rs+++ b/datafusion/core/src/execution/context.rs@@ -54,7 +54,6 @@ use arrow::datatypes::{DataType, SchemaRef};use crate::catalog::{catalog::{CatalogProvider, MemoryCatalogProvider},schema::{MemorySchemaProvider, SchemaProvider},- ResolvedTableReference, TableReference,};use crate::dataframe::DataFrame;use crate::datasource::listing::ListingTableConfig;@@ -73,6 +72,7 @@ use crate::optimizer::projection_push_down::ProjectionPushDown;use crate::optimizer::simplify_expressions::SimplifyExpressions;use crate::optimizer::single_distinct_to_groupby::SingleDistinctToGroupBy;use crate::optimizer::subquery_filter_to_join::SubqueryFilterToJoin;+use datafusion_sql::{ResolvedTableReference, TableReference};use crate::physical_optimizer::coalesce_batches::CoalesceBatches;use crate::physical_optimizer::merge_exec::AddCoalescePartitionsExec;@@ -86,13 +86,14 @@ use crate::physical_plan::udaf::AggregateUDF;use crate::physical_plan::udf::ScalarUDF;use crate::physical_plan::ExecutionPlan;use crate::physical_plan::PhysicalPlanner;-use crate::sql::{- parser::DFParser,- planner::{ContextProvider, SqlToRel},-};use crate::variable::{VarProvider, VarType};use async_trait::async_trait;use chrono::{DateTime, Utc};+use datafusion_expr::TableSource;+use datafusion_sql::{+ parser::DFParser,+ planner::{ContextProvider, SqlToRel},+};use parquet::file::properties::WriterProperties;use uuid::Uuid;@@ -1423,15 +1424,18 @@ impl SessionState {}impl ContextProvider for SessionState {- fn get_table_provider(&self, name: TableReference) -> Result<Arc<dyn TableProvider>> {+ fn get_table_provider(&self, name: TableReference) -> Result<Arc<dyn TableSource>> {let resolved_ref = self.resolve_table_ref(name);match self.schema_for_ref(resolved_ref) {- Ok(schema) => schema.table(resolved_ref.table).ok_or_else(|| {- DataFusionError::Plan(format!(- "'{}.{}.{}' not found",- resolved_ref.catalog, resolved_ref.schema, resolved_ref.table- ))- }),+ Ok(schema) => {+ let provider = schema.table(resolved_ref.table).ok_or_else(|| {+ DataFusionError::Plan(format!(+ "'{}.{}.{}' not found",+ resolved_ref.catalog, resolved_ref.schema, resolved_ref.table+ ))+ })?;+ Ok(provider_as_source(provider))+ }Err(e) => Err(e),}}diff --git a/datafusion/core/src/lib.rs b/datafusion/core/src/lib.rsindex b553c0ed84..600e24fb8f 100644--- a/datafusion/core/src/lib.rs+++ b/datafusion/core/src/lib.rs@@ -220,7 +220,6 @@ pub mod prelude;pub mod scalar;#[cfg(feature = "scheduler")]pub mod scheduler;-pub mod sql;pub mod variable;// re-export dependencies from arrow-rs to minimise version maintenance for crate users@@ -232,6 +231,7 @@ pub use datafusion_common as common;pub use datafusion_data_access;pub use datafusion_expr as logical_expr;pub use datafusion_physical_expr as physical_expr;+pub use datafusion_sql as sql;pub use datafusion_row as row;diff --git a/datafusion/core/src/physical_plan/planner.rs b/datafusion/core/src/physical_plan/planner.rsindex 27dd46b072..50e86e1712 100644--- a/datafusion/core/src/physical_plan/planner.rs+++ b/datafusion/core/src/physical_plan/planner.rs@@ -53,7 +53,6 @@ use crate::physical_plan::windows::WindowAggExec;use crate::physical_plan::{join_utils, Partitioning};use crate::physical_plan::{AggregateExpr, ExecutionPlan, PhysicalExpr, WindowExpr};use crate::scalar::ScalarValue;-use crate::sql::utils::window_expr_common_partition_keys;use crate::variable::VarType;use crate::{error::{DataFusionError, Result},@@ -65,6 +64,7 @@ use arrow::{compute::can_cast_types, datatypes::DataType};use async_trait::async_trait;use datafusion_expr::expr::GroupingSet;use datafusion_physical_expr::expressions::DateIntervalExpr;+use datafusion_sql::utils::window_expr_common_partition_keys;use futures::future::BoxFuture;use futures::{FutureExt, StreamExt, TryStreamExt};use log::{debug, trace};diff --git a/datafusion/sql/Cargo.toml b/datafusion/sql/Cargo.tomlnew file mode 100644index 0000000000..673823c37a--- /dev/null+++ b/datafusion/sql/Cargo.toml@@ -0,0 +1,46 @@+# Licensed to the Apache Software Foundation (ASF) under one+# or more contributor license agreements. See the NOTICE file+# distributed with this work for additional information+# regarding copyright ownership. The ASF licenses this file+# to you under the Apache License, Version 2.0 (the+# "License"); you may not use this file except in compliance+# with the License. You may obtain a copy of the License at+#+# http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing,+# software distributed under the License is distributed on an+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+# KIND, either express or implied. See the License for the+# specific language governing permissions and limitations+# under the License.++[package]+name = "datafusion-sql"+description = "DataFusion SQL Query Planner"+version = "8.0.0"+homepage = "https://github.com/apache/arrow-datafusion"+repository = "https://github.com/apache/arrow-datafusion"+readme = "README.md"+authors = ["Apache Arrow <[email protected]>"]+license = "Apache-2.0"+keywords = [ "datafusion", "sql", "parser", "planner" ]+edition = "2021"+rust-version = "1.59"++[lib]+name = "datafusion_sql"+path = "src/lib.rs"++[features]+default = ["unicode_expressions"]+unicode_expressions = []++[dependencies]+ahash = { version = "0.7", default-features = false }+arrow = { version = "14.0.0", features = ["prettyprint"] }+datafusion-common = { path = "../common", version = "8.0.0" }+datafusion-expr = { path = "../expr", version = "8.0.0" }+hashbrown = "0.12"+sqlparser = "0.17"+tokio = { version = "1.0", features = ["macros", "rt", "rt-multi-thread", "sync", "fs", "parking_lot"] }diff --git a/datafusion/sql/README.md b/datafusion/sql/README.mdnew file mode 100644index 0000000000..18abeb23e2--- /dev/null+++ b/datafusion/sql/README.md@@ -0,0 +1,26 @@+<!---+ Licensed to the Apache Software Foundation (ASF) under one+ or more contributor license agreements. See the NOTICE file+ distributed with this work for additional information+ regarding copyright ownership. The ASF licenses this file+ to you under the Apache License, Version 2.0 (the+ "License"); you may not use this file except in compliance+ with the License. You may obtain a copy of the License at++ http://www.apache.org/licenses/LICENSE-2.0++ Unless required by applicable law or agreed to in writing,+ software distributed under the License is distributed on an+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ KIND, either express or implied. See the License for the+ specific language governing permissions and limitations+ under the License.+-->++# DataFusion SQL Query Planner++[DataFusion](df) is an extensible query execution framework, written in Rust, that uses Apache Arrow as its in-memory format.++This crate is a submodule of DataFusion that provides a SQL query planner.++[df]: https://crates.io/crates/datafusiondiff --git a/datafusion/core/src/sql/mod.rs b/datafusion/sql/src/lib.rssimilarity index 90%rename from datafusion/core/src/sql/mod.rsrename to datafusion/sql/src/lib.rsindex cc8b004505..75da587f9e 100644--- a/datafusion/core/src/sql/mod.rs+++ b/datafusion/sql/src/lib.rs@@ -20,4 +20,7 @@pub mod parser;pub mod planner;-pub(crate) mod utils;+mod table_reference;+pub mod utils;++pub use table_reference::{ResolvedTableReference, TableReference};diff --git a/datafusion/core/src/sql/parser.rs b/datafusion/sql/src/parser.rssimilarity index 99%rename from datafusion/core/src/sql/parser.rsrename to datafusion/sql/src/parser.rsindex b0c44127ed..da4638764d 100644--- a/datafusion/core/src/sql/parser.rs+++ b/datafusion/sql/src/parser.rs@@ -19,7 +19,7 @@//!//! Declares a SQL parser based on sqlparser that handles custom formats that we need.-use crate::logical_plan::FileType;+use datafusion_expr::logical_plan::FileType;use sqlparser::{ast::{ColumnDef, ColumnOptionDef, Statement as SQLStatement, TableConstraint},dialect::{keywords::Keyword, Dialect, GenericDialect},diff --git a/datafusion/core/src/sql/planner.rs b/datafusion/sql/src/planner.rssimilarity index 97%rename from datafusion/core/src/sql/planner.rsrename to datafusion/sql/src/planner.rsindex 8864caacbc..ba05a22452 100644--- a/datafusion/core/src/sql/planner.rs+++ b/datafusion/sql/src/planner.rs@@ -17,45 +17,44 @@//! SQL Query Planner (produces logical plan from SQL AST)+use crate::parser::{CreateExternalTable, Statement as DFStatement};+use arrow::datatypes::*;+use datafusion_common::ToDFSchema;+use datafusion_expr::expr_rewriter::normalize_col;+use datafusion_expr::expr_rewriter::normalize_col_with_schemas;+use datafusion_expr::logical_plan::{+ Analyze, CreateCatalog, CreateCatalogSchema,+ CreateExternalTable as PlanCreateExternalTable, CreateMemoryTable, CreateView,+ DropTable, Explain, FileType, JoinType, LogicalPlan, LogicalPlanBuilder, PlanType,+ ToStringifiedPlan,+};+use datafusion_expr::utils::{+ expand_qualified_wildcard, expand_wildcard, expr_as_column_expr, exprlist_to_columns,+ find_aggregate_exprs, find_column_exprs, find_window_exprs,+};+use datafusion_expr::{+ and, col, lit, AggregateFunction, AggregateUDF, Expr, Operator, ScalarUDF,+ WindowFrame, WindowFrameUnits,+};+use datafusion_expr::{+ window_function::WindowFunction, BuiltinScalarFunction, TableSource,+};+use hashbrown::HashMap;use std::collections::HashSet;use std::iter;use std::str::FromStr;use std::sync::Arc;use std::{convert::TryInto, vec};-use crate::catalog::TableReference;-use crate::datasource::TableProvider;-use crate::logical_plan::window_frames::{WindowFrame, WindowFrameUnits};-use crate::logical_plan::Expr::Alias;-use crate::logical_plan::{- and, col, lit, normalize_col, normalize_col_with_schemas, provider_as_source, Column,- CreateCatalog, CreateCatalogSchema, CreateExternalTable as PlanCreateExternalTable,- CreateMemoryTable, CreateView, DFSchema, DFSchemaRef, DropTable, Expr, FileType,- LogicalPlan, LogicalPlanBuilder, Operator, PlanType, ToDFSchema, ToStringifiedPlan,+use crate::table_reference::TableReference;+use crate::utils::{make_decimal_type, normalize_ident, resolve_columns};+use datafusion_common::{+ field_not_found, Column, DFSchema, DFSchemaRef, DataFusionError, Result, ScalarValue,};-use crate::prelude::JoinType;-use crate::scalar::ScalarValue;-use crate::sql::utils::{make_decimal_type, normalize_ident, resolve_columns};-use crate::{- error::{DataFusionError, Result},- logical_expr::utils::{expand_qualified_wildcard, expand_wildcard},- physical_plan::aggregates,- physical_plan::udaf::AggregateUDF,- physical_plan::udf::ScalarUDF,- sql::parser::{CreateExternalTable, Statement as DFStatement},-};-use arrow::datatypes::*;-use datafusion_expr::utils::{- expr_as_column_expr, exprlist_to_columns, find_aggregate_exprs, find_column_exprs,- find_window_exprs,-};-use datafusion_expr::{window_function::WindowFunction, BuiltinScalarFunction};-use hashbrown::HashMap;--use datafusion_common::field_not_found;use datafusion_expr::expr::GroupingSet;use datafusion_expr::logical_plan::builder::project_with_alias;use datafusion_expr::logical_plan::{Filter, Subquery};+use datafusion_expr::Expr::Alias;use sqlparser::ast::{BinaryOperator, DataType as SQLDataType, DateTimeField, Expr as SQLExpr, FunctionArg,FunctionArgExpr, Ident, Join, JoinConstraint, JoinOperator, ObjectName,@@ -74,13 +73,12 @@ use super::{resolve_aliases_to_exprs, resolve_positions_to_exprs,},};-use crate::logical_plan::plan::{Analyze, Explain};/// The ContextProvider trait allows the query planner to obtain meta-data about tables and/// functions referenced in SQL statementspub trait ContextProvider {/// Getter for a datasource- fn get_table_provider(&self, name: TableReference) -> Result<Arc<dyn TableProvider>>;+ fn get_table_provider(&self, name: TableReference) -> Result<Arc<dyn TableSource>>;/// Getter for a UDF descriptionfn get_function_meta(&self, name: &str) -> Option<Arc<ScalarUDF>>;/// Getter for a UDAF description@@ -714,11 +712,8 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {_ => Ok(cte_plan.clone()),},(_, Ok(provider)) => {- let scan = LogicalPlanBuilder::scan(- &table_name,- provider_as_source(provider),- None,- );+ let scan =+ LogicalPlanBuilder::scan(&table_name, provider, None);let scan = match table_alias.as_ref() {Some(ref name) => scan?.alias(name.to_owned().as_str()),_ => scan,@@ -2040,7 +2035,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {}// next, aggregate built-ins- if let Ok(fun) = aggregates::AggregateFunction::from_str(&name) {+ if let Ok(fun) = AggregateFunction::from_str(&name) {let distinct = function.distinct;let (fun, args) = self.aggregate_fn_to_expr(fun, function, schema)?;return Ok(Expr::AggregateFunction {@@ -2152,12 +2147,12 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {fn aggregate_fn_to_expr(&self,- fun: aggregates::AggregateFunction,+ fun: AggregateFunction,function: sqlparser::ast::Function,schema: &DFSchema,- ) -> Result<(aggregates::AggregateFunction, Vec<Expr>)> {+ ) -> Result<(AggregateFunction, Vec<Expr>)> {let args = match fun {- aggregates::AggregateFunction::Count => function+ AggregateFunction::Count => function.args.into_iter().map(|a| match a {@@ -2168,7 +2163,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {_ => self.sql_fn_arg_to_logical_expr(a, schema, &mut HashMap::new()),}).collect::<Result<Vec<Expr>>>()?,- aggregates::AggregateFunction::ApproxMedian => function+ AggregateFunction::ApproxMedian => function.args.into_iter().map(|a| self.sql_fn_arg_to_logical_expr(a, schema, &mut HashMap::new()))@@ -2178,9 +2173,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {};let fun = match fun {- aggregates::AggregateFunction::ApproxMedian => {- aggregates::AggregateFunction::ApproxPercentileCont- }+ AggregateFunction::ApproxMedian => AggregateFunction::ApproxPercentileCont,_ => fun,};@@ -2649,14 +2642,9 @@ fn parse_sql_number(n: &str) -> Result<Expr> {#[cfg(test)]mod tests {- use crate::datasource::empty::EmptyTable;- use crate::execution::context::ExecutionProps;- use crate::optimizer::limit_push_down::LimitPushDown;- use crate::optimizer::optimizer::OptimizerRule;- use crate::{assert_contains, logical_plan::create_udf, sql::parser::DFParser};- use datafusion_expr::{ScalarFunctionImplementation, Volatility};-use super::*;+ use crate::assert_contains;+ use std::any::Any;#[test]fn select_no_relation() {@@ -4393,23 +4381,13 @@ mod tests {assert_eq!(format!("{:?}", plan), expected);}- fn quick_test_with_limit_pushdown(sql: &str, expected: &str) {- let plan = logical_plan(sql).unwrap();- let rule = LimitPushDown::new();- let optimized_plan = rule- .optimize(&plan, &ExecutionProps::new())- .expect("failed to optimize plan");- let formatted_plan = format!("{:?}", optimized_plan);- assert_eq!(formatted_plan, expected);- }-struct MockContextProvider {}impl ContextProvider for MockContextProvider {fn get_table_provider(&self,name: TableReference,- ) -> Result<Arc<dyn TableProvider>> {+ ) -> Result<Arc<dyn TableSource>> {let schema = match name.table() {"test" => Ok(Schema::new(vec![Field::new("t_date32", DataType::Date32, false),@@ -4485,19 +4463,8 @@ mod tests {}}- fn get_function_meta(&self, name: &str) -> Option<Arc<ScalarUDF>> {- let f: ScalarFunctionImplementation =- Arc::new(|_| Err(DataFusionError::NotImplemented("".to_string())));- match name {- "my_sqrt" => Some(Arc::new(create_udf(- "my_sqrt",- vec![DataType::Float64],- Arc::new(DataType::Float64),- Volatility::Immutable,- f,- ))),- _ => None,- }+ fn get_function_meta(&self, _name: &str) -> Option<Arc<ScalarUDF>> {+ unimplemented!()}fn get_aggregate_meta(&self, _name: &str) -> Option<Arc<AggregateUDF>> {@@ -4869,33 +4836,32 @@ mod tests {fn test_offset_no_limit() {let sql = "SELECT id FROM person WHERE person.id > 100 OFFSET 5;";let expected = "Offset: 5\- \n Projection: #person.id\- \n Filter: #person.id > Int64(100)\- \n TableScan: person projection=None";+ \n Projection: #person.id\+ \n Filter: #person.id > Int64(100)\+ \n TableScan: person projection=None";quick_test(sql, expected);}#[test]- fn test_offset_after_limit_with_limit_push() {+ fn test_offset_after_limit() {let sql = "select id from person where person.id > 100 LIMIT 5 OFFSET 3;";let expected = "Offset: 3\- \n Limit: 8\- \n Projection: #person.id\- \n Filter: #person.id > Int64(100)\- \n TableScan: person projection=None";-- quick_test_with_limit_pushdown(sql, expected);+ \n Limit: 5\+ \n Projection: #person.id\+ \n Filter: #person.id > Int64(100)\+ \n TableScan: person projection=None";+ quick_test(sql, expected);}#[test]- fn test_offset_before_limit_with_limit_push() {+ fn test_offset_before_limit() {let sql = "select id from person where person.id > 100 OFFSET 3 LIMIT 5;";let expected = "Offset: 3\- \n Limit: 8\- \n Projection: #person.id\- \n Filter: #person.id > Int64(100)\- \n TableScan: person projection=None";- quick_test_with_limit_pushdown(sql, expected);+ \n Limit: 5\+ \n Projection: #person.id\+ \n Filter: #person.id > Int64(100)\+ \n TableScan: person projection=None";+ quick_test(sql, expected);}fn assert_field_not_found(err: DataFusionError, name: &str) {@@ -4910,4 +4876,47 @@ mod tests {_ => panic!("assert_field_not_found wrong error type"),}}++ /// A macro to assert that one string is contained within another with+ /// a nice error message if they are not.+ ///+ /// Usage: `assert_contains!(actual, expected)`+ ///+ /// Is a macro so test error+ /// messages are on the same line as the failure;+ ///+ /// Both arguments must be convertable into Strings (Into<String>)+ #[macro_export]+ macro_rules! assert_contains {+ ($ACTUAL: expr, $EXPECTED: expr) => {+ let actual_value: String = $ACTUAL.into();+ let expected_value: String = $EXPECTED.into();+ assert!(+ actual_value.contains(&expected_value),+ "Can not find expected in actual.\n\nExpected:\n{}\n\nActual:\n{}",+ expected_value,+ actual_value+ );+ };+ }++ struct EmptyTable {+ table_schema: SchemaRef,+ }++ impl EmptyTable {+ fn new(table_schema: SchemaRef) -> Self {+ Self { table_schema }+ }+ }++ impl TableSource for EmptyTable {+ fn as_any(&self) -> &dyn Any {+ self+ }++ fn schema(&self) -> SchemaRef {+ self.table_schema.clone()+ }+ }}diff --git a/datafusion/sql/src/table_reference.rs b/datafusion/sql/src/table_reference.rsnew file mode 100644index 0000000000..44848eb991--- /dev/null+++ b/datafusion/sql/src/table_reference.rs@@ -0,0 +1,123 @@+// Licensed to the Apache Software Foundation (ASF) under one+// or more contributor license agreements. See the NOTICE file+// distributed with this work for additional information+// regarding copyright ownership. The ASF licenses this file+// to you under the Apache License, Version 2.0 (the+// "License"); you may not use this file except in compliance+// with the License. You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing,+// software distributed under the License is distributed on an+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+// KIND, either express or implied. See the License for the+// specific language governing permissions and limitations+// under the License.++// / Represents a resolved path to a table of the form "catalog.schema.table"+#[derive(Clone, Copy)]+pub struct ResolvedTableReference<'a> {+ /// The catalog (aka database) containing the table+ pub catalog: &'a str,+ /// The schema containing the table+ pub schema: &'a str,+ /// The table name+ pub table: &'a str,+}++/// Represents a path to a table that may require further resolution+#[derive(Clone, Copy)]+pub enum TableReference<'a> {+ /// An unqualified table reference, e.g. "table"+ Bare {+ /// The table name+ table: &'a str,+ },+ /// A partially resolved table reference, e.g. "schema.table"+ Partial {+ /// The schema containing the table+ schema: &'a str,+ /// The table name+ table: &'a str,+ },+ /// A fully resolved table reference, e.g. "catalog.schema.table"+ Full {+ /// The catalog (aka database) containing the table+ catalog: &'a str,+ /// The schema containing the table+ schema: &'a str,+ /// The table name+ table: &'a str,+ },+}++impl<'a> TableReference<'a> {+ /// Retrieve the actual table name, regardless of qualification+ pub fn table(&self) -> &str {+ match self {+ Self::Full { table, .. }+ | Self::Partial { table, .. }+ | Self::Bare { table } => table,+ }+ }++ /// Given a default catalog and schema, ensure this table reference is fully resolved+ pub fn resolve(+ self,+ default_catalog: &'a str,+ default_schema: &'a str,+ ) -> ResolvedTableReference<'a> {+ match self {+ Self::Full {+ catalog,+ schema,+ table,+ } => ResolvedTableReference {+ catalog,+ schema,+ table,+ },+ Self::Partial { schema, table } => ResolvedTableReference {+ catalog: default_catalog,+ schema,+ table,+ },+ Self::Bare { table } => ResolvedTableReference {+ catalog: default_catalog,+ schema: default_schema,+ table,+ },+ }+ }+}++impl<'a> From<&'a str> for TableReference<'a> {+ fn from(s: &'a str) -> Self {+ let parts: Vec<&str> = s.split('.').collect();++ match parts.len() {+ 1 => Self::Bare { table: s },+ 2 => Self::Partial {+ schema: parts[0],+ table: parts[1],+ },+ 3 => Self::Full {+ catalog: parts[0],+ schema: parts[1],+ table: parts[2],+ },+ _ => Self::Bare { table: s },+ }+ }+}++impl<'a> From<ResolvedTableReference<'a>> for TableReference<'a> {+ fn from(resolved: ResolvedTableReference<'a>) -> Self {+ Self::Full {+ catalog: resolved.catalog,+ schema: resolved.schema,+ table: resolved.table,+ }+ }+}diff --git a/datafusion/core/src/sql/utils.rs b/datafusion/sql/src/utils.rssimilarity index 98%rename from datafusion/core/src/sql/utils.rsrename to datafusion/sql/src/utils.rsindex 31034975e5..92e9881350 100644--- a/datafusion/core/src/sql/utils.rs+++ b/datafusion/sql/src/utils.rs@@ -20,11 +20,10 @@use arrow::datatypes::{DataType, DECIMAL_MAX_PRECISION};use sqlparser::ast::Ident;-use crate::error::{DataFusionError, Result};-use crate::logical_plan::{Expr, LogicalPlan};-use crate::scalar::ScalarValue;+use datafusion_common::{DataFusionError, Result, ScalarValue};use datafusion_expr::expr::GroupingSet;use datafusion_expr::utils::{expr_as_column_expr, find_column_exprs};+use datafusion_expr::{Expr, LogicalPlan};use std::collections::HashMap;/// Make a best-effort attempt at resolving all columns in the expression tree@@ -422,9 +421,7 @@ pub(crate) fn resolve_aliases_to_exprs(/// given a slice of window expressions sharing the same sort key, find their common partition/// keys.-pub(crate) fn window_expr_common_partition_keys(- window_exprs: &[Expr],-) -> Result<&[Expr]> {+pub fn window_expr_common_partition_keys(window_exprs: &[Expr]) -> Result<&[Expr]> {let all_partition_keys = window_exprs.iter().map(|expr| match expr {diff --git a/dev/release/README.md b/dev/release/README.mdindex ac07b4f276..c7ef713daa 100644--- a/dev/release/README.md+++ b/dev/release/README.md@@ -329,6 +329,7 @@ dot -Tsvg dev/release/crate-deps.dot > dev/release/crate-deps.svg(cd datafusion/data-access && cargo publish)(cd datafusion/common && cargo publish)(cd datafusion/expr && cargo publish)+(cd datafusion/sql && cargo publish)(cd datafusion/physical-expr && cargo publish)(cd datafusion/jit && cargo publish)(cd datafusion/row && cargo publish)@@ -337,15 +338,6 @@ dot -Tsvg dev/release/crate-deps.dot > dev/release/crate-deps.svg(cd datafusion-cli && cargo publish)```-If there is a ballista release, run--```shell-(cd ballista/rust/core && cargo publish)-(cd ballista/rust/executor && cargo publish)-(cd ballista/rust/scheduler && cargo publish)-(cd ballista/rust/client && cargo publish)-(cd ballista-cli && cargo publish)-```### Publish datafusion-cli on Homebrew and crates.io@@ -379,15 +371,12 @@ We have published new versions of datafusion and ballista to crates.io:https://crates.io/crates/datafusion/8.0.0https://crates.io/crates/datafusion-cli/8.0.0-https://crates.io/crates/datafusion-expr/8.0.0https://crates.io/crates/datafusion-common/8.0.0+https://crates.io/crates/datafusion-data-access/8.0.0+https://crates.io/crates/datafusion-expr/8.0.0https://crates.io/crates/datafusion-jit/8.0.0https://crates.io/crates/datafusion-physical-expr/8.0.0https://crates.io/crates/datafusion-proto/8.0.0-https://crates.io/crates/datafusion-data-access/8.0.0-https://crates.io/crates/ballista/0.7.0-https://crates.io/crates/ballista-cli/0.7.0-https://crates.io/crates/ballista-core/0.7.0-https://crates.io/crates/ballista-executor/0.7.0-https://crates.io/crates/ballista-scheduler/0.7.0+https://crates.io/crates/datafusion-row/8.0.0+https://crates.io/crates/datafusion-sql/8.0.0```diff --git a/dev/release/crate-deps.dot b/dev/release/crate-deps.dotindex 66dd71fb34..cd8e891c4d 100644--- a/dev/release/crate-deps.dot+++ b/dev/release/crate-deps.dot@@ -23,6 +23,9 @@ digraph G {datafusion_expr -> datafusion_common+ datafusion_sql -> datafusion_common+ datafusion_sql -> datafusion_expr+datafusion_physical_expr -> datafusion_commondatafusion_physical_expr -> datafusion_expr@@ -38,6 +41,7 @@ digraph G {datafusion -> datafusion_jitdatafusion -> datafusion_physical_exprdatafusion -> datafusion_row+ datafusion -> datafusion_sqldatafusion_proto -> datafusiondiff --git a/dev/release/crate-deps.svg b/dev/release/crate-deps.svgindex a4998cf806..0dbe37ca91 100644--- a/dev/release/crate-deps.svg+++ b/dev/release/crate-deps.svg@@ -4,154 +4,178 @@<!-- Generated by graphviz version 2.43.0 (0)--><!-- Title: G Pages: 1 -->-<svg width="568pt" height="404pt"- viewBox="0.00 0.00 567.79 404.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">+<svg width="985pt" height="404pt"+ viewBox="0.00 0.00 985.28 404.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 400)"><title>G</title>-<polygon fill="white" stroke="transparent" points="-4,4 -4,-400 563.79,-400 563.79,4 -4,4"/>+<polygon fill="white" stroke="transparent" points="-4,4 -4,-400 981.28,-400 981.28,4 -4,4"/><!-- datafusion_common --><g id="node1" class="node"><title>datafusion_common</title>-<ellipse fill="none" stroke="black" cx="319.55" cy="-18" rx="102.88" ry="18"/>-<text text-anchor="middle" x="319.55" y="-14.3" font-family="Times,serif" font-size="14.00">datafusion_common</text>+<ellipse fill="none" stroke="black" cx="499.34" cy="-18" rx="102.88" ry="18"/>+<text text-anchor="middle" x="499.34" y="-14.3" font-family="Times,serif" font-size="14.00">datafusion_common</text></g><!-- datafusion_data_access --><g id="node2" class="node"><title>datafusion_data_access</title>-<ellipse fill="none" stroke="black" cx="146.55" cy="-234" rx="118.88" ry="18"/>-<text text-anchor="middle" x="146.55" y="-230.3" font-family="Times,serif" font-size="14.00">datafusion_data_access</text>+<ellipse fill="none" stroke="black" cx="858.34" cy="-234" rx="118.88" ry="18"/>+<text text-anchor="middle" x="858.34" y="-230.3" font-family="Times,serif" font-size="14.00">datafusion_data_access</text></g><!-- datafusion_expr --><g id="node3" class="node"><title>datafusion_expr</title>-<ellipse fill="none" stroke="black" cx="319.55" cy="-90" rx="85.29" ry="18"/>-<text text-anchor="middle" x="319.55" y="-86.3" font-family="Times,serif" font-size="14.00">datafusion_expr</text>+<ellipse fill="none" stroke="black" cx="443.34" cy="-90" rx="85.29" ry="18"/>+<text text-anchor="middle" x="443.34" y="-86.3" font-family="Times,serif" font-size="14.00">datafusion_expr</text></g><!-- datafusion_expr->datafusion_common --><g id="edge1" class="edge"><title>datafusion_expr->datafusion_common</title>-<path fill="none" stroke="black" d="M319.55,-71.7C319.55,-63.98 319.55,-54.71 319.55,-46.11"/>-<polygon fill="black" stroke="black" points="323.05,-46.1 319.55,-36.1 316.05,-46.1 323.05,-46.1"/>+<path fill="none" stroke="black" d="M456.9,-72.05C463.61,-63.67 471.84,-53.38 479.27,-44.1"/>+<polygon fill="black" stroke="black" points="482.01,-46.27 485.52,-36.28 476.54,-41.9 482.01,-46.27"/></g>-<!-- datafusion_physical_expr -->+<!-- datafusion_sql --><g id="node4" class="node">+<title>datafusion_sql</title>+<ellipse fill="none" stroke="black" cx="77.34" cy="-162" rx="77.19" ry="18"/>+<text text-anchor="middle" x="77.34" y="-158.3" font-family="Times,serif" font-size="14.00">datafusion_sql</text>+</g>+<!-- datafusion_sql->datafusion_common -->+<g id="edge2" class="edge">+<title>datafusion_sql->datafusion_common</title>+<path fill="none" stroke="black" d="M115.04,-146.16C162.24,-127.79 245.72,-96.01 318.34,-72 357.25,-59.14 401.37,-46.18 436.31,-36.3"/>+<polygon fill="black" stroke="black" points="437.7,-39.55 446.38,-33.47 435.8,-32.81 437.7,-39.55"/>+</g>+<!-- datafusion_sql->datafusion_expr -->+<g id="edge3" class="edge">+<title>datafusion_sql->datafusion_expr</title>+<path fill="none" stroke="black" d="M134.43,-149.8C144.4,-147.86 154.67,-145.86 164.34,-144 235.02,-130.38 315.82,-115.06 372.21,-104.41"/>+<polygon fill="black" stroke="black" points="372.92,-107.83 382.09,-102.54 371.62,-100.96 372.92,-107.83"/>+</g>+<!-- datafusion_physical_expr -->+<g id="node5" class="node"><title>datafusion_physical_expr</title>-<ellipse fill="none" stroke="black" cx="176.55" cy="-162" rx="127.28" ry="18"/>-<text text-anchor="middle" x="176.55" y="-158.3" font-family="Times,serif" font-size="14.00">datafusion_physical_expr</text>+<ellipse fill="none" stroke="black" cx="300.34" cy="-162" rx="127.28" ry="18"/>+<text text-anchor="middle" x="300.34" y="-158.3" font-family="Times,serif" font-size="14.00">datafusion_physical_expr</text></g><!-- datafusion_physical_expr->datafusion_common -->-<g id="edge2" class="edge">+<g id="edge4" class="edge"><title>datafusion_physical_expr->datafusion_common</title>-<path fill="none" stroke="black" d="M182.68,-143.8C190.29,-124.43 204.83,-92.93 225.55,-72 238.55,-58.87 255.49,-47.99 271.4,-39.57"/>-<polygon fill="black" stroke="black" points="273.27,-42.55 280.61,-34.9 270.11,-36.3 273.27,-42.55"/>+<path fill="none" stroke="black" d="M305.6,-143.83C312.54,-123.89 326.61,-91.28 349.34,-72 370.07,-54.41 397.03,-42.51 422.37,-34.53"/>+<polygon fill="black" stroke="black" points="423.41,-37.87 431.99,-31.66 421.41,-31.17 423.41,-37.87"/></g><!-- datafusion_physical_expr->datafusion_expr -->-<g id="edge3" class="edge">+<g id="edge5" class="edge"><title>datafusion_physical_expr->datafusion_expr</title>-<path fill="none" stroke="black" d="M210.08,-144.59C230.35,-134.66 256.37,-121.92 277.96,-111.36"/>-<polygon fill="black" stroke="black" points="279.77,-114.37 287.22,-106.83 276.69,-108.08 279.77,-114.37"/>+<path fill="none" stroke="black" d="M333.87,-144.59C354.15,-134.66 380.17,-121.92 401.75,-111.36"/>+<polygon fill="black" stroke="black" points="403.57,-114.37 411.01,-106.83 400.49,-108.08 403.57,-114.37"/></g><!-- datafusion_jit -->-<g id="node5" class="node">+<g id="node6" class="node"><title>datafusion_jit</title>-<ellipse fill="none" stroke="black" cx="432.55" cy="-162" rx="73.39" ry="18"/>-<text text-anchor="middle" x="432.55" y="-158.3" font-family="Times,serif" font-size="14.00">datafusion_jit</text>+<ellipse fill="none" stroke="black" cx="556.34" cy="-162" rx="73.39" ry="18"/>+<text text-anchor="middle" x="556.34" y="-158.3" font-family="Times,serif" font-size="14.00">datafusion_jit</text></g><!-- datafusion_jit->datafusion_common -->-<g id="edge4" class="edge">+<g id="edge6" class="edge"><title>datafusion_jit->datafusion_common</title>-<path fill="none" stroke="black" d="M432.92,-143.92C432.5,-124.66 429.18,-93.26 413.55,-72 403.16,-57.87 387.8,-46.98 372.49,-38.86"/>-<polygon fill="black" stroke="black" points="374.03,-35.72 363.52,-34.39 370.91,-41.99 374.03,-35.72"/>+<path fill="none" stroke="black" d="M554.8,-143.96C552.67,-125.56 547.82,-95.7 537.34,-72 533.02,-62.21 526.71,-52.43 520.47,-43.98"/>+<polygon fill="black" stroke="black" points="523.21,-41.8 514.33,-36.03 517.67,-46.08 523.21,-41.8"/></g><!-- datafusion_jit->datafusion_expr -->-<g id="edge5" class="edge">+<g id="edge7" class="edge"><title>datafusion_jit->datafusion_expr</title>-<path fill="none" stroke="black" d="M406.91,-145.12C391.38,-135.5 371.37,-123.1 354.42,-112.6"/>-<polygon fill="black" stroke="black" points="356.22,-109.6 345.87,-107.31 352.53,-115.55 356.22,-109.6"/>+<path fill="none" stroke="black" d="M530.7,-145.12C515.18,-135.5 495.16,-123.1 478.21,-112.6"/>+<polygon fill="black" stroke="black" points="480.01,-109.6 469.67,-107.31 476.33,-115.55 480.01,-109.6"/></g><!-- datafusion_row -->-<g id="node6" class="node">+<g id="node7" class="node"><title>datafusion_row</title>-<ellipse fill="none" stroke="black" cx="478.55" cy="-234" rx="81.49" ry="18"/>-<text text-anchor="middle" x="478.55" y="-230.3" font-family="Times,serif" font-size="14.00">datafusion_row</text>+<ellipse fill="none" stroke="black" cx="602.34" cy="-234" rx="81.49" ry="18"/>+<text text-anchor="middle" x="602.34" y="-230.3" font-family="Times,serif" font-size="14.00">datafusion_row</text></g><!-- datafusion_row->datafusion_common -->-<g id="edge6" class="edge">+<g id="edge8" class="edge"><title>datafusion_row->datafusion_common</title>-<path fill="none" stroke="black" d="M493.78,-216.24C501.64,-206.44 510.43,-193.4 514.55,-180 519.25,-164.71 521.01,-158.64 514.55,-144 490.23,-88.94 427.68,-55.53 379.92,-37.28"/>-<polygon fill="black" stroke="black" points="380.88,-33.9 370.28,-33.72 378.45,-40.47 380.88,-33.9"/>+<path fill="none" stroke="black" d="M617.52,-216.12C631.78,-198.11 649.4,-168.82 638.34,-144 617.91,-98.15 571.42,-62.07 537.83,-40.69"/>+<polygon fill="black" stroke="black" points="539.5,-37.61 529.16,-35.32 535.81,-43.56 539.5,-37.61"/></g><!-- datafusion_row->datafusion_jit -->-<g id="edge7" class="edge">+<g id="edge9" class="edge"><title>datafusion_row->datafusion_jit</title>-<path fill="none" stroke="black" d="M467.41,-216.05C462.01,-207.84 455.41,-197.79 449.41,-188.66"/>-<polygon fill="black" stroke="black" points="452.32,-186.71 443.9,-180.28 446.47,-190.55 452.32,-186.71"/>+<path fill="none" stroke="black" d="M591.21,-216.05C585.81,-207.84 579.21,-197.79 573.21,-188.66"/>+<polygon fill="black" stroke="black" points="576.11,-186.71 567.7,-180.28 570.26,-190.55 576.11,-186.71"/></g><!-- datafusion -->-<g id="node7" class="node">+<g id="node8" class="node"><title>datafusion</title>-<ellipse fill="none" stroke="black" cx="312.55" cy="-306" rx="59.59" ry="18"/>-<text text-anchor="middle" x="312.55" y="-302.3" font-family="Times,serif" font-size="14.00">datafusion</text>+<ellipse fill="none" stroke="black" cx="493.34" cy="-306" rx="59.59" ry="18"/>+<text text-anchor="middle" x="493.34" y="-302.3" font-family="Times,serif" font-size="14.00">datafusion</text></g><!-- datafusion->datafusion_common -->-<g id="edge8" class="edge">+<g id="edge10" class="edge"><title>datafusion->datafusion_common</title>-<path fill="none" stroke="black" d="M253.26,-302.98C176.17,-298.97 47.86,-287.07 18.55,-252 -63.22,-154.18 149.21,-71.47 258.85,-36.65"/>-<polygon fill="black" stroke="black" points="259.99,-39.96 268.48,-33.63 257.89,-33.28 259.99,-39.96"/>+<path fill="none" stroke="black" d="M547.48,-298.02C600.16,-289.99 674.75,-274.89 692.34,-252 745.58,-182.73 677.61,-131.18 613.34,-72 597.41,-57.33 576.69,-46.06 557.3,-37.77"/>+<polygon fill="black" stroke="black" points="558.49,-34.48 547.91,-33.94 555.84,-40.96 558.49,-34.48"/></g><!-- datafusion->datafusion_data_access -->-<g id="edge9" class="edge">+<g id="edge11" class="edge"><title>datafusion->datafusion_data_access</title>-<path fill="none" stroke="black" d="M279.35,-291C254.89,-280.69 221.28,-266.51 193.99,-255"/>-<polygon fill="black" stroke="black" points="195.2,-251.72 184.62,-251.05 192.48,-258.17 195.2,-251.72"/>+<path fill="none" stroke="black" d="M542.57,-295.56C602.88,-283.99 705.88,-264.24 777.79,-250.45"/>+<polygon fill="black" stroke="black" points="778.56,-253.87 787.72,-248.54 777.24,-246.99 778.56,-253.87"/></g><!-- datafusion->datafusion_expr -->-<g id="edge10" class="edge">+<g id="edge12" class="edge"><title>datafusion->datafusion_expr</title>-<path fill="none" stroke="black" d="M313.11,-287.85C314.32,-250.83 317.19,-163.18 318.65,-118.39"/>-<polygon fill="black" stroke="black" points="322.16,-118.34 318.98,-108.23 315.16,-118.11 322.16,-118.34"/>+<path fill="none" stroke="black" d="M489.34,-287.85C480.67,-250.75 460.12,-162.81 449.68,-118.1"/>+<polygon fill="black" stroke="black" points="453.05,-117.17 447.37,-108.23 446.24,-118.77 453.05,-117.17"/>+</g>+<!-- datafusion->datafusion_sql -->+<g id="edge16" class="edge">+<title>datafusion->datafusion_sql</title>+<path fill="none" stroke="black" d="M455.32,-292.02C380.37,-266.44 213.47,-209.46 128.77,-180.55"/>+<polygon fill="black" stroke="black" points="129.7,-177.17 119.11,-177.26 127.44,-183.8 129.7,-177.17"/></g><!-- datafusion->datafusion_physical_expr -->-<g id="edge12" class="edge">+<g id="edge14" class="edge"><title>datafusion->datafusion_physical_expr</title>-<path fill="none" stroke="black" d="M308.82,-287.73C303.86,-268.29 293.45,-236.73 274.55,-216 262.24,-202.5 245.67,-191.74 229.66,-183.55"/>-<polygon fill="black" stroke="black" points="230.86,-180.24 220.34,-179.02 227.8,-186.54 230.86,-180.24"/>+<path fill="none" stroke="black" d="M471.58,-288.99C437.39,-263.83 370.96,-214.96 331.65,-186.03"/>+<polygon fill="black" stroke="black" points="333.35,-182.94 323.22,-179.83 329.2,-188.58 333.35,-182.94"/></g><!-- datafusion->datafusion_jit -->-<g id="edge11" class="edge">+<g id="edge13" class="edge"><title>datafusion->datafusion_jit</title>-<path fill="none" stroke="black" d="M326.55,-288.43C347.48,-263.66 387.08,-216.8 411.51,-187.9"/>-<polygon fill="black" stroke="black" points="414.48,-189.8 418.27,-179.9 409.14,-185.28 414.48,-189.8"/>+<path fill="none" stroke="black" d="M494.56,-287.81C496.42,-269.28 501.04,-239.31 512.34,-216 517.33,-205.73 524.71,-195.74 532.02,-187.26"/>+<polygon fill="black" stroke="black" points="534.81,-189.4 538.91,-179.63 529.61,-184.7 534.81,-189.4"/></g><!-- datafusion->datafusion_row -->-<g id="edge13" class="edge">+<g id="edge15" class="edge"><title>datafusion->datafusion_row</title>-<path fill="none" stroke="black" d="M345.74,-291C370.79,-280.44 405.45,-265.82 433.08,-254.17"/>-<polygon fill="black" stroke="black" points="434.68,-257.3 442.54,-250.19 431.96,-250.85 434.68,-257.3"/>+<path fill="none" stroke="black" d="M517.53,-289.46C532.46,-279.88 551.83,-267.44 568.29,-256.87"/>+<polygon fill="black" stroke="black" points="570.56,-259.57 577.08,-251.22 566.78,-253.68 570.56,-259.57"/></g><!-- datafusion_proto -->-<g id="node8" class="node">+<g id="node9" class="node"><title>datafusion_proto</title>-<ellipse fill="none" stroke="black" cx="221.55" cy="-378" rx="89.08" ry="18"/>-<text text-anchor="middle" x="221.55" y="-374.3" font-family="Times,serif" font-size="14.00">datafusion_proto</text>+<ellipse fill="none" stroke="black" cx="402.34" cy="-378" rx="89.08" ry="18"/>+<text text-anchor="middle" x="402.34" y="-374.3" font-family="Times,serif" font-size="14.00">datafusion_proto</text></g><!-- datafusion_proto->datafusion -->-<g id="edge14" class="edge">+<g id="edge17" class="edge"><title>datafusion_proto->datafusion</title>-<path fill="none" stroke="black" d="M243.11,-360.41C255.19,-351.12 270.4,-339.42 283.51,-329.34"/>-<polygon fill="black" stroke="black" points="285.97,-331.86 291.76,-322.99 281.7,-326.31 285.97,-331.86"/>+<path fill="none" stroke="black" d="M423.91,-360.41C435.98,-351.12 451.2,-339.42 464.3,-329.34"/>+<polygon fill="black" stroke="black" points="466.77,-331.86 472.56,-322.99 462.5,-326.31 466.77,-331.86"/></g><!-- datafusion_cli -->-<g id="node9" class="node">+<g id="node10" class="node"><title>datafusion_cli</title>-<ellipse fill="none" stroke="black" cx="403.55" cy="-378" rx="74.99" ry="18"/>-<text text-anchor="middle" x="403.55" y="-374.3" font-family="Times,serif" font-size="14.00">datafusion_cli</text>+<ellipse fill="none" stroke="black" cx="584.34" cy="-378" rx="74.99" ry="18"/>+<text text-anchor="middle" x="584.34" y="-374.3" font-family="Times,serif" font-size="14.00">datafusion_cli</text></g><!-- datafusion_cli->datafusion -->-<g id="edge15" class="edge">+<g id="edge18" class="edge"><title>datafusion_cli->datafusion</title>-<path fill="none" stroke="black" d="M381.98,-360.41C369.91,-351.12 354.7,-339.42 341.59,-329.34"/>-<polygon fill="black" stroke="black" points="343.39,-326.31 333.33,-322.99 339.12,-331.86 343.39,-326.31"/>+<path fill="none" stroke="black" d="M562.78,-360.41C550.71,-351.12 535.49,-339.42 522.38,-329.34"/>+<polygon fill="black" stroke="black" points="524.19,-326.31 514.13,-322.99 519.92,-331.86 524.19,-326.31"/></g></g></svg>diff --git a/dev/update_datafusion_versions.py b/dev/update_datafusion_versions.pyindex 2560f79dcf..b86ebc8e97 100755--- a/dev/update_datafusion_versions.py+++ b/dev/update_datafusion_versions.py@@ -37,7 +37,8 @@ crates = {'datafusion-jit': 'datafusion/jit/Cargo.toml','datafusion-physical-expr': 'datafusion/physical-expr/Cargo.toml','datafusion-proto': 'datafusion/proto/Cargo.toml',- 'datafusion-row': 'datafusion/row/Cargo.toml'+ 'datafusion-row': 'datafusion/row/Cargo.toml',+ 'datafusion-sql': 'datafusion/sql/Cargo.toml',}def update_datafusion_version(cargo_toml: str, new_version: str):