You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Flink Jira Bot (Jira)" <ji...@apache.org> on 2022/07/07 10:40:00 UTC

[jira] [Updated] (FLINK-20899) encounter ClassCastException when calculating cost in HepPlanner

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

Flink Jira Bot updated FLINK-20899:
-----------------------------------
    Labels: auto-deprioritized-major auto-unassigned pull-request-available stale-minor  (was: auto-deprioritized-major auto-unassigned pull-request-available)

I am the [Flink Jira Bot|https://github.com/apache/flink-jira-bot/] and I help the community manage its development. I see this issues has been marked as Minor but is unassigned and neither itself nor its Sub-Tasks have been updated for 180 days. I have gone ahead and marked it "stale-minor". If this ticket is still Minor, please either assign yourself or give an update. Afterwards, please remove the label or in 7 days the issue will be deprioritized.


> encounter ClassCastException when calculating cost in HepPlanner
> ----------------------------------------------------------------
>
>                 Key: FLINK-20899
>                 URL: https://issues.apache.org/jira/browse/FLINK-20899
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Planner
>            Reporter: godfrey he
>            Priority: Minor
>              Labels: auto-deprioritized-major, auto-unassigned, pull-request-available, stale-minor
>
> After TREACE level is enabled for Logger, we will encounter ClassCastException when executing the following query:
> {code:sql}
> SELECT COUNT(*) FROM MyTable
> {code}
> the exception detail is:
> {code:java}
> java.lang.ClassCastException: org.apache.calcite.plan.RelOptCostImpl$Factory cannot be cast to org.apache.flink.table.planner.plan.cost.FlinkCostFactory
> 	at org.apache.flink.table.planner.plan.nodes.physical.common.CommonPhysicalExchange.computeSelfCost(CommonPhysicalExchange.scala:53)
> 	at org.apache.flink.table.planner.plan.metadata.FlinkRelMdNonCumulativeCost.getNonCumulativeCost(FlinkRelMdNonCumulativeCost.scala:41)
> 	at GeneratedMetadataHandler_NonCumulativeCost.getNonCumulativeCost_$(Unknown Source)
> 	at GeneratedMetadataHandler_NonCumulativeCost.getNonCumulativeCost(Unknown Source)
> 	at org.apache.calcite.rel.metadata.RelMetadataQuery.getNonCumulativeCost(RelMetadataQuery.java:288)
> 	at org.apache.flink.table.planner.plan.metadata.FlinkRelMdCumulativeCost.getCumulativeCost(FlinkRelMdCumulativeCost.scala:38)
> 	at GeneratedMetadataHandler_CumulativeCost.getCumulativeCost_$(Unknown Source)
> 	at GeneratedMetadataHandler_CumulativeCost.getCumulativeCost(Unknown Source)
> 	at GeneratedMetadataHandler_CumulativeCost.getCumulativeCost_$(Unknown Source)
> 	at GeneratedMetadataHandler_CumulativeCost.getCumulativeCost(Unknown Source)
> 	at org.apache.calcite.rel.metadata.RelMetadataQuery.getCumulativeCost(RelMetadataQuery.java:269)
> 	at org.apache.flink.table.planner.plan.metadata.FlinkRelMdCumulativeCost$$anonfun$getCumulativeCost$1.apply(FlinkRelMdCumulativeCost.scala:41)
> 	at org.apache.flink.table.planner.plan.metadata.FlinkRelMdCumulativeCost$$anonfun$getCumulativeCost$1.apply(FlinkRelMdCumulativeCost.scala:40)
> 	at scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:157)
> 	at scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:157)
> 	at scala.collection.Iterator$class.foreach(Iterator.scala:891)
> 	at scala.collection.AbstractIterator.foreach(Iterator.scala:1334)
> 	at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
> 	at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
> 	at scala.collection.TraversableOnce$class.foldLeft(TraversableOnce.scala:157)
> 	at scala.collection.AbstractTraversable.foldLeft(Traversable.scala:104)
> 	at org.apache.flink.table.planner.plan.metadata.FlinkRelMdCumulativeCost.getCumulativeCost(FlinkRelMdCumulativeCost.scala:39)
> 	at GeneratedMetadataHandler_CumulativeCost.getCumulativeCost_$(Unknown Source)
> 	at GeneratedMetadataHandler_CumulativeCost.getCumulativeCost(Unknown Source)
> 	at org.apache.calcite.rel.metadata.RelMetadataQuery.getCumulativeCost(RelMetadataQuery.java:269)
> 	at org.apache.calcite.plan.AbstractRelOptPlanner.getCost(AbstractRelOptPlanner.java:247)
> 	at org.apache.calcite.plan.hep.HepPlanner.dumpGraph(HepPlanner.java:1023)
> 	at org.apache.calcite.plan.hep.HepPlanner.setRoot(HepPlanner.java:159)
> 	at org.apache.flink.table.planner.plan.optimize.program.FlinkHepProgram.optimize(FlinkHepProgram.scala:60)
> {code}
> The reason is the HepPlanner will calculate the cost of the optimized plan when TRACE is enabled, while the cost factory in hep planner is {{RelOptCostImpl.Factory}}, not the sub-class of FlinkCostFactory.
> The solution is we should create HepPlanner with the cost factory in the RelOptCluster.



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