Skip to content

Commit

Permalink
Mark StatExtractor.UpdateStatisticsModel obsolete
Browse files Browse the repository at this point in the history
  • Loading branch information
albertospelta committed Mar 25, 2024
1 parent 9abe8e2 commit 977bfb5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Dax.Model.Extractor/StatExtractor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ protected IDbCommand CreateCommand(string commandText)
return Connection.CreateCommand(commandText);
}

// UpdateStatisticsModel has been marked as obsolete because its usage may require rerunning the DMVs for models with DirectLake partitions. Since this logic should be handled by the library, we may consider removing it from the public APIs in a future release.
[Obsolete("This method may produce incomplete results if used on a model with DirectLake partitions and DirectLakeExtractionMode parameter set to anything other than ResidentOnly. Use TomExtractor.GetDaxModel instead.")]
public static void UpdateStatisticsModel(Dax.Metadata.Model daxModel, IDbConnection connection, int sampleRows = 0, bool analyzeDirectQuery = false , DirectLakeExtractionMode analyzeDirectLake = DirectLakeExtractionMode.ResidentOnly)
{
// TODO: Remove this code and use the ExtractorSettings as a parameter.
Expand Down
4 changes: 4 additions & 0 deletions src/Dax.Model.Extractor/TomExtractor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,9 @@ public static Dax.Metadata.Model GetDaxModel(string connectionString, string app
// Populate statistics by querying the data model
if (readStatisticsFromData)
{
#pragma warning disable CS0618 // Type or member is obsolete
StatExtractor.UpdateStatisticsModel(daxModel, connection, sampleRows, analyzeDirectQuery, analyzeDirectLake);
#pragma warning restore CS0618 // Type or member is obsolete

// If model has any DL partitions and 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 && daxModel.HasDirectLakePartitions())
Expand Down Expand Up @@ -358,7 +360,9 @@ public static Dax.Metadata.Model GetDaxModel(string serverName, string databaseN
// Populate statistics by querying the data model
if (readStatisticsFromData)
{
#pragma warning disable CS0618 // Type or member is obsolete
StatExtractor.UpdateStatisticsModel(daxModel, connection, sampleRows, analyzeDirectQuery, analyzeDirectLake);
#pragma warning restore CS0618 // Type or member is obsolete

// If model has any DL partitions and 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 && daxModel.HasDirectLakePartitions())
Expand Down

0 comments on commit 977bfb5

Please sign in to comment.