Skip to content

Commit e8efd59

Browse files
Standing-ManalambJefffrey
authored
chore(deps): Update sqlparser to 0.60 (#19672)
## Which issue does this PR close? <!-- We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123. --> - Closes #19671. ## Rationale for this change <!-- Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed. Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes. --> ## What changes are included in this PR? <!-- There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR. --> ## Are these changes tested? <!-- We typically require tests for all PRs in order to: 1. Prevent the code from being accidentally broken by subsequent changes 2. Serve as another way to document the expected behavior of the code If tests are not included in your PR, please explain why (for example, are they covered by existing tests)? --> ## Are there any user-facing changes? <!-- If there are user-facing changes then we may require documentation to be updated before approving the PR. --> <!-- If there are any breaking changes to public APIs, please add the `api change` label. --> --------- Signed-off-by: StandingMan <[email protected]> Co-authored-by: Andrew Lamb <[email protected]> Co-authored-by: Jeffrey Vo <[email protected]>
1 parent d484c09 commit e8efd59

File tree

15 files changed

+178
-114
lines changed

15 files changed

+178
-114
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ recursive = "0.1.1"
181181
regex = "1.12"
182182
rstest = "0.26.1"
183183
serde_json = "1"
184-
sqlparser = { version = "0.59.0", default-features = false, features = ["std", "visitor"] }
184+
sqlparser = { version = "0.60.0", default-features = false, features = ["std", "visitor"] }
185185
strum = "0.27.2"
186186
strum_macros = "0.27.2"
187187
tempfile = "3"

datafusion-examples/examples/relation_planner/match_recognize.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ impl RelationPlanner for MatchRecognizePlanner {
362362
..
363363
} = relation
364364
else {
365-
return Ok(RelationPlanning::Original(relation));
365+
return Ok(RelationPlanning::Original(Box::new(relation)));
366366
};
367367

368368
// Plan the input table
@@ -401,6 +401,8 @@ impl RelationPlanner for MatchRecognizePlanner {
401401
node: Arc::new(node),
402402
});
403403

404-
Ok(RelationPlanning::Planned(PlannedRelation::new(plan, alias)))
404+
Ok(RelationPlanning::Planned(Box::new(PlannedRelation::new(
405+
plan, alias,
406+
))))
405407
}
406408
}

datafusion-examples/examples/relation_planner/pivot_unpivot.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ impl RelationPlanner for PivotUnpivotPlanner {
339339
alias,
340340
),
341341

342-
other => Ok(RelationPlanning::Original(other)),
342+
other => Ok(RelationPlanning::Original(Box::new(other))),
343343
}
344344
}
345345
}
@@ -459,7 +459,9 @@ fn plan_pivot(
459459
.aggregate(group_by_cols, pivot_exprs)?
460460
.build()?;
461461

462-
Ok(RelationPlanning::Planned(PlannedRelation::new(plan, alias)))
462+
Ok(RelationPlanning::Planned(Box::new(PlannedRelation::new(
463+
plan, alias,
464+
))))
463465
}
464466

465467
// ============================================================================
@@ -540,7 +542,9 @@ fn plan_unpivot(
540542
.build()?;
541543
}
542544

543-
Ok(RelationPlanning::Planned(PlannedRelation::new(plan, alias)))
545+
Ok(RelationPlanning::Planned(Box::new(PlannedRelation::new(
546+
plan, alias,
547+
))))
544548
}
545549

546550
// ============================================================================

datafusion-examples/examples/relation_planner/table_sample.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ impl RelationPlanner for TableSamplePlanner {
331331
index_hints,
332332
} = relation
333333
else {
334-
return Ok(RelationPlanning::Original(relation));
334+
return Ok(RelationPlanning::Original(Box::new(relation)));
335335
};
336336

337337
// Extract sample spec (handles both before/after alias positions)
@@ -401,7 +401,9 @@ impl RelationPlanner for TableSamplePlanner {
401401

402402
let fraction = bucket_num as f64 / total as f64;
403403
let plan = TableSamplePlanNode::new(input, fraction, seed).into_plan();
404-
return Ok(RelationPlanning::Planned(PlannedRelation::new(plan, alias)));
404+
return Ok(RelationPlanning::Planned(Box::new(PlannedRelation::new(
405+
plan, alias,
406+
))));
405407
}
406408

407409
// Handle quantity-based sampling
@@ -422,15 +424,19 @@ impl RelationPlanner for TableSamplePlanner {
422424
let plan = LogicalPlanBuilder::from(input)
423425
.limit(0, Some(rows as usize))?
424426
.build()?;
425-
Ok(RelationPlanning::Planned(PlannedRelation::new(plan, alias)))
427+
Ok(RelationPlanning::Planned(Box::new(PlannedRelation::new(
428+
plan, alias,
429+
))))
426430
}
427431

428432
// TABLESAMPLE (N PERCENT) - percentage sampling
429433
Some(TableSampleUnit::Percent) => {
430434
let percent: f64 = parse_literal::<Float64Type>(&quantity_value_expr)?;
431435
let fraction = percent / 100.0;
432436
let plan = TableSamplePlanNode::new(input, fraction, seed).into_plan();
433-
Ok(RelationPlanning::Planned(PlannedRelation::new(plan, alias)))
437+
Ok(RelationPlanning::Planned(Box::new(PlannedRelation::new(
438+
plan, alias,
439+
))))
434440
}
435441

