[ 
https://issues.apache.org/jira/browse/FLINK-14965?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16988544#comment-16988544
 ] 

godfrey he edited comment on FLINK-14965 at 12/5/19 7:22 AM:
-------------------------------------------------------------

[FLINK-14662|https://issues.apache.org/jira/browse/FLINK-14662] had let 
CatalogTableStatistics.UNKNOWN be consistent with TableStats.UNKNOWN. 
however, the logic in {{CatalogTableStatisticsConverter#convertToTableStats}} 
method is also not correct: 
1. {{HiveCatalog}} will create a new instance even if all attributes in 
{{CatalogTableStatistics}} is unknown instead of using 
{{CatalogTableStatistics.UNKNOWN}}. And {{CatalogTableStatistics}} does not 
override {{equals}} method. So 
{{tableStatistics.equals(CatalogTableStatistics.UNKNOWN)}} is always false.
2. similar logic about {{equals}} on {{CatalogColumnStatistics}}
3. even if tableStatistics is null or tableStatistics is 
{{CatalogTableStatistics.UNKNOWN}}, the {{columnStatistics}} may be not 
UNKNOWN. It also needs to be convert to column stats.

the issue mainly fixes the above incorrect logic.


was (Author: godfreyhe):
[FLINK-14662|https://issues.apache.org/jira/browse/FLINK-14662] had let 
CatalogTableStatistics.UNKNOWN be consistent with TableStats.UNKNOWN. 
however, the logic in {{CatalogTableStatisticsConverter#convertToTableStats}} 
method is also not correct: 
1. {{HiveCatalog}} will create a new instance even if all attributes in 
{{CatalogTableStatistics}} is unknown instead of using 
{{CatalogTableStatistics.UNKNOWN}}. And {{CatalogTableStatistics}} does not 
override {{equals}} method. So 
`tableStatistics.equals(CatalogTableStatistics.UNKNOWN)` is always false.
2. similar logic about {{equals}} on {{CatalogColumnStatistics}}
3. even if tableStatistics is null or tableStatistics is 
{{CatalogTableStatistics.UNKNOWN}}, the {{columnStatistics}} may be not 
UNKNOWN. It also needs to be convert to column stats.

the issue mainly fixes the above incorrect logic.

> CatalogTableStatistics UNKNOWN should be consistent with TableStats UNKNOWN
> ---------------------------------------------------------------------------
>
>                 Key: FLINK-14965
>                 URL: https://issues.apache.org/jira/browse/FLINK-14965
>             Project: Flink
>          Issue Type: Bug
>    Affects Versions: 1.10.0
>            Reporter: Terry Wang
>            Priority: Major
>
> UNKNOWN stats in
> ` org.apache.flink.table.catalog.stats
> public class CatalogTableStatistics {
>       public static final CatalogTableStatistics UNKNOWN = new 
> CatalogTableStatistics(0, 0, 0, 0);
> `
> and 
> `
> org.apache.flink.table.plan.stats
> public final class TableStats {
>       public static final TableStats UNKNOWN = new TableStats(-1, new 
> HashMap<>());
> `
> are not consistent which will cause some cbo unexpect behavior



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to