danny0405 commented on code in PR #11568:
URL: https://github.com/apache/hudi/pull/11568#discussion_r1667210583
##########
hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/spark/sql/hudi/analysis/HoodieAnalysis.scala:
##########
@@ -408,12 +408,20 @@ case class ResolveImplementationsEarly() extends
Rule[LogicalPlan] {
override def apply(plan: LogicalPlan): LogicalPlan = {
plan match {
// Convert to InsertIntoHoodieTableCommand
- case iis @ MatchInsertIntoStatement(relation @ ResolvesToHudiTable(_),
partition, query, overwrite, _) if query.resolved =>
+ case iis @ MatchInsertIntoStatement(relation @ ResolvesToHudiTable(_),
userSpecifiedCols, partition, query, overwrite, _) if query.resolved =>
relation match {
// NOTE: In Spark >= 3.2, Hudi relations will be resolved as
[[DataSourceV2Relation]]s by default;
// However, currently, fallback will be applied downgrading
them to V1 relations, hence
// we need to check whether we could proceed here, or has to
wait until fallback rule kicks in
- case lr: LogicalRelation => new InsertIntoHoodieTableCommand(lr,
query, partition, overwrite)
+ case lr: LogicalRelation =>
+ // Create a project if this is an INSERT INTO query with specified
cols.
+ val projectByUserSpecified = if (userSpecifiedCols.nonEmpty) {
+ assert(lr.catalogTable.isDefined, "Missing catalog table")
Review Comment:
Use `ValidationUtils.checkState` instead.
--
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]