{
  "case_id": "representative-business-slow-queries-in-premium-cluster-during-latest-window",
  "hook_runs": [
    {
      "args": [
        "resolve-window",
        "--cluster-id",
        "{{environment.cluster_id}}",
        "--cluster-label",
        "{{environment.cluster_label}}",
        "--local-hour",
        "11",
        "--local-minute",
        "0",
        "--duration-minutes",
        "5",
        "--top-n",
        "3"
      ],
      "id": "resolve_runtime_window",
      "kind": "python_script",
      "output_id": "resolved_window",
      "output_path": "runtime/resolved_window.json",
      "path": "runtime_hook.py",
      "required": true,
      "stage": "before_acp",
      "status": "ok"
    },
    {
      "args": [
        "build-reference",
        "--cluster-id",
        "{{environment.cluster_id}}",
        "--cluster-label",
        "{{environment.cluster_label}}",
        "--start",
        "{{runtime.resolved_window.start}}",
        "--end",
        "{{runtime.resolved_window.end}}",
        "--top-n",
        "3"
      ],
      "id": "build_runtime_reference",
      "kind": "python_script",
      "output_id": "reference_answer",
      "output_path": "runtime/reference_answer.json",
      "path": "runtime_hook.py",
      "required": true,
      "stage": "before_judge",
      "status": "ok"
    }
  ],
  "outputs": {
    "reference_answer": {
      "data": {
        "cluster_id": "10748116073341772391",
        "cluster_label": "premium-main",
        "debug": {
          "excluded_control_sql_count": 0,
          "filter_rule": "exclude_transaction_and_control_sql",
          "query_sql": "SELECT digest, any_value(query) AS sample_sql, COUNT(*) AS exec_count, MAX(query_time) AS max_time, AVG(query_time) AS avg_time, MAX(mem_max) AS max_mem FROM clinic_data_proxy.slow_query_logs WHERE date = '20260721' AND time >= 1784602800 AND time <= 1784603100 GROUP BY digest ORDER BY exec_count DESC LIMIT 30",
          "ranking_rule": "exec_count_desc_then_avg_time_desc_then_digest_asc",
          "raw_row_count": 8
        },
        "evidence_sufficient": true,
        "reference_rows": [
          {
            "avg_time_s": 0.414,
            "digest": "992377525bc78cf77741e870a6a509f866749e322c5baf19d55703fc26970577",
            "exec_count": 90,
            "sample_sql_preview": "SELECT LOW_PRIORITY SQL_NO_CACHE `id` FROM `c66_seamless_others`.`t_seamless_log_aqua` WHERE `id` > 1152921504665110825 AND `id` < 2305843009250084684 AND `created_time` < FROM_UNI"
          },
          {
            "avg_time_s": 0.714,
            "digest": "bda1f10c99c3bfba07501f9579aeedaff16fcde326a3e99d75dd75adfd880ca6",
            "exec_count": 66,
            "sample_sql_preview": "SELECT LOW_PRIORITY SQL_NO_CACHE `id` FROM `c66_seamless_others`.`t_seamless_log_inbetween` WHERE `id` > 4899916394593024407 AND `id` < 6341068275349384987 AND `created_time` < FRO"
          },
          {
            "avg_time_s": 0.449,
            "digest": "d94be824b6c9bd25dd280afec2e0dda0e5b6b8f38d0f912d085a02f137f3130a",
            "exec_count": 15,
            "sample_sql_preview": "SELECT LOW_PRIORITY SQL_NO_CACHE `id` FROM `c66_seamless_others`.`t_seamless_log_inbetween` WHERE `id` >= 4899916394580972940 AND `id` < 6341068275349384987 AND `created_time` < FR"
          }
        ],
        "slow_queries": [
          {
            "avg_time_s": 0.414,
            "digest": "992377525bc78cf77741e870a6a509f866749e322c5baf19d55703fc26970577",
            "exec_count": 90
          },
          {
            "avg_time_s": 0.714,
            "digest": "bda1f10c99c3bfba07501f9579aeedaff16fcde326a3e99d75dd75adfd880ca6",
            "exec_count": 66
          },
          {
            "avg_time_s": 0.449,
            "digest": "d94be824b6c9bd25dd280afec2e0dda0e5b6b8f38d0f912d085a02f137f3130a",
            "exec_count": 15
          }
        ],
        "window": {
          "end": "2026-07-21T03:05:00Z",
          "start": "2026-07-21T03:00:00Z"
        }
      },
      "path": "runtime/reference_answer.json",
      "stage": "before_judge"
    },
    "resolved_window": {
      "data": {
        "cluster_id": "10748116073341772391",
        "cluster_label": "premium-main",
        "duration_minutes": 5,
        "end": "2026-07-21T03:05:00Z",
        "filter_rule": "exclude_transaction_and_control_sql",
        "id": "bjt-2026-07-21-1100-5m",
        "local_date": "2026-07-21",
        "local_timezone": "Asia/Shanghai",
        "ranking_rule": "exec_count_desc_then_avg_time_desc_then_digest_asc",
        "start": "2026-07-21T03:00:00Z",
        "top_n": 3
      },
      "path": "runtime/resolved_window.json",
      "stage": "before_acp"
    }
  },
  "schema_version": 1,
  "template_context": {
    "audit": {
      "dir": "/data/eval_audits/evalrun-a6921afa263e4be1a7c1bdcc298bbe72/evalcase-94272b66dd89438d8c831759f6bc608d"
    },
    "case": {
      "case_version": "028bfd401cb4",
      "id": "representative-business-slow-queries-in-premium-cluster-during-latest-window"
    },
    "environment": {
      "cluster_id": "10748116073341772391",
      "cluster_label": "premium-main",
      "cluster_type": "premium",
      "parent_id": "2026948324023603200",
      "profile": "stable-premium",
      "tidb_version": "v8.5.x"
    },
    "time_window": {
      "resolved_by_output": "resolved_window"
    },
    "workspace": {
      "dir": "/data/workspaces/ws-eval-1784625405607-0089da6b",
      "id": "ws-eval-1784625405607-0089da6b"
    }
  },
  "workspace_id": "ws-eval-1784625405607-0089da6b"
}
