diff --git a/datafusion/sql/src/planner.rs b/datafusion/sql/src/planner.rs index 628bcb2fbdcd..401b0c5aa897 100644 --- a/datafusion/sql/src/planner.rs +++ b/datafusion/sql/src/planner.rs @@ -267,7 +267,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> { } /// Returns a vector of (column_name, default_expr) pairs - pub(super) fn build_column_defaults( + pub fn build_column_defaults( &self, columns: &Vec, planner_context: &mut PlannerContext, @@ -372,7 +372,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> { }) } - pub(crate) fn convert_data_type(&self, sql_type: &SQLDataType) -> Result { + pub fn convert_data_type(&self, sql_type: &SQLDataType) -> Result { // First check if any of the registered type_planner can handle this type if let Some(type_planner) = self.context_provider.get_type_planner() { if let Some(data_type) = type_planner.plan_type(sql_type)? { @@ -566,7 +566,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> { | SQLDataType::MediumText | SQLDataType::LongText | SQLDataType::Bit(_) - |SQLDataType::BitVarying(_) + | SQLDataType::BitVarying(_) => not_impl_err!( "Unsupported SQL type {sql_type:?}" ), diff --git a/datafusion/sql/src/statement.rs b/datafusion/sql/src/statement.rs index dfd3a4fd76a2..80c087b578a9 100644 --- a/datafusion/sql/src/statement.rs +++ b/datafusion/sql/src/statement.rs @@ -71,7 +71,7 @@ fn ident_to_string(ident: &Ident) -> String { normalize_ident(ident.to_owned()) } -fn object_name_to_string(object_name: &ObjectName) -> String { +pub fn object_name_to_string(object_name: &ObjectName) -> String { object_name .0 .iter() @@ -94,7 +94,9 @@ fn get_schema_name(schema_name: &SchemaName) -> String { /// Construct `TableConstraint`(s) for the given columns by iterating over /// `columns` and extracting individual inline constraint definitions. -fn calc_inline_constraints_from_columns(columns: &[ColumnDef]) -> Vec { +pub fn calc_inline_constraints_from_columns( + columns: &[ColumnDef], +) -> Vec { let mut constraints = vec![]; for column in columns { for ast::ColumnOptionDef { name, option } in &column.options { @@ -1418,7 +1420,7 @@ impl SqlToRel<'_, S> { } /// Convert each [TableConstraint] to corresponding [Constraint] - fn new_constraint_from_table_constraints( + pub fn new_constraint_from_table_constraints( constraints: &[TableConstraint], df_schema: &DFSchemaRef, ) -> Result { @@ -2097,7 +2099,7 @@ ON p.function_name = r.routine_name } /// Return true if there is a table provider available for "schema.table" - fn has_table(&self, schema: &str, table: &str) -> bool { + pub fn has_table(&self, schema: &str, table: &str) -> bool { let tables_reference = TableReference::Partial { schema: schema.into(), table: table.into(), diff --git a/datafusion/sql/src/utils.rs b/datafusion/sql/src/utils.rs index 74ead8cf94ea..74c9ec28bca9 100644 --- a/datafusion/sql/src/utils.rs +++ b/datafusion/sql/src/utils.rs @@ -230,10 +230,7 @@ pub fn window_expr_common_partition_keys(window_exprs: &[Expr]) -> Result<&[Expr /// Returns a validated `DataType` for the specified precision and /// scale -pub(crate) fn make_decimal_type( - precision: Option, - scale: Option, -) -> Result { +pub fn make_decimal_type(precision: Option, scale: Option) -> Result { // postgres like behavior let (precision, scale) = match (precision, scale) { (Some(p), Some(s)) => (p as u8, s as i8), @@ -261,7 +258,7 @@ pub(crate) fn make_decimal_type( } /// Normalize an owned identifier to a lowercase string, unless the identifier is quoted. -pub(crate) fn normalize_ident(id: Ident) -> String { +pub fn normalize_ident(id: Ident) -> String { match id.quote_style { Some(_) => id.value, None => id.value.to_ascii_lowercase(),