Skip to content

Spark: Prohibit subqueries in conditions of MERGE operations#2118

Merged
rdblue merged 3 commits intoapache:masterfrom
aokolnychyi:merge-disable-subqueries
Jan 21, 2021
Merged

Spark: Prohibit subqueries in conditions of MERGE operations#2118
rdblue merged 3 commits intoapache:masterfrom
aokolnychyi:merge-disable-subqueries

Conversation

@aokolnychyi
Copy link
Contributor

This PR disables subqueries in conditions of MERGE operations until we figure out the best way to support them.

@github-actions github-actions bot added the spark label Jan 20, 2021
import org.apache.spark.sql.catalyst.plans.logical.MergeIntoTable
import org.apache.spark.sql.catalyst.plans.logical.UpdateAction

object MergeIntoTablePredicateCheck extends (LogicalPlan => Unit) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aokolnychyi I am thinking if we should have a single rule for checking all the plans that iceberg rewrites instead of having a separate check for each one ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fine either way. It did seem like the logic was separate but we can refactor this part out once we have UPDATEs.

@dilipbiswal
Copy link
Contributor

Looks good to me.

@karuppayya
Copy link
Contributor

Change looks good to me.

@dilipbiswal
Copy link
Contributor

LGTM

@aokolnychyi aokolnychyi reopened this Jan 20, 2021
case DeleteAction(Some(cond)) => checkMergeIntoCondition(cond, "DELETE")
case UpdateAction(Some(cond), _) => checkMergeIntoCondition(cond, "UPDATE")
case InsertAction(Some(cond), _) => checkMergeIntoCondition(cond, "INSERT")
case _ => // OK
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we actually OK if something else gets through here? Shouldn't this be a "Unknown or unsupported action"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There may be actions without conditions too.

@rdblue rdblue merged commit 41fd101 into apache:master Jan 21, 2021
XuQianJin-Stars pushed a commit to XuQianJin-Stars/iceberg that referenced this pull request Mar 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants