<commit_before>DROP VIEW IF EXISTS api.w_components;

CREATE OR REPLACE VIEW api.w_components
AS
SELECT
    component.id AS uid
    component.name as name,
    status.name as status,
    component.description,
	(
	 CASE WHEN 0 < (SELECT COUNT(co.id) FROM api.comments AS co WHERE co.component = component.id)
	 THEN (SELECT array_to_json(array_agg(co.comment))
            FROM api.comments AS co
            WHERE co.component = component.id)
	 ELSE (json_build_array()) END
	) AS comments,
	(
	 CASE WHEN 0 < (SELECT COUNT(ct.component) FROM api.component_taxonomy AS ct WHERE ct.component = component.id)
	 THEN (SELECT array_to_json(array_agg(tx.name))
        FROM api.component_taxonomy AS ct
        JOIN api.taxonomy AS tx ON ct.taxonomy = tx.id
        WHERE ct.component = component.id)
	 ELSE (json_build_array()) END
	) AS tags,
    json_build_array() AS licenses,
	(
	 CASE WHEN 0 < (SELECT COUNT(co.id) FROM api.links AS co WHERE co.component = component.id)
	 THEN (SELECT array_to_json(array_agg(json_build_object(
        'type',co.type,
        'ref',co.ref)))
      FROM api.links AS co
      WHERE co.component = component.id)
	 ELSE (json_build_array()) END
	) AS links,
    (
      SELECT array_to_json(array_agg(json_build_object(
        'name',us.name,<commit_msg>Fixed missing comma.<commit_after>DROP VIEW IF EXISTS api.w_components;

CREATE OR REPLACE VIEW api.w_components
AS
SELECT
    component.id AS uid,
    component.name as name,
    status.name as status,
    component.description,
	(
	 CASE WHEN 0 < (SELECT COUNT(co.id) FROM api.comments AS co WHERE co.component = component.id)
	 THEN (SELECT array_to_json(array_agg(co.comment))
            FROM api.comments AS co
            WHERE co.component = component.id)
	 ELSE (json_build_array()) END
	) AS comments,
	(
	 CASE WHEN 0 < (SELECT COUNT(ct.component) FROM api.component_taxonomy AS ct WHERE ct.component = component.id)
	 THEN (SELECT array_to_json(array_agg(tx.name))
        FROM api.component_taxonomy AS ct
        JOIN api.taxonomy AS tx ON ct.taxonomy = tx.id
        WHERE ct.component = component.id)
	 ELSE (json_build_array()) END
	) AS tags,
    json_build_array() AS licenses,
	(
	 CASE WHEN 0 < (SELECT COUNT(co.id) FROM api.links AS co WHERE co.component = component.id)
	 THEN (SELECT array_to_json(array_agg(json_build_object(
        'type',co.type,
        'ref',co.ref)))
      FROM api.links AS co
      WHERE co.component = component.id)
	 ELSE (json_build_array()) END
	) AS links,
    (
      SELECT array_to_json(array_agg(json_build_object(
        'name',us.name,
{'fraction_non_alphanumeric': 0.09590100541376644, 'fraction_numerical': 0.002320185614849188, 'mean_word_length': 3.17258064516129, 'pattern_counts': {'":': 0, '<': 9, '<?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': '6033384', 'n_tokens_mistral': 887, 'n_tokens_neox': 817, 'n_words': 237}