Skip to content

Commit

Permalink
Minor fixes for DirectLake metric collection (#119)
Browse files Browse the repository at this point in the history
* Re-run DmvExtractor only if readStatisticsFromData is enabled

* Add DmvExtractor re-run to GetDaxModel overload

* Remove analyzeDirectQuery filter when retreiving referential integrity violations
  • Loading branch information
albertospelta authored Mar 22, 2024
1 parent 1fa32d3 commit dc1faf8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
6 changes: 1 addition & 5 deletions src/Dax.Model.Extractor/StatExtractor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,8 @@ public void LoadRelationshipStatistics(int sampleRows = 0,bool analyzeDirectQuer
{
var loopInvalidRelationships = relationshipList.Where(r => r.InvalidRows > 0).ToList().SplitList(10);
#region Details
foreach (var relationshipSetComplete in loopInvalidRelationships)
foreach (var relationshipSet in loopInvalidRelationships)
{
var relationshipSet =
relationshipSetComplete
.Where(rel => analyzeDirectQuery || ((!rel.FromColumn.Table.HasDirectQueryPartitions) && (!rel.ToColumn.Table.HasDirectQueryPartitions)))
.ToList();
// Skip EVALUATE if no valid relationships are found
if (!relationshipSet.Any()) continue;

Expand Down
16 changes: 10 additions & 6 deletions src/Dax.Model.Extractor/TomExtractor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,13 @@ public static Dax.Metadata.Model GetDaxModel(string connectionString, string app
Dax.Metadata.Extractor.DmvExtractor.PopulateFromDmv(daxModel, connection, serverName, databaseName, applicationName, applicationVersion);

// Populate statistics by querying the data model
if (readStatisticsFromData) {
if (readStatisticsFromData)
{
Dax.Metadata.Extractor.StatExtractor.UpdateStatisticsModel(daxModel, connection, sampleRows, analyzeDirectQuery, analyzeDirectLake);

// if we have forced all columns into memory then re-run the DMVs to update the data with the new values after everything has been transcoded.
if (analyzeDirectLake > DirectLakeExtractionMode.ResidentOnly)
Dax.Metadata.Extractor.DmvExtractor.PopulateFromDmv(daxModel, connection, serverName, databaseName, applicationName, applicationVersion);
}
}
return daxModel;
Expand Down Expand Up @@ -351,12 +356,11 @@ public static Dax.Metadata.Model GetDaxModel(string serverName, string databaseN
// Populate statistics by querying the data model
if (readStatisticsFromData)
{
Dax.Metadata.Extractor.StatExtractor.UpdateStatisticsModel(daxModel, connection, sampleRows, analyzeDirectQuery, analyzeDirectLake );
}
Dax.Metadata.Extractor.StatExtractor.UpdateStatisticsModel(daxModel, connection, sampleRows, analyzeDirectQuery, analyzeDirectLake);

// if we have forced all columns into memory then re-run the DMVs to update the data with the new values after everything has been transcoded.
if (analyzeDirectLake > DirectLakeExtractionMode.ResidentOnly) {
Dax.Metadata.Extractor.DmvExtractor.PopulateFromDmv(daxModel, connection, serverName, databaseName, applicationName, applicationVersion);
// if we have forced all columns into memory then re-run the DMVs to update the data with the new values after everything has been transcoded.
if (analyzeDirectLake > DirectLakeExtractionMode.ResidentOnly)
Dax.Metadata.Extractor.DmvExtractor.PopulateFromDmv(daxModel, connection, serverName, databaseName, applicationName, applicationVersion);
}
}
return daxModel;
Expand Down

0 comments on commit dc1faf8

Please sign in to comment.