Skip to content

Commit 85c9f80

Browse files
committed
Extend column statistics analysis to include columns with GroupByColumns
This commit fixes an issue where the cardinality of a column would result in zero if the column had `GroupByColumns` specified and `IsAvailableInMDX=FALSE`. This occurred because statistics for columns with IsAvailableInMDX set to FALSE are not available in the DMV $SYSTEM.DISCOVER_STORAGE_TABLES (see WHERE LEFT(TABLE_ID, 2) = 'H$' in PopulateColumnsCardinality)
1 parent 81678eb commit 85c9f80

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Dax.Model.Extractor/StatExtractor.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ private void LoadColumnStatistics(bool analyzeDirectQuery, DirectLakeExtractionM
257257
// skip direct query tables if the analyzeDirectQuery is false
258258
where t.Columns.Count > 1 && (analyzeDirectQuery || !t.HasDirectQueryPartitions)
259259
from c in t.Columns
260-
where c.State == "Ready" && !c.IsRowNumber && c.GroupByColumns.Count == 0
260+
where c.State == "Ready" && !c.IsRowNumber
261261
// only include the column if the table does not have Direct Lake partitions or if they are resident or if analyzeDirectLake is true
262262
&& (!t.HasDirectLakePartitions
263263
|| (analyzeDirectLake >= DirectLakeExtractionMode.ResidentOnly && c.IsResident)

0 commit comments

Comments
 (0)