在MySQL
中,我们可以查询information_schema.tables
表,得到data_length
或table_rows
等有用信息>
select
data_length
, table_rows
from
information_schema.tables
where
table_schema='some_db'
and table_name='some_table';
+-------------+------------+
| data_length | table_rows |
+-------------+------------+
| 8368 | 198 |
+-------------+------------+
1 row in set (0.01 sec)
SparkSQL/Hive 是否有等效的机制?
我可以使用 SparkSQL
或像 HiveMetaStoreClient
这样的程序 API (java API org.apache.hadoop.hive.metastore.HiveMetaStoreClient
) .对于后者,我阅读了 API 文档 ( here ),但找不到任何与表行号和大小相关的方法。
最佳答案
元信息没有一个命令。而是有一组 commands , 你可以使用
描述表/ View /列
desc [formatted|extended] schema_name.table_name;
show table extended like part_table;
SHOW TBLPROPERTIES tblname("foo");
显示列统计信息(Hive 0.14.0 及更高版本)
DESCRIBE FORMATTED [db_name.]table_name column_name;
DESCRIBE FORMATTED [db_name.]table_name column_name PARTITION (partition_spec);
关于apache-spark - SparkSQL/配置单元 : equivalent of MySQL's `information_schema.table.{data_length, table_rows}` ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49203014/