436442
// TABLESAMPLE (N) - fraction if <1.0, row limit if >=1.0
@@ -448,7 +454,9 @@ impl RelationPlanner for TableSamplePlanner {
448454
// Interpret as fraction
449455
TableSamplePlanNode::new(input, value, seed).into_plan()
450456
};
451-
Ok(RelationPlanning::Planned(PlannedRelation::new(plan, alias)))
457+
Ok(RelationPlanning::Planned(Box::new(PlannedRelation::new(
458+
plan, alias,
459+
))))
452460
}
453461
}
454462
}

datafusion/core/tests/user_defined/relation_planner.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,11 @@ fn plan_static_values_table(
6868
.project(vec![col("column1").alias(column_name)])?
6969
.build()?;
7070

71-
Ok(RelationPlanning::Planned(PlannedRelation::new(plan, alias)))
71+
Ok(RelationPlanning::Planned(Box::new(PlannedRelation::new(
72+
plan, alias,
73+
))))
7274
}
73-
other => Ok(RelationPlanning::Original(other)),
75+
other => Ok(RelationPlanning::Original(Box::new(other))),
7476
}
7577
}
7678

@@ -176,9 +178,11 @@ impl RelationPlanner for SamplingJoinPlanner {
176178
.cross_join(right_sampled)?
177179
.build()?;
178180

179-
Ok(RelationPlanning::Planned(PlannedRelation::new(plan, alias)))
181+
Ok(RelationPlanning::Planned(Box::new(PlannedRelation::new(
182+
plan, alias,
183+
))))
180184
}
181-
other => Ok(RelationPlanning::Original(other)),
185+
other => Ok(RelationPlanning::Original(Box::new(other))),
182186
}
183187
}
184188
}
@@ -195,7 +199,7 @@ impl RelationPlanner for PassThroughPlanner {
195199
_context: &mut dyn RelationPlannerContext,
196200
) -> Result<RelationPlanning> {
197201
// Never handles anything - always delegates
198-
Ok(RelationPlanning::Original(relation))
202+
Ok(RelationPlanning::Original(Box::new(relation)))
199203
}
200204
}
201205

@@ -217,7 +221,7 @@ impl RelationPlanner for PremiumFeaturePlanner {
217221
to unlock advanced array operations."
218222
.to_string(),
219223
)),
220-
other => Ok(RelationPlanning::Original(other)),
224+
other => Ok(RelationPlanning::Original(Box::new(other))),
221225
}
222226
}
223227
}

datafusion/core/tests/user_defined/user_defined_scalar_functions.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,19 +1306,14 @@ async fn create_scalar_function_from_sql_statement_default_arguments() -> Result
13061306
"Error during planning: Non-default arguments cannot follow default arguments.";
13071307
assert!(expected.starts_with(&err.strip_backtrace()));
13081308

1309-
// FIXME: The `DEFAULT` syntax does not work with positional params
1310-
let bad_expression_sql = r#"
1309+
let expression_sql = r#"
13111310
CREATE FUNCTION bad_expression_fun(DOUBLE, DOUBLE DEFAULT 2.0)
13121311
RETURNS DOUBLE
13131312
RETURN $1 + $2
13141313
"#;
1315-
let err = ctx
1316-
.sql(bad_expression_sql)
1317-
.await
1318-
.expect_err("sqlparser error");
1319-
let expected =
1320-
"SQL error: ParserError(\"Expected: ), found: 2.0 at Line: 2, Column: 63\")";
1321-
assert!(expected.starts_with(&err.strip_backtrace()));
1314+
let result = ctx.sql(expression_sql).await;
1315+
1316+
assert!(result.is_ok());
13221317
Ok(())
13231318
}
13241319

datafusion/expr/src/expr.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ use datafusion_functions_window_common::field::WindowUDFFieldArgs;
4242
#[cfg(feature = "sql")]
4343
use sqlparser::ast::{
4444
ExceptSelectItem, ExcludeSelectItem, IlikeSelectItem, RenameSelectItem,
45-
ReplaceSelectElement, display_comma_separated,
45+
ReplaceSelectElement,
4646
};
4747

4848
// Moved in 51.0.0 to datafusion_common
@@ -1268,7 +1268,6 @@ impl Display for ExceptSelectItem {
12681268
}
12691269
}
12701270

1271-
#[cfg(not(feature = "sql"))]
12721271
pub fn display_comma_separated<T>(slice: &[T]) -> String
12731272
where
12741273
T: Display,

datafusion/expr/src/planner.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,9 +369,9 @@ impl PlannedRelation {
369369
#[derive(Debug)]
370370
pub enum RelationPlanning {
371371
/// The relation was successfully planned by an extension planner
372-
Planned(PlannedRelation),
372+
Planned(Box<PlannedRelation>),
373373
/// No extension planner handled the relation, return it for default processing
374-
Original(TableFactor),
374+
Original(Box<TableFactor>),
375375
}
376376

377377
/// Customize planning SQL table factors to [`LogicalPlan`]s.

datafusion/sql/src/planner.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
823823
| SQLDataType::HugeInt
824824
| SQLDataType::UHugeInt
825825
| SQLDataType::UBigInt
826-
| SQLDataType::TimestampNtz
826+
| SQLDataType::TimestampNtz{..}
827827
| SQLDataType::NamedTable { .. }
828828
| SQLDataType::TsVector
829829
| SQLDataType::TsQuery

0 commit comments

Comments
 (0)