关注 spark技术分享,
撸spark源码 玩spark最佳实践

AnalyzeTableCommand

AnalyzeTableCommand Logical Command — Computing Table-Level Statistics (Total Size and Row Count)

AnalyzeTableCommand is a logical command that computes statistics (i.e. total size and row count) for a table and stores the stats in a metastore.

AnalyzeTableCommand is created exclusively for ANALYZE TABLE with no PARTITION specification and FOR COLUMNS clause.

Executing Logical Command (Computing Table-Level Statistics and Altering Metastore) — run Method

Note
run is part of RunnableCommand Contract to execute (run) a logical command.

run requests the session-specific SessionCatalog for the metadata of the table and makes sure that it is not a view (aka temporary table).

Note
run uses the input SparkSession to access the session-specific SessionState that in turn gives access to the current SessionCatalog.


run computes the total size and, without NOSCAN flag, the row count statistics of the table.

Note
run uses SparkSession to find the table in a metastore.

run throws a AnalysisException when executed on a view.

Note

Row count statistics triggers a Spark job to count the number of rows in a table (that happens with ANALYZE TABLE with no NOSCAN flag).

Creating AnalyzeTableCommand Instance

AnalyzeTableCommand takes the following when created:

  • TableIdentifier

  • noscan flag (enabled by default) that indicates whether NOSCAN option was used or not

赞(0) 打赏
未经允许不得转载:spark技术分享 » AnalyzeTableCommand
分享到: 更多 (0)

关注公众号:spark技术分享

联系我们联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