<commit_before>SELECT row_to_json(featcoll) as geojson FROM
  (SELECT 'FeatureCollection' AS TYPE, array_to_json(array_agg(feat)) AS features FROM
    (SELECT 'Feature' AS TYPE, ST_AsGeoJSON({{ if (it.clipByBox2d) { }}ST_ClipByBox2D{{ } else { }}ST_Intersection{{ } }}(tbl.{{= it.geomColumn }}, st_expand(CDB_XYZ_Extent({{= it.coord.x }}, {{= it.coord.y }}, {{= it.zoom }}), {{= it.bufferDistance}})))::json AS geometry, {{ if (!it.columns || it.columns.length === 0) { }} '{}'::json {{ } else { }} row_to_json(
      (SELECT l FROM
        (SELECT {{ for (var i = 0; i < it.columns.length; i++) { }} {{= it.columns[i] }} {{ if (i < (it.columns.length - 1)) { }}, {{ } }} {{ } }}) AS l
      )
    ) {{ } }} AS properties
    FROM ({{= it.layerSql }}) AS tbl
    WHERE {{= it.geomColumn }} && st_expand(CDB_XYZ_Extent({{= it.coord.x }}, {{= it.coord.y }}, {{= it.zoom }}), {{= it.bufferDistance}})) AS feat) AS featcoll;<commit_msg>passes buffer distance calculation to sql query<commit_after>SELECT row_to_json(featcoll) as geojson FROM
  (SELECT 'FeatureCollection' AS TYPE, array_to_json(array_agg(feat)) AS features FROM
    (SELECT 'Feature' AS TYPE, ST_AsGeoJSON({{ if (it.clipByBox2d) { }}ST_ClipByBox2D{{ } else { }}ST_Intersection{{ } }}(tbl.{{= it.geomColumn }}, st_expand(CDB_XYZ_Extent({{= it.coord.x }}, {{= it.coord.y }}, {{= it.zoom }}), cdb_xyz_resolution({{= it.zoom }}) * {{= it.bufferSize}})))::json AS geometry, {{ if (!it.columns || it.columns.length === 0) { }} '{}'::json {{ } else { }} row_to_json(
      (SELECT l FROM
        (SELECT {{ for (var i = 0; i < it.columns.length; i++) { }} {{= it.columns[i] }} {{ if (i < (it.columns.length - 1)) { }}, {{ } }} {{ } }}) AS l
      )
    ) {{ } }} AS properties
    FROM ({{= it.layerSql }}) AS tbl
    WHERE {{= it.geomColumn }} && st_expand(CDB_XYZ_Extent({{= it.coord.x }}, {{= it.coord.y }}, {{= it.zoom }}), cdb_xyz_resolution({{= it.zoom }}) * {{= it.bufferSize}})) AS feat) AS featcoll;
{'fraction_non_alphanumeric': 0.23523421588594703, 'fraction_numerical': 0.0050916496945010185, 'mean_word_length': 3.924812030075188, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '130231', 'n_tokens_mistral': 748, 'n_tokens_neox': 732, 'n_words': 157}