from __future__ import annotations

BENCHDB_TO_TABLES = {
    "tpcc": [
        "warehouse",
        "district",
        "customer",
        "item",
        "stock",
        "oorder",
        "history",
        "order_line",
        "new_order",
    ],
    "tatp": [
        "subscriber",
        "special_facility",
        "access_info",
        "call_forwarding",
    ],
    "tpch": [
        "region",
        "nation",
        "customer",
        "supplier",
        "part",
        "orders",
        "partsupp",
        "lineitem",
    ],
    "wikipedia": [
        "useracct",
        "watchlist",
        "ipblocks",
        "logging",
        "user_groups",
        "recentchanges",
        "page",
        "revision",
        "page_restrictions",
        "text",
    ],
    "voter": [
        "contestants",
        "votes",
        "area_code_state",
    ],
    "twitter": ["user_profiles", "tweets", "follows", "added_tweets", "followers"],
    "smallbank": ["accounts", "checking", "savings"],
    "sibench": ["sitest"],
    "seats": [
        "country",
        "airline",
        "airport",
        "customer",
        "flight",
        "airport_distance",
        "frequent_flyer",
        "reservation",
        "config_profile",
        "config_histograms",
    ],
    "resourcestresser": ["iotable", "cputable", "iotablesmallrow", "locktable"],
    "noop": ["fake"],
    "epinions": ["item", "review", "useracct", "trust", "review_rating"],
    "auctionmark": [
        "region",
        "useracct",
        "category",
        "config_profile",
        "global_attribute_group",
        "item",
        "item_comment",
        "useracct_feedback",
        "useracct_attributes",
        "item_bid",
        "useracct_watch",
        "global_attribute_value",
        "item_attribute",
        "item_image",
        "item_max_bid",
        "item_purchase",
        "useracct_item",
    ],
    "ycsb": ["usertable"],
}

# This list must be kept up to date with the OU definitions in cmu-db/postgres.
# OU_DEFS is defined in: https://github.com/cmu-db/postgres/blob/pg14/cmudb/tscout/model.py
PLAN_NODE_NAMES = [
    "Agg",
    "Append",
    "BitmapAnd",
    "BitmapHeapScan",
    "BitmapIndexScan",
    "BitmapOr",
    "CteScan",
    "CustomScan",
    "ForeignScan",
    "FunctionScan",
    "Gather",
    "GatherMerge",
    "Group",
    "Hash",
    "HashJoinImpl",
    "IncrementalSort",
    "IndexOnlyScan",
    "IndexScan",
    "Limit",
    "LockRows",
    "Material",
    "Memoize",
    "MergeAppend",
    "MergeJoin",
    "ModifyTable",
    "NamedTuplestoreScan",
    "NestLoop",
    "ProjectSet",
    "RecursiveUnion",
    "Result",
    "SampleScan",
    "SeqScan",
    "SetOp",
    "Sort",
    "SubPlan",
    "SubqueryScan",
    "TableFuncScan",
    "TidScan",
    "Unique",
    "ValuesScan",
    "WindowAgg",
    "WorkTableScan",
]

BASE_TARGET_COLS = [
    "cpu_cycles",
    "instructions",
    "cache_references",
    "cache_misses",
    "ref_cpu_cycles",
    "network_bytes_read",
    "network_bytes_written",
    "disk_bytes_read",
    "disk_bytes_written",
    "memory_bytes",
    "elapsed_us",
]
