![]() ![]() SUMMARIZE first clusters the table based on the color, and then computes the expression for each cluster by creating a filter context that limits the calculation to the iterated cluster. Clustering is the creation of partitions based on the columns used to group by. What it does is more complex.īecause the query needs to group by color, SUMMARIZE splits the table in partitions – one for each color. Unfortunately, this would be an approximation of the steps performed by SUMMARIZE. Intuitively, we might think that SUMMARIZE started by grouping Sales by Sales that it then iterated the result by computing the sum of Amount for all the rows with the same color, by creating a filter context over the color. This query produces the sales amount by color. On this simple table, we run a SUMMARIZE query that works just as expected: We use a table with only seven rows to introduce clustering. Introducing clusteringĬlustering is a technique used by SUMMARIZE to compute its result. We introduce the concepts one step at a time: first clustering, then the role of expanded tables in clustering, and finally the effect of the presence of both a row and a filter contexts in the same formula. In order to correctly understand SUMMARIZE you must understand how clustering works, what impact the presence of both a row and a filter context has, and the role of expanded tables in clustering. ![]() It could be even worse: The results might seem correct during the first tests, and yet this might only mean that SUMMARIZE is silently waiting to stab you in the back, by producing an incorrect result – nearly impossible to debug – as soon as you go in production. The thing is that the semantics of SUMMARIZE are so convoluted that the results might be unexpected. It is not that these functionalities do not work. The other two operations – creating new columns and computing subtotals – should be avoided. Out of the three main operations of SUMMARIZE, only the first one is safe.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |