alamb commented on code in PR #12466:
URL: https://github.com/apache/datafusion/pull/12466#discussion_r1768884987
##########
datafusion/sql/src/statement.rs:
##########
@@ -1136,14 +1136,29 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
schema: &DFSchemaRef,
planner_context: &mut PlannerContext,
) -> Result<Vec<Vec<SortExpr>>> {
- // Ask user to provide a schema if schema is empty.
+ let mut all_results = vec![];
if !order_exprs.is_empty() && schema.fields().is_empty() {
- return plan_err!(
- "Provide a schema before specifying the order while creating a
table."
- );
+ let mut results = vec![];
+ for expr in order_exprs {
+ for ordered_expr in expr {
+ let order_expr = ordered_expr.expr.to_owned();
+ let order_expr = self.sql_expr_to_logical_expr(
+ order_expr,
+ schema,
+ planner_context,
+ )?;
+ let nulls_first = ordered_expr.nulls_first.unwrap_or(true);
Review Comment:
Why wouldn't we have a schema? I think the listing table knows its schema
##########
datafusion/sql/src/statement.rs:
##########
@@ -1136,14 +1136,29 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
schema: &DFSchemaRef,
planner_context: &mut PlannerContext,
) -> Result<Vec<Vec<SortExpr>>> {
- // Ask user to provide a schema if schema is empty.
+ let mut all_results = vec![];
if !order_exprs.is_empty() && schema.fields().is_empty() {
- return plan_err!(
- "Provide a schema before specifying the order while creating a
table."
- );
+ let mut results = vec![];
+ for expr in order_exprs {
+ for ordered_expr in expr {
+ let order_expr = ordered_expr.expr.to_owned();
+ let order_expr = self.sql_expr_to_logical_expr(
+ order_expr,
+ schema,
+ planner_context,
+ )?;
+ let nulls_first = ordered_expr.nulls_first.unwrap_or(true);
Review Comment:
Why wouldn't we have a schema? I think the listing table knows its schema
(it is inferred a right above)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]