[ 
https://issues.apache.org/jira/browse/SPARK-53809?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Yuchuan Huang updated SPARK-53809:
----------------------------------
    Description: 
Query optimization rules such as MergeScalarSubqueries check if two plans are 
identical by comparing their canonicalized form. For DSv2, for physical plan, 
the canonicalization goes down in the child hierarchy to the BatchScanExec, 
which has a doCanonicalize function; for logical plan, the canonicalization 
goes down to the DataSourceV2ScanRelation, which, however, does not have a 
doCanonicalize function. As a result, two logical plans who are semantically 
identical are not identified.

This PR proposes to add doCanonicalize function for DataSourceV2ScanRelation. 
The implementation is similar to the one implemented in BatchScanExec, because 
they are both the leafNodes of DSv2 logicalPlan and physicalPlan, respectively.

 

  was:
Query optimization rules such as MergeScalarSubqueries check if two plans are 
identical by [comparing their canonicalized form|#L219]. For DSv2, the 
comparison goes down to DataSourceV2ScanRelation in the hierarchy, which 
currently lacks of canonicalize function. 

 

This ticket aims to add doCanonicalize function for DataSourceV2ScanRelation, 
as well as the Scan interface. The reason is that two identical scan may have 
predicates in different order during QO rewrite. As a reference, [FileScan 
normalizes filters in def equal()|#L107]]

 

 


> Add canonicalization for dsv2 scan
> ----------------------------------
>
>                 Key: SPARK-53809
>                 URL: https://issues.apache.org/jira/browse/SPARK-53809
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 4.1.0
>            Reporter: Yuchuan Huang
>            Priority: Major
>              Labels: pull-request-available
>
> Query optimization rules such as MergeScalarSubqueries check if two plans are 
> identical by comparing their canonicalized form. For DSv2, for physical plan, 
> the canonicalization goes down in the child hierarchy to the BatchScanExec, 
> which has a doCanonicalize function; for logical plan, the canonicalization 
> goes down to the DataSourceV2ScanRelation, which, however, does not have a 
> doCanonicalize function. As a result, two logical plans who are semantically 
> identical are not identified.
> This PR proposes to add doCanonicalize function for DataSourceV2ScanRelation. 
> The implementation is similar to the one implemented in BatchScanExec, 
> because they are both the leafNodes of DSv2 logicalPlan and physicalPlan, 
> respectively.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to