[
https://issues.apache.org/jira/browse/CALCITE-5844?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17746012#comment-17746012
]
JingDas commented on CALCITE-5844:
----------------------------------
[~jiajunbernoulli] As you said,ViewTable will be expanded during query planning.
I made a small custom change, I customized a relNode such as `ExpansionNode` to
express the view.
After calling `RelOptTable.ViewExpander#expandView` and view expending,
the expansionNode is preserved(just like placeHolder) and the view logic below
is also expanded.
Then I custom method in self `CustomRelMdColumnOrigins#getColumnOrigins`, and
the method sign is
`getColumnOrigins(ExpansionNode node, RelMetadataQuery mq, int iOutputColumn)`
In theory, I can get the relationship of the field source on the view and stop
recursively to the table.
> Make RelMdColumnOrigins to be extendable for getting columnOrigins from
> viewTable
> ---------------------------------------------------------------------------------
>
> Key: CALCITE-5844
> URL: https://issues.apache.org/jira/browse/CALCITE-5844
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Reporter: JingDas
> Priority: Minor
>
> In our scene, Getting field from view is expected when call
> RelMdColumnOrigins#getColumnOrigins.
> So I want to define customized RelMdColumnOrigins extend *RelMdColumnOrigins*
> which can *getColumnOrigins* from viewTable.
> Then I add customized RelMdColumnOrigins to {*}ChainedRelMetadataProvider{*},
> keep the sequence before DefaultRelMetadataProvider.INSTANCE.
> After doing all above, I can get columnOrigins from viewTable.
>
> But I found the private modifier constructor in class RelMdColumnOrigins(also
> such as
> RelMdCollation, RelMdColumnUniqueness, RelMdDistribution,
> RelMdExplainVisibility,
> RelMdPercentageOriginalRows, RelMdPopulationSize, RelMdUniqueKeys
> ),
> and protected modifier constructors(such as RelMdDistinctRowCount,
> RelMdExpressionLineage, RelMdLowerBoundCost,
> RelMdMemory, RelMdParallelism, RelMdSelectivity, RelMdSize,
> RelMdTableReferences
> )
> and public modifier constructors(such as RelMdAllPredicates,
> RelMdMaxRowCount, RelMdMinRowCount, RelMdNodeTypes,
> RelMdPredicates, RelMdRowCount,
> )
> I haven't had a chance to extend this class to add my custom logic because
> the constructor modifier is private.
> These "RelMd"prefixed class are default implementation, They should can be
> extended for user to add
> customed logic.
> For extensibility, I think this modifier maybe protected for these
> "RelMd"prefixed class whose modifier is private.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)