发布

  • [OPIK-4932] [OPIK-4937] [BE] Add project_id to experiments for project-scoped operations (#5694)

    frostbyte_neo 发布于 2026-03-18 13:17:05 +00:00

    • [OPIK-4932] [OPIK-4937] [BE] Add project_id to experiments table and support project scoping

    Add project_id column with minmax index to ClickHouse experiments table.
    Update ExperimentService, ExperimentDAO, and ExperimentsResource to support
    project_id on create (via projectId or projectName) and filtering on list.

    • Revision 2: Make resolveProjectId reactive in experiment creation chain

    Chain resolveProjectId as a flatMap in the reactive pipeline instead of
    calling it synchronously, avoiding blocking the reactive chain.

    • Revision 3: Move project_id filter into UNION branches and fix empty-string bug
    • Move project_id predicate from outer WHERE into each UNION branch for
      FIND and FIND_GROUPS queries, so aggregations are filtered early
    • Fix arrayConcat to not append '' when experiment project_id is null,
      which was incorrectly triggering the project_deleted predicate
    • Use agg.project_ids directly in aggregated branches since
      experiments_from_aggregates_final already has the project_id
    • [OPIK-4932] [BE] fix: use createPartialExperiment in DatasetsResourceTest

    Use experimentResourceClient.createPartialExperiment() instead of
    factory.manufacturePojo(Experiment.class) to avoid PODAM generating
    random projectId values that fail validation after project_id support
    was added to experiments.

    • [OPIK-4932] [BE] fix: capitalize SQL FROM keyword in ExperimentDAO

    • [OPIK-4932] [BE] fix: address PR comments — non-nullable project_id, alias refs, materialize index

    • Change project_id from Nullable(FixedString(36)) to FixedString(36) DEFAULT ''
      to avoid Nullable performance overhead in ClickHouse
    • Replace coalesce/isNull with if(notEmpty(...))/empty() for non-nullable column
    • Reference pre-computed combined_project_ids/project_ids aliases in WHERE clauses
      instead of repeating arrayConcat expressions
    • Add MATERIALIZE INDEX to populate idx_project_id on existing data
    • Remove unnecessary toString() calls since project_id is already a string
    • [OPIK-4932] [BE] fix: use String instead of FixedString(36) for project_id column

    • [OPIK-4932] [BE] fix: align migration with liquibase conventions

    • Group rollbacks at end of changeset
    • Remove inline comments between statements
    • Fix --rollback empty format (no semicolon)
    • [OPIK-4932] [BE] fix: rename index to idx_experiments_project_id and use GRANULARITY 1

    • [NA] [BE] fix: rename migration 000068 to 000070 to avoid conflict with main

    • [OPIK-4932] [BE] test: fix createExperimentWithProjectName and createExperimentWithNewProjectName to include projectId in expected


    下载附件