bersprockets commented on a change in pull request #26016: [SPARK-24914][SQL]
New statistic to improve data size estimate for columnar storage formats
URL: https://github.com/apache/spark/pull/26016#discussion_r332289308
##########
File path:
sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala
##########
@@ -1186,10 +1186,17 @@ private[hive] object HiveClientImpl {
// return None.
// In Hive, when statistics gathering is disabled, `rawDataSize` and
`numRows` is always
// zero after INSERT command. So they are used here only if they are
larger than zero.
+ val deserFactor = properties.get(STATISTICS_DESER_FACTOR).map(_.toInt)
if (totalSize.isDefined && totalSize.get > 0L) {
- Some(CatalogStatistics(sizeInBytes = totalSize.get, rowCount =
rowCount.filter(_ > 0)))
+ Some(CatalogStatistics(
+ sizeInBytes = totalSize.get,
+ deserFactor = deserFactor,
+ rowCount = rowCount.filter(_ > 0)))
} else if (rawDataSize.isDefined && rawDataSize.get > 0) {
- Some(CatalogStatistics(sizeInBytes = rawDataSize.get, rowCount =
rowCount.filter(_ > 0)))
+ Some(CatalogStatistics(
+ sizeInBytes = rawDataSize.get,
Review comment:
If you've run `analyze table compute statistics` in Hive, rawDataSize can be
a pretty big number, e.g.:
<pre>
parameters:{totalSize=8124889, numRows=2000000, rawDataSize=212750000,
EXTERNAL=TRUE, etc.,,,
</pre>
I'm not sure how you'd end up with a rawDataSize but no totalSize (which is
how you'd end up in this else/if block), but the value of rawDataSize is 26
times bigger than totalSize (which is nearly the same as your calculated
deserFactor in this particular case).
However, rawSize is not always big like that (for example, in Hive 1.2, it
appears to simply be columnCount*rowCount).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]