Skip to content

ISS-256326: add support for CONTAINS in join sql#193

Merged
shriram-devrev merged 2 commits intomainfrom
ISS-256326
Feb 12, 2026
Merged

ISS-256326: add support for CONTAINS in join sql#193
shriram-devrev merged 2 commits intomainfrom
ISS-256326

Conversation

@shriram-devrev
Copy link
Copy Markdown
Contributor

@shriram-devrev shriram-devrev commented Feb 9, 2026

work-item: ISS-256326

Screenshot 2026-02-11 at 6 03 33 PM

Query example:

SELECT
  count(id) AS dim_issue__id___function__count,
  dim_user__id,
  dim_part_test1__id
FROM
  (
    SELECT
      *
    FROM
      (
        SELECT
          *
        FROM
          devrev.dim_issue
      ) AS dim_issue
      LEFT JOIN (
        SELECT
          id AS dim_user__id,
          *
        FROM
          (
            SELECT
              created_by_id,
              created_date,
              dev_oid,
              display_id,
              email,
              id,
              is_deleted,
              modified_by_id,
              modified_date,
              fullname AS name,
              object_type,
              object_version,
              phone_numbers,
              primary_identity,
              state
            FROM
              devrev.dim_devu
            UNION ALL
            SELECT
              created_by_id,
              created_date,
              dev_oid,
              display_id,
              email,
              id,
              is_deleted,
              modified_by_id,
              modified_date,
              display_name AS name,
              object_type,
              object_version,
              phone_numbers,
              primary_identity,
              state
            FROM
              devrev.dim_revu
            UNION ALL
            SELECT
              created_by_id,
              created_date,
              dev_oid,
              display_id,
              email,
              id,
              is_deleted,
              modified_by_id,
              modified_date,
              display_name AS name,
              object_type,
              object_version,
              phone_numbers,
              primary_identity,
              state
            FROM
              devrev.dim_svcacc
            UNION ALL
            SELECT
              created_by_id,
              created_date,
              dev_oid,
              display_id,
              email,
              id,
              is_deleted,
              modified_by_id,
              modified_date,
              full_name AS name,
              object_type,
              object_version,
              phone_numbers,
              primary_identity,
              state
            FROM
              devrev.dim_sysu
          ) AS dim_user
      ) AS dim_user ON CONTAINS(dim_issue.owned_by_ids, dim_user.id)
      LEFT JOIN (
        SELECT
          id AS dim_part_test1__id,
          *
        FROM
          (
            SELECT
              annotations_json,
              apps,
              artifact_ids,
              attachment_ids,
              concat_keys,
              created_by_id,
              created_date,
              custom_fields,
              custom_schema_fragment_ids,
              delivered_as,
              description,
              dev_oid,
              display_id,
              external_source_data,
              id,
              is_deleted,
              links_json,
              modified_by_id,
              modified_date,
              name,
              object_type,
              object_version,
              owned_by_ids,
              parent_part_ids,
              part_category,
              part_type,
              ref_url,
              reference_ids,
              staged_info,
              state,
              stock_schema_fragment_id,
              subtype,
              sync_metadata,
              tags_json
            FROM
              devrev.dim_product
            UNION ALL
            SELECT
              annotations_json,
              apps,
              artifact_ids,
              attachment_ids,
              concat_keys,
              created_by_id,
              created_date,
              custom_fields,
              custom_schema_fragment_ids,
              delivered_as,
              description,
              dev_oid,
              display_id,
              external_source_data,
              id,
              is_deleted,
              links_json,
              modified_by_id,
              modified_date,
              name,
              object_type,
              object_version,
              owned_by_ids,
              parent_part_ids,
              part_category,
              part_type,
              ref_url,
              reference_ids,
              staged_info,
              state,
              stock_schema_fragment_id,
              subtype,
              sync_metadata,
              tags_json
            FROM
              devrev.dim_feature
            UNION ALL
            SELECT
              annotations_json,
              apps,
              artifact_ids,
              attachment_ids,
              concat_keys,
              created_by_id,
              created_date,
              custom_fields,
              custom_schema_fragment_ids,
              delivered_as,
              description,
              dev_oid,
              display_id,
              external_source_data,
              id,
              is_deleted,
              links_json,
              modified_by_id,
              modified_date,
              name,
              object_type,
              object_version,
              owned_by_ids,
              parent_part_ids,
              part_category,
              part_type,
              ref_url,
              reference_ids,
              staged_info,
              state,
              stock_schema_fragment_id,
              subtype,
              sync_metadata,
              tags_json
            FROM
              devrev.dim_capability
            UNION ALL
            SELECT
              annotations_json,
              apps,
              artifact_ids,
              attachment_ids,
              concat_keys,
              created_by_id,
              created_date,
              custom_fields,
              custom_schema_fragment_ids,
              delivered_as,
              description,
              dev_oid,
              display_id,
              external_source_data,
              id,
              is_deleted,
              links_json,
              modified_by_id,
              modified_date,
              name,
              object_type,
              object_version,
              owned_by_ids,
              parent_part_ids,
              part_category,
              part_type,
              ref_url,
              reference_ids,
              staged_info,
              state,
              stock_schema_fragment_id,
              subtype,
              sync_metadata,
              tags_json
            FROM
              devrev.dim_enhancement
          ) AS dim_part_test1
      ) AS dim_part_test1 ON dim_issue.applies_to_part_id = dim_part_test1.id
  ) AS MEERKAT_GENERATED_TABLE
GROUP BY
  dim_user__id,
  dim_part_test1__id

Comment thread meerkat-core/src/joins/joins.ts Outdated
Copy link
Copy Markdown
Contributor

@zaidjan-devrev zaidjan-devrev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets add integration tests

@shriram-devrev shriram-devrev force-pushed the ISS-256326 branch 2 times, most recently from 6c47877 to 72288ee Compare February 12, 2026 11:16
@shriram-devrev shriram-devrev merged commit 6ec22a0 into main Feb 12, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants