Skip to content

Commit 3cd7c32

Browse files
committed
Add columnBatchSize validation to UpdateStatisticsModel method
Added a check to ensure `columnBatchSize` is greater than zero in the `UpdateStatisticsModel` method of `StatExtractor.cs`
1 parent cbc452a commit 3cd7c32

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Dax.Model.Extractor/StatExtractor.cs

+3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ protected IDbCommand CreateCommand(string commandText)
3333
[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.")]
3434
public static void UpdateStatisticsModel(Dax.Metadata.Model daxModel, IDbConnection connection, int sampleRows = 0, bool analyzeDirectQuery = false , DirectLakeExtractionMode analyzeDirectLake = DirectLakeExtractionMode.ResidentOnly, int columnBatchSize = DefaultColumnBatchSize)
3535
{
36+
if (columnBatchSize < 1)
37+
throw new ArgumentException("Column batch size must be greater than zero.", nameof(columnBatchSize));
38+
3639
// TODO: Remove after rafactoring the code to use ExtractorSettings: ExtractorProperties as a parameter
3740
daxModel.ExtractorProperties.StatisticsEnabled = true;
3841
daxModel.ExtractorProperties.DirectQueryMode = analyzeDirectQuery ? DirectQueryExtractionMode.Full : DirectQueryExtractionMode.None;

0 commit comments

Comments
 (0)