Github user marmbrus commented on a diff in the pull request:
https://github.com/apache/spark/pull/1238#discussion_r15206175
--- Diff:
sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala ---
@@ -263,6 +268,19 @@ private[hive] case class MetastoreRelation
new Partition(hiveQlTable, p)
}
+ @transient override lazy val statistics = Statistics(
+ // TODO: check if this estimate is valid for tables after partition
pruning.
+ sizeInBytes = {
+ // NOTE: kind of hacky, but this should be relatively cheap if
parameters for the table are
+ // populated into the metastore. An alternative would be going
through Hadoop's FileSystem
+ // API, which can be expensive if a lot of RPCs are involved.
Besides `totalSize`, there are
+ // also `numFiles`, `numRows`, `rawDataSize` keys we can look at in
the future.
+ val sizeMaybeFromMetastore =
+
Option(hiveQlTable.getParameters.get("totalSize")).map(_.toLong).getOrElse(-1L)
+ math.max(sizeMaybeFromMetastore, 1L)
--- End diff --
Why `1L` and not default size?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---