Skip to content

SemanticException: Unknown column from ConnectorColumnStatsCacheLoader #65692

@kyle-goodale-klaviyo

Description

@kyle-goodale-klaviyo

Steps to reproduce the behavior (Required)

Select a struct field from a struct that is the result of an expression:

SELECT     
cast(parse_json('{"OrderId": 45}') as struct<OrderId varchar>).OrderId 
from `iceberg`.`prod`.`my_table` limit 1;

Note: This is the minimal reproducible example. We noticed this also happens when we parse a string column to json, cast it as a struct and then reference a field in that struct which is the main issue.

FE will throw warnings, if you have a lot of these it will flood the log with warnings.

2025-11-18 15:51:15.291Z ERROR (stats-cache-refresher-4|394) [ConnectorColumnStatsCacheLoader.lambda$asyncLoadAll$1():102] com.starrocks.sql.analyzer.SemanticException: Getting analyzing error. Detail message: Unknown column 'cast(parse_json({"OrderId": 45}) as struct<OrderId varchar>).OrderId' in 'my_table'.
 2025-11-18 15:51:15.291Z WARN (stats-cache-refresher-2|393) [CachedStatisticStorage.lambda$getConnectorTableStatistics$7():224] Get connector table column statistics filed, exception:
 java.util.concurrent.CompletionException: com.starrocks.sql.analyzer.SemanticException: Getting analyzing error. Detail message: Unknown column 'cast(parse_json({"OrderId": 45}) as struct<OrderId varchar>).OrderId' in 'my_table'.
	at com.starrocks.connector.statistics.ConnectorColumnStatsCacheLoader.lambda$asyncLoadAll$1(ConnectorColumnStatsCacheLoader.java:103)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: com.starrocks.sql.analyzer.SemanticException: Getting analyzing error. Detail message: Unknown column 'cast(parse_json({"OrderId": 45}) as struct<OrderId varchar>).OrderId' in 'my_table'.
	at com.starrocks.common.ErrorReport.reportSemanticException(ErrorReport.java:75)
	at com.starrocks.common.ErrorReport.reportSemanticException(ErrorReport.java:67)
	at com.starrocks.statistic.StatisticUtils.getQueryStatisticsColumnType(StatisticUtils.java:619)
	at com.starrocks.statistic.StatisticExecutor.queryStatisticSync(StatisticExecutor.java:98)
	at com.starrocks.connector.statistics.ConnectorColumnStatsCacheLoader.queryStatisticsData(ConnectorColumnStatsCacheLoader.java:125)
	at com.starrocks.connector.statistics.ConnectorColumnStatsCacheLoader.lambda$asyncLoadAll$1(ConnectorColumnStatsCacheLoader.java:93)
	... 4 more

Expected behavior (Required)

StarRocks should not throw warnings or attempt to lookup statistics for expressions like this

Real behavior (Required)

StarRocks attempts to lookup statistics for expressions and litters the logs with warnings

StarRocks version (Required)

  • You can get the StarRocks version by executing SQL select current_version()

4.0.1-cd9df36
Note: this issue has been present for a while and is not unique to 4.x

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions