The tile aggregation is being used to aggregate the point geometries depending on the zoom level.
In the Named Map definition, it has been defined the aggregation by:
"aggregation": {
"placement": "point-sample",
"columns": {
"total": {
"aggregate_function": "sum",
"aggregated_column": "counter"
}
},
"resolution": 32,
"threshold": 1
}
Where it is defined the resolution (size of the cell of the grid used to aggregate the points), placement (position of the aggregated point within the grid), the name of the column that will have the result of the aggregation (total) and the column and the operation used to make the aggregation.
In the SQL query, all fields of the dataset are selected, but also the "counter" field is selected by adding the value 1 to each row. This counter field that it is added on the SQL query, it is used to count the number of geometries when using the sum operation defined on the aggregation parameter of the map configuration JSON file.
Then in the CartoCSS , the total column (the column that contains the result of the aggregation) is being used to define the size of the aggregated points using TurboCARTO ramp() function and the labels of the aggregated points.
In this section of the CARTO developer center can be found more information about the map aggregation.