CountStarDeltaTable Scala Extractor¶
CountStarDeltaTable
is an extractor object (Scala) to extractGlobalCount for an Aggregate logical operator.
Matching Aggregate¶
unapply(
plan: Aggregate): Option[Long]
unapply
extractGlobalCount for an Aggregate
(Spark SQL) logical operator with the following:
- No grouping expressions
Alias(AggregateExpression(Count(Seq(Literal(1, _))), Complete, false, None, _), _)
aggregate expression- DeltaTable over a TahoeLogFileIndex with no partition filters
Otherwise, unapply
gives None
(to indicate no match).
unapply
is used when:
OptimizeMetadataOnlyDeltaQuery
is requested to optimizeQueryWithMetadata
extractGlobalCount¶
extractGlobalCount(
tahoeLogFileIndex: TahoeLogFileIndex): Option[Long]
extractGlobalCount
gets a DeltaScanGenerator for the given TahoeLogFileIndex.
extractGlobalCount
requests the DeltaScanGenerator
to filesWithStatsForScan (that gives a DataFrame
) to execute the following aggregations on:
sum("stats.numRecords")
count(when(col("stats.numRecords").isNull, 1))