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

DescribeTableCommand

DescribeTableCommand Logical Command

DescribeTableCommand is a logical command that executes a DESCRIBE TABLE SQL statement.

DescribeTableCommand is created exclusively when SparkSqlAstBuilder is requested to parse DESCRIBE TABLE SQL statement (with no column specified).

DescribeTableCommand uses the following output schema:

  • col_name as the name of the column

  • data_type as the data type of the column

  • comment as the comment of the column

Executing Logical Command — run Method

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

run uses the SessionCatalog (of the SessionState of the input SparkSession) and branches off per the type of the table to display.

For a temporary view, run requests the SessionCatalog to lookupRelation to access the schema and describeSchema.

For all other table types, run does the following:

Describing Detailed Partition and Storage Information — describeFormattedDetailedPartitionInfo Internal Method

describeFormattedDetailedPartitionInfo simply adds the following entries (rows) to the input mutable buffer:

  1. A new line

  2. # Detailed Partition Information

  3. Database with the database of the given table

  4. Table with the table of the given tableIdentifier

  5. Partition specification (of the CatalogTablePartition)

  6. A new line

  7. # Storage Information

  8. Bucketing specification of the table (if defined)

  9. Storage specification of the table

Note
describeFormattedDetailedPartitionInfo is used exclusively when DescribeTableCommand is requested to describeDetailedPartitionInfo with a non-empty partitionSpec and the isExtended flag on.

Describing Detailed Table Information — describeFormattedTableInfo Internal Method

describeFormattedTableInfo…​FIXME

Note
describeFormattedTableInfo is used exclusively when DescribeTableCommand is requested to run for a non-temporary table and the isExtended flag on.

describeDetailedPartitionInfo Internal Method

describeDetailedPartitionInfo…​FIXME

Note
describeDetailedPartitionInfo is used exclusively when DescribeTableCommand is requested to run with a non-empty partitionSpec.

Creating DescribeTableCommand Instance

DescribeTableCommand takes the following when created:

  • TableIdentifier

  • TablePartitionSpec

  • isExtended flag

DescribeTableCommand initializes the internal registries and counters.

describeSchema Internal Method

describeSchema…​FIXME

Note
describeSchema is used when…​FIXME

Describing Partition Information — describePartitionInfo Internal Method

describePartitionInfo…​FIXME

Note
describePartitionInfo is used when…​FIXME
赞(0) 打赏
未经允许不得转载:spark技术分享 » DescribeTableCommand
分享到: 更多 (0)

关注公众号:spark技术分享

联系我们联系我们

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

支付宝扫一扫打赏

微信扫一扫打赏