You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Jing Zhang (Jira)" <ji...@apache.org> on 2021/12/27 10:29:00 UTC
[jira] [Updated] (CALCITE-4967) Support SQL hints for temporal table join
[ https://issues.apache.org/jira/browse/CALCITE-4967?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jing Zhang updated CALCITE-4967:
--------------------------------
Description:
h1. Background
Like hint on join, sometimes we need hint on temporal table join. For example, specify USE_HASH hint on temporal table join like the following sql,
{code:java}
select stream /*+ USE_HASH (orders) */ * from orders join products_temporal
for system_time as of orders.rowtime on orders.productid = products_temporal.productid
{code}
Now, above sql would translate into correlate instead of Join, like the following Tree Node.
{code:java}
LogicalDelta
LogicalProject(ROWTIME=[$0], PRODUCTID=[$1], ORDERID=[$2], PRODUCTID0=[$3], NAME=[$4], SUPPLIERID=[$5], SYS_START=[$6], SYS_END=[$7])
LogicalFilter(condition=[=($1, $3)])
LogicalCorrelate(correlation=[$cor0], joinType=[inner], requiredColumns=[{0}])
LogicalTableScan(table=[[CATALOG, SALES, ORDERS]])
LogicalSnapshot(period=[$cor0.ROWTIME])
LogicalTableScan(table=[[CATALOG, SALES, PRODUCTS_TEMPORAL]])
{code}
However, correlate is not a hintable node now and the hint could not be propagated to the correlate nodes.
So I wonder could we extend correlate to be a hintable node?
was:
h1. Background
Like hint on join, sometimes we need hint on temporal table join. For example, specify USE_HASH hint on temporal table join like the following sql,
{code:java}
select stream /*+ USE_HASH (orders) */ * from orders join products_temporal
for system_time as of orders.rowtime on orders.productid = products_temporal.productid
{code}
Now, above sql would translate into correlate instead of Join, like the following Tree Node.
{code:java}
LogicalDelta
LogicalProject(ROWTIME=[$0], PRODUCTID=[$1], ORDERID=[$2], PRODUCTID0=[$3], NAME=[$4], SUPPLIERID=[$5], SYS_START=[$6], SYS_END=[$7])
LogicalFilter(condition=[=($1, $3)])
LogicalCorrelate(correlation=[$cor0], joinType=[inner], requiredColumns=[{0}])
LogicalTableScan(table=[[CATALOG, SALES, ORDERS]])
LogicalSnapshot(period=[$cor0.ROWTIME])
LogicalTableScan(table=[[CATALOG, SALES, PRODUCTS_TEMPORAL]])
{code}
However, correlate is not a hintable node now. So I wonder could we extend correlate to be a hintable node?
> Support SQL hints for temporal table join
> -----------------------------------------
>
> Key: CALCITE-4967
> URL: https://issues.apache.org/jira/browse/CALCITE-4967
> Project: Calcite
> Issue Type: New Feature
> Components: core
> Reporter: Jing Zhang
> Priority: Major
>
> h1. Background
> Like hint on join, sometimes we need hint on temporal table join. For example, specify USE_HASH hint on temporal table join like the following sql,
> {code:java}
> select stream /*+ USE_HASH (orders) */ * from orders join products_temporal
> for system_time as of orders.rowtime on orders.productid = products_temporal.productid
> {code}
> Now, above sql would translate into correlate instead of Join, like the following Tree Node.
> {code:java}
> LogicalDelta
> LogicalProject(ROWTIME=[$0], PRODUCTID=[$1], ORDERID=[$2], PRODUCTID0=[$3], NAME=[$4], SUPPLIERID=[$5], SYS_START=[$6], SYS_END=[$7])
> LogicalFilter(condition=[=($1, $3)])
> LogicalCorrelate(correlation=[$cor0], joinType=[inner], requiredColumns=[{0}])
> LogicalTableScan(table=[[CATALOG, SALES, ORDERS]])
> LogicalSnapshot(period=[$cor0.ROWTIME])
> LogicalTableScan(table=[[CATALOG, SALES, PRODUCTS_TEMPORAL]])
> {code}
> However, correlate is not a hintable node now and the hint could not be propagated to the correlate nodes.
> So I wonder could we extend correlate to be a hintable node?
--
This message was sent by Atlassian Jira
(v8.20.1#820001)