"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.compiledSimpleJoinedExploreWithAlwaysTrue = exports.simpleJoinedExploreWithAlwaysTrue = exports.exploreWithRequiredAttributesCompiled = exports.exploreWithRequiredAttributes = exports.tablesWithMetricsWithFilters = exports.exploreWithNonAggregateMetricWithAggregationInSqlCompiled = exports.exploreWithNonAggregateMetricWithAggregationInSql = exports.exploreWithMetricNumberCompiled = exports.exploreWithMetricNumber = exports.compiledJoinedExploreWithJoinAliasAndSubsetOfFieldsThatDontIncludeSqlFields = exports.joinedExploreWithJoinAliasAndSubsetOfFieldsThatDontIncludeSqlFields = exports.compiledJoinedExploreWithSubsetOfFieldsThatDontIncludeSqlFields = exports.joinedExploreWithSubsetOfFieldsThatDontIncludeSqlFields = exports.compiledJoinedExploreWithSubsetOfFields = exports.joinedExploreWithSubsetOfFields = exports.compiledExploreWithHiddenJoin = exports.exploreWithHiddenJoin = exports.compiledJoinedExploreWithTwoJoinsToTheSameTable = exports.joinedExploreWithTwoJoinsToTheSameTable = exports.compiledJoinedExploreOverridingAliasAndLabel = exports.joinedExploreOverridingAliasAndLabel = exports.compiledJoinedExploreOverridingJoinAlias = exports.joinedExploreOverridingJoinAlias = exports.compiledJoinedExploreOverridingJoinLabel = exports.joinedExploreOverridingJoinLabel = exports.exploreReferenceInJoinCompiled = exports.exploreReferenceInJoin = exports.compiledExploreWithJoinWithFieldsAndGroups = exports.exploreWithJoinWithFieldsAndGroups = exports.compiledSimpleJoinedExplore = exports.simpleJoinedExplore = exports.exploreComplexReferenceCompiled = exports.exploreComplexReference = exports.exploreReferenceDimensionCompiled = exports.exploreReferenceDimension = exports.exploreTableSelfReferenceCompiledSqlWhere = exports.exploreTableSelfReferenceCompiled = exports.exploreTableSelfReferenceSqlWhere = exports.exploreTableSelfReference = exports.exploreCircularMetricShortReference = exports.exploreCircularMetricReference = exports.exploreCircularDimensionShortReference = exports.exploreCircularDimensionReference = exports.exploreMissingJoinTable = exports.exploreMissingBaseTable = exports.createExploreWithRequiredFilters = exports.exploreOneEmptyTableCompiled = exports.exploreOneEmptyTable = exports.exploreBase = exports.warehouseClientMock = void 0;
exports.exploreWithMixedDimensionAndMetricReferencesCompiled = exports.exploreWithMixedDimensionAndMetricReferences = exports.compiledJoinedExploreOverridingJoinDescription = exports.joinedExploreOverridingJoinDescription = exports.compiledSimpleJoinedExploreWithBaseTableDescription = exports.simpleJoinedExploreWithBaseTableDescription = exports.exploreWithInvalidParameterReference = exports.compiledExploreWithParameters = exports.exploreWithParameters = exports.expectedCompiledCustomSqlDimensionWithReferences = exports.customSqlDimensionWithReferences = exports.expectedCompiledCustomSqlDimensionWithNoReferences = exports.customSqlDimensionWithNoReferences = void 0;
const dbt_1 = require("../types/dbt");
const field_1 = require("../types/field");
const filter_1 = require("../types/filter");
const lightdashProjectConfig_1 = require("../types/lightdashProjectConfig");
const timeFrames_1 = require("../types/timeFrames");
const warehouse_1 = require("../utils/warehouse");
exports.warehouseClientMock = {
    credentials: {},
    getCatalog: async () => ({
        default: {
            public: {
                table: {
                    id: field_1.DimensionType.NUMBER,
                },
            },
        },
    }),
    streamQuery: async (_query, streamCallback) => {
        await streamCallback({
            fields: {},
            rows: [],
        });
    },
    executeAsyncQuery: async () => ({
        queryId: null,
        queryMetadata: null,
        totalRows: 0,
        durationMs: 0,
    }),
    runQuery: () => Promise.resolve({
        fields: {},
        rows: [],
    }),
    test: () => Promise.resolve(),
    getStartOfWeek: () => undefined,
    getFieldQuoteChar: () => '"',
    getStringQuoteChar: () => "'",
    getEscapeStringQuoteChar: () => "'",
    getFloatingType: () => 'FLOAT',
    getNullSafeEqualSql: warehouse_1.defaultNullSafeEqualSql,
    getNullSafeEqualJoinSql: warehouse_1.defaultNullSafeEqualSql,
    getAdapterType: () => dbt_1.SupportedDbtAdapter.POSTGRES,
    getMetricSql: (sql, metric) => {
        switch (metric.type) {
            case field_1.MetricType.AVERAGE:
                return `AVG(${sql})`;
            case field_1.MetricType.MAX:
                return `MAX(${sql})`;
            case field_1.MetricType.SUM:
                return `SUM(${sql})`;
            default:
                return sql;
        }
    },
    concatString: (...args) => `CONCAT(${args.join(', ')})`,
    getAllTables() {
        throw new Error('Function not implemented.');
    },
    getFields() {
        throw new Error('Function not implemented.');
    },
    parseWarehouseCatalog() {
        throw new Error('Function not implemented.');
    },
    parseError() {
        throw new Error('Function not implemented.');
    },
    escapeString: (value) => value,
    castToTimestamp: (date) => `CAST('${date.toISOString()}' AS TIMESTAMP)`,
    getIntervalSql: (value, unit) => `INTERVAL '${value} ${unit}'`,
    getTimestampDiffSeconds: (startTimestampSql, endTimestampSql) => `EXTRACT(EPOCH FROM (${endTimestampSql} - ${startTimestampSql}))`,
    getMedianSql: (valueSql) => `PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY ${valueSql})`,
    buildArray: (elements) => `ARRAY[${elements.join(', ')}]`,
    buildArrayAgg: (expression, orderBy) => orderBy
        ? `ARRAY_AGG(${expression} ORDER BY ${orderBy})`
        : `ARRAY_AGG(${expression})`,
};
const sourceMock = {
    path: '',
    content: '',
    range: {
        start: {
            line: 0,
            character: 0,
        },
        end: {
            line: 0,
            character: 0,
        },
    },
};
exports.exploreBase = {
    targetDatabase: dbt_1.SupportedDbtAdapter.POSTGRES,
    name: '',
    label: '',
    tags: [],
    spotlight: {
        visibility: 'show',
        categories: [],
    },
    baseTable: 'a',
    joinedTables: [],
    tables: {},
    groupLabel: undefined,
    warehouse: undefined,
    sqlPath: undefined,
    ymlPath: undefined,
    databricksCompute: undefined,
};
exports.exploreOneEmptyTable = {
    ...exports.exploreBase,
    spotlightConfig: lightdashProjectConfig_1.DEFAULT_SPOTLIGHT_CONFIG,
    meta: {},
    tables: {
        a: {
            name: 'a',
            label: 'a',
            database: 'database',
            schema: 'schema',
            sqlTable: 'test.table',
            sqlWhere: undefined,
            dimensions: {},
            metrics: {},
            lineageGraph: {},
            source: sourceMock,
            groupLabel: undefined,
        },
    },
};
exports.exploreOneEmptyTableCompiled = {
    ...exports.exploreBase,
    tables: {
        a: {
            name: 'a',
            label: 'a',
            database: 'database',
            schema: 'schema',
            sqlTable: 'test.table',
            sqlWhere: undefined,
            uncompiledSqlWhere: undefined,
            dimensions: {},
            metrics: {},
            lineageGraph: {},
            source: sourceMock,
            groupLabel: undefined,
        },
    },
};
const createExploreWithRequiredFilters = (requiredFilters) => ({
    ...exports.exploreOneEmptyTable,
    name: 'orders',
    label: 'Orders',
    baseTable: 'orders',
    tables: {
        orders: {
            ...exports.exploreOneEmptyTable.tables.a,
            name: 'orders',
            label: 'Orders',
            dimensions: {
                credit_card_amount: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.NUMBER,
                    name: 'credit_card_amount',
                    label: 'Credit card amount',
                    table: 'orders',
                    tableLabel: 'Orders',
                    sql: '${TABLE}.credit_card_amount',
                    hidden: true,
                },
                has_credit_card_payment: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.BOOLEAN,
                    name: 'has_credit_card_payment',
                    label: 'Has credit card payment',
                    table: 'orders',
                    tableLabel: 'Orders',
                    sql: '${TABLE}.credit_card_amount > 0',
                    hidden: false,
                    isAdditionalDimension: true,
                },
            },
            requiredFilters,
        },
    },
});
exports.createExploreWithRequiredFilters = createExploreWithRequiredFilters;
exports.exploreMissingBaseTable = {
    ...exports.exploreBase,
    spotlightConfig: lightdashProjectConfig_1.DEFAULT_SPOTLIGHT_CONFIG,
    meta: {},
};
exports.exploreMissingJoinTable = {
    ...exports.exploreBase,
    spotlightConfig: lightdashProjectConfig_1.DEFAULT_SPOTLIGHT_CONFIG,
    meta: {},
    joinedTables: [
        {
            table: 'b',
            sqlOn: '',
        },
    ],
    tables: {
        a: {
            name: 'a',
            label: 'a',
            database: 'database',
            schema: 'schema',
            sqlTable: 'test.table',
            sqlWhere: undefined,
            dimensions: {},
            metrics: {},
            lineageGraph: {},
            source: sourceMock,
            groupLabel: undefined,
        },
    },
};
exports.exploreCircularDimensionReference = {
    ...exports.exploreBase,
    spotlightConfig: lightdashProjectConfig_1.DEFAULT_SPOTLIGHT_CONFIG,
    meta: {},
    tables: {
        a: {
            name: 'a',
            label: 'a',
            database: 'database',
            schema: 'schema',
            sqlTable: 'test.table',
            sqlWhere: undefined,
            dimensions: {
                dim1: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.STRING,
                    name: 'dim1',
                    label: 'dim1',
                    table: 'a',
                    tableLabel: 'a',
                    sql: '${a.dim1}', // circular reference
                    source: sourceMock,
                    hidden: false,
                },
            },
            metrics: {},
            lineageGraph: {},
            groupLabel: undefined,
            source: sourceMock,
        },
    },
};
exports.exploreCircularDimensionShortReference = {
    ...exports.exploreCircularDimensionReference,
    tables: {
        a: {
            ...exports.exploreCircularDimensionReference.tables.a,
            dimensions: {
                dim1: {
                    ...exports.exploreCircularDimensionReference.tables.a.dimensions
                        .dim1,
                    sql: '${dim1}', // circular short reference
                },
            },
        },
    },
};
exports.exploreCircularMetricReference = {
    ...exports.exploreBase,
    spotlightConfig: lightdashProjectConfig_1.DEFAULT_SPOTLIGHT_CONFIG,
    meta: {},
    tables: {
        a: {
            name: 'a',
            label: 'a',
            database: 'database',
            schema: 'schema',
            sqlTable: 'test.table',
            sqlWhere: undefined,
            dimensions: {
                dim1: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.STRING,
                    name: 'dim1',
                    label: 'dim1',
                    table: 'a',
                    tableLabel: 'a',
                    sql: '${TABLE}.dim1',
                    source: sourceMock,
                    hidden: false,
                },
            },
            metrics: {
                met1: {
                    fieldType: field_1.FieldType.METRIC,
                    type: field_1.MetricType.STRING,
                    name: 'met1',
                    label: 'met1',
                    table: 'a',
                    tableLabel: 'a',
                    sql: '${a.met1}', // circular reference
                    source: sourceMock,
                    hidden: false,
                },
            },
            lineageGraph: {},
            groupLabel: undefined,
            source: sourceMock,
        },
    },
};
exports.exploreCircularMetricShortReference = {
    ...exports.exploreCircularDimensionReference,
    tables: {
        a: {
            ...exports.exploreCircularDimensionReference.tables.a,
            metrics: {
                met1: {
                    ...exports.exploreCircularDimensionReference.tables.a.metrics.met1,
                    sql: '${met1}', // circular short reference
                },
            },
        },
    },
};
exports.exploreTableSelfReference = {
    ...exports.exploreBase,
    spotlightConfig: lightdashProjectConfig_1.DEFAULT_SPOTLIGHT_CONFIG,
    meta: {},
    tables: {
        a: {
            name: 'a',
            label: 'a',
            database: 'database',
            schema: 'schema',
            sqlTable: 'test.table',
            sqlWhere: undefined,
            dimensions: {
                dim1: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.STRING,
                    name: 'dim1',
                    label: 'dim1',
                    table: 'a',
                    tableLabel: 'a',
                    sql: '${TABLE}.dim1',
                    source: sourceMock,
                    hidden: false,
                },
            },
            metrics: {},
            lineageGraph: {},
            groupLabel: undefined,
            source: sourceMock,
        },
    },
};
exports.exploreTableSelfReferenceSqlWhere = {
    ...exports.exploreBase,
    spotlightConfig: lightdashProjectConfig_1.DEFAULT_SPOTLIGHT_CONFIG,
    meta: {},
    tables: {
        a: {
            name: 'a',
            label: 'a',
            database: 'database',
            schema: 'schema',
            sqlTable: 'test.table',
            sqlWhere: undefined,
            dimensions: {
                dim1: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.STRING,
                    name: 'dim1',
                    label: 'dim1',
                    table: 'a',
                    tableLabel: 'a',
                    sql: '${TABLE}.dim1',
                    source: sourceMock,
                    hidden: false,
                },
            },
            metrics: {},
            lineageGraph: {},
            groupLabel: undefined,
            source: sourceMock,
        },
    },
};
exports.exploreTableSelfReferenceCompiled = {
    ...exports.exploreBase,
    tables: {
        a: {
            name: 'a',
            label: 'a',
            database: 'database',
            schema: 'schema',
            sqlTable: 'test.table',
            sqlWhere: undefined,
            uncompiledSqlWhere: undefined,
            dimensions: {
                dim1: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.STRING,
                    name: 'dim1',
                    label: 'dim1',
                    table: 'a',
                    tableLabel: 'a',
                    sql: '${TABLE}.dim1',
                    compiledSql: '"a".dim1',
                    tablesReferences: ['a'],
                    source: sourceMock,
                    hidden: false,
                },
            },
            metrics: {},
            lineageGraph: {},
            groupLabel: undefined,
            source: sourceMock,
        },
    },
};
exports.exploreTableSelfReferenceCompiledSqlWhere = {
    ...exports.exploreBase,
    tables: {
        a: {
            name: 'a',
            label: 'a',
            database: 'database',
            schema: 'schema',
            sqlTable: 'test.table',
            sqlWhere: undefined,
            uncompiledSqlWhere: undefined,
            dimensions: {
                dim1: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.STRING,
                    name: 'dim1',
                    label: 'dim1',
                    table: 'a',
                    tableLabel: 'a',
                    sql: '${TABLE}.dim1',
                    compiledSql: '"a".dim1',
                    tablesReferences: ['a'],
                    source: sourceMock,
                    hidden: false,
                },
            },
            metrics: {},
            lineageGraph: {},
            groupLabel: undefined,
            source: sourceMock,
        },
    },
};
exports.exploreReferenceDimension = {
    ...exports.exploreBase,
    spotlightConfig: lightdashProjectConfig_1.DEFAULT_SPOTLIGHT_CONFIG,
    meta: {},
    tables: {
        a: {
            name: 'a',
            label: 'a',
            database: 'database',
            schema: 'schema',
            sqlTable: 'test.table',
            sqlWhere: undefined,
            dimensions: {
                dim1: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.STRING,
                    name: 'dim1',
                    label: 'dim1',
                    table: 'a',
                    tableLabel: 'a',
                    sql: '${TABLE}.dim1',
                    source: sourceMock,
                    hidden: false,
                },
                dim2: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.STRING,
                    name: 'dim2',
                    label: 'dim2',
                    table: 'a',
                    tableLabel: 'a',
                    sql: '${a.dim1}',
                    source: sourceMock,
                    hidden: false,
                },
            },
            metrics: {},
            lineageGraph: {},
            groupLabel: undefined,
            source: sourceMock,
        },
    },
};
exports.exploreReferenceDimensionCompiled = {
    ...exports.exploreBase,
    tables: {
        a: {
            name: 'a',
            label: 'a',
            database: 'database',
            schema: 'schema',
            sqlTable: 'test.table',
            sqlWhere: undefined,
            uncompiledSqlWhere: undefined,
            dimensions: {
                dim1: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.STRING,
                    name: 'dim1',
                    label: 'dim1',
                    table: 'a',
                    tableLabel: 'a',
                    sql: '${TABLE}.dim1',
                    compiledSql: '"a".dim1',
                    tablesReferences: ['a'],
                    source: sourceMock,
                    hidden: false,
                },
                dim2: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.STRING,
                    name: 'dim2',
                    label: 'dim2',
                    table: 'a',
                    tableLabel: 'a',
                    sql: '${a.dim1}',
                    compiledSql: '("a".dim1)',
                    tablesReferences: ['a'],
                    source: sourceMock,
                    hidden: false,
                },
            },
            metrics: {},
            lineageGraph: {},
            groupLabel: undefined,
            source: sourceMock,
        },
    },
};
exports.exploreComplexReference = {
    ...exports.exploreBase,
    spotlightConfig: lightdashProjectConfig_1.DEFAULT_SPOTLIGHT_CONFIG,
    meta: {},
    tables: {
        a: {
            name: 'a',
            label: 'a',
            database: 'database',
            schema: 'schema',
            sqlTable: 'test.table',
            sqlWhere: undefined,
            dimensions: {
                dim1: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.NUMBER,
                    name: 'dim1',
                    label: 'dim1',
                    table: 'a',
                    tableLabel: 'a',
                    sql: '${TABLE}.dim1',
                    source: sourceMock,
                    hidden: false,
                },
                dim2: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.NUMBER,
                    name: 'dim2',
                    label: 'dim2',
                    table: 'a',
                    tableLabel: 'a',
                    sql: '${a.dim1}',
                    source: sourceMock,
                    hidden: false,
                },
                dim3: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.NUMBER,
                    name: 'dim3',
                    label: 'dim3',
                    table: 'a',
                    tableLabel: 'a',
                    sql: '${TABLE}.dim3 + ${a.dim2} + ${dim1}',
                    source: sourceMock,
                    hidden: false,
                },
            },
            metrics: {
                m1: {
                    fieldType: field_1.FieldType.METRIC,
                    type: field_1.MetricType.AVERAGE,
                    name: 'm1',
                    label: 'm1',
                    table: 'a',
                    tableLabel: 'a',
                    sql: '${dim3}',
                    source: sourceMock,
                    hidden: false,
                },
            },
            lineageGraph: {},
            groupLabel: undefined,
            source: sourceMock,
        },
    },
};
exports.exploreComplexReferenceCompiled = {
    ...exports.exploreBase,
    tables: {
        a: {
            name: 'a',
            label: 'a',
            database: 'database',
            schema: 'schema',
            sqlTable: 'test.table',
            sqlWhere: undefined,
            uncompiledSqlWhere: undefined,
            dimensions: {
                dim1: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.NUMBER,
                    name: 'dim1',
                    label: 'dim1',
                    table: 'a',
                    tableLabel: 'a',
                    sql: '${TABLE}.dim1',
                    compiledSql: '"a".dim1',
                    tablesReferences: ['a'],
                    source: sourceMock,
                    hidden: false,
                },
                dim2: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.NUMBER,
                    name: 'dim2',
                    label: 'dim2',
                    table: 'a',
                    tableLabel: 'a',
                    sql: '${a.dim1}',
                    compiledSql: '("a".dim1)',
                    tablesReferences: ['a'],
                    source: sourceMock,
                    hidden: false,
                },
                dim3: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.NUMBER,
                    name: 'dim3',
                    label: 'dim3',
                    table: 'a',
                    tableLabel: 'a',
                    sql: '${TABLE}.dim3 + ${a.dim2} + ${dim1}',
                    compiledSql: '"a".dim3 + (("a".dim1)) + ("a".dim1)',
                    tablesReferences: ['a'],
                    source: sourceMock,
                    hidden: false,
                },
            },
            metrics: {
                m1: {
                    fieldType: field_1.FieldType.METRIC,
                    type: field_1.MetricType.AVERAGE,
                    name: 'm1',
                    label: 'm1',
                    table: 'a',
                    tableLabel: 'a',
                    sql: '${dim3}',
                    compiledSql: 'AVG(("a".dim3 + (("a".dim1)) + ("a".dim1)))',
                    compiledValueSql: '("a".dim3 + (("a".dim1)) + ("a".dim1))',
                    tablesReferences: ['a'],
                    source: sourceMock,
                    hidden: false,
                    showUnderlyingValues: undefined,
                },
            },
            lineageGraph: {},
            groupLabel: undefined,
            source: sourceMock,
        },
    },
};
exports.simpleJoinedExplore = {
    ...exports.exploreBase,
    spotlightConfig: lightdashProjectConfig_1.DEFAULT_SPOTLIGHT_CONFIG,
    meta: {},
    joinedTables: [
        {
            table: 'b',
            sqlOn: '${a.dim1} = ${b.dim1}',
        },
    ],
    tables: {
        a: {
            name: 'a',
            label: 'Custom A label',
            database: 'database',
            schema: 'schema',
            sqlTable: 'test.table',
            sqlWhere: undefined,
            dimensions: {
                dim1: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.STRING,
                    name: 'dim1',
                    label: 'dim1',
                    table: 'a',
                    tableLabel: 'Custom A label',
                    sql: '${TABLE}.dim1',
                    source: sourceMock,
                    hidden: false,
                },
            },
            metrics: {},
            lineageGraph: {},
            groupLabel: undefined,
            source: sourceMock,
        },
        b: {
            name: 'b',
            label: 'Custom B label',
            database: 'database',
            schema: 'schema',
            sqlTable: 'test.tableb',
            sqlWhere: undefined,
            dimensions: {
                dim1: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.STRING,
                    name: 'dim1',
                    label: 'dim1',
                    table: 'b',
                    tableLabel: 'Custom B label',
                    sql: '${TABLE}.dim1',
                    source: sourceMock,
                    hidden: false,
                },
            },
            metrics: {},
            lineageGraph: {},
            groupLabel: undefined,
            source: sourceMock,
        },
    },
};
exports.compiledSimpleJoinedExplore = {
    ...exports.exploreBase,
    joinedTables: [
        {
            table: 'b',
            sqlOn: '${a.dim1} = ${b.dim1}',
            compiledSqlOn: '("a".dim1) = ("b".dim1)',
            tablesReferences: ['a', 'b'],
            relationship: undefined,
            type: undefined,
            hidden: undefined,
            always: undefined,
        },
    ],
    tables: {
        a: {
            name: 'a',
            label: 'Custom A label',
            database: 'database',
            schema: 'schema',
            sqlTable: 'test.table',
            sqlWhere: undefined,
            uncompiledSqlWhere: undefined,
            dimensions: {
                dim1: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.STRING,
                    name: 'dim1',
                    label: 'dim1',
                    table: 'a',
                    tableLabel: 'Custom A label',
                    sql: '${TABLE}.dim1',
                    compiledSql: '"a".dim1',
                    tablesReferences: ['a'],
                    source: sourceMock,
                    hidden: false,
                },
            },
            metrics: {},
            lineageGraph: {},
            groupLabel: undefined,
            source: sourceMock,
        },
        b: {
            name: 'b',
            originalName: 'b',
            label: 'Custom B label',
            database: 'database',
            schema: 'schema',
            sqlTable: 'test.tableb',
            sqlWhere: undefined,
            uncompiledSqlWhere: undefined,
            dimensions: {
                dim1: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.STRING,
                    name: 'dim1',
                    label: 'dim1',
                    table: 'b',
                    tableLabel: 'Custom B label',
                    sql: '${TABLE}.dim1',
                    compiledSql: '"b".dim1',
                    tablesReferences: ['b'],
                    source: sourceMock,
                    hidden: false,
                },
            },
            metrics: {},
            lineageGraph: {},
            groupLabel: undefined,
            source: sourceMock,
            hidden: undefined,
        },
    },
};
exports.exploreWithJoinWithFieldsAndGroups = {
    ...exports.simpleJoinedExplore,
    joinedTables: [
        {
            ...exports.simpleJoinedExplore.joinedTables[0],
            fields: ['dim2'],
        },
    ],
    tables: {
        ...exports.simpleJoinedExplore.tables,
        b: {
            ...exports.simpleJoinedExplore.tables.b,
            dimensions: {
                dim1: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.STRING,
                    name: 'dim1',
                    label: 'dim1',
                    table: 'b',
                    tableLabel: 'Custom B label',
                    sql: '${TABLE}.dim1',
                    source: sourceMock,
                    hidden: false,
                },
                dim2: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.DATE,
                    name: 'dim2',
                    label: 'dim2',
                    table: 'b',
                    tableLabel: 'Custom B label',
                    sql: '${TABLE}.dim2',
                    source: sourceMock,
                    hidden: false,
                    timeInterval: timeFrames_1.TimeFrames.DAY,
                    groups: ['test'],
                },
                dim2_DAY: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.DATE,
                    name: 'dim2_DAY',
                    label: 'dim2_DAY',
                    table: 'b',
                    tableLabel: 'Custom B label',
                    sql: '${TABLE}.dim2',
                    source: sourceMock,
                    hidden: false,
                    timeInterval: timeFrames_1.TimeFrames.DAY,
                    timeIntervalBaseDimensionName: 'dim2',
                    groups: ['test', 'dim2'],
                },
            },
        },
    },
};
exports.compiledExploreWithJoinWithFieldsAndGroups = {
    ...exports.exploreBase,
    joinedTables: [
        {
            table: 'b',
            sqlOn: '${a.dim1} = ${b.dim1}',
            compiledSqlOn: '("a".dim1) = ("b".dim1)',
            tablesReferences: ['a', 'b'],
            type: undefined,
            hidden: undefined,
            always: undefined,
            relationship: undefined,
        },
    ],
    tables: {
        a: {
            name: 'a',
            label: 'Custom A label',
            database: 'database',
            schema: 'schema',
            sqlTable: 'test.table',
            sqlWhere: undefined,
            uncompiledSqlWhere: undefined,
            dimensions: {
                dim1: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.STRING,
                    name: 'dim1',
                    label: 'dim1',
                    table: 'a',
                    tableLabel: 'Custom A label',
                    sql: '${TABLE}.dim1',
                    compiledSql: '"a".dim1',
                    tablesReferences: ['a'],
                    source: sourceMock,
                    hidden: false,
                },
            },
            metrics: {},
            lineageGraph: {},
            groupLabel: undefined,
            source: sourceMock,
        },
        b: {
            name: 'b',
            originalName: 'b',
            label: 'Custom B label',
            database: 'database',
            schema: 'schema',
            sqlTable: 'test.tableb',
            sqlWhere: undefined,
            uncompiledSqlWhere: undefined,
            dimensions: {
                dim1: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.STRING,
                    name: 'dim1',
                    label: 'dim1',
                    table: 'b',
                    tableLabel: 'Custom B label',
                    sql: '${TABLE}.dim1',
                    compiledSql: '"b".dim1',
                    tablesReferences: ['b'],
                    source: sourceMock,
                    hidden: true,
                },
                dim2: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.DATE,
                    name: 'dim2',
                    label: 'dim2',
                    table: 'b',
                    tableLabel: 'Custom B label',
                    sql: '${TABLE}.dim2',
                    compiledSql: '"b".dim2',
                    tablesReferences: ['b'],
                    source: sourceMock,
                    hidden: false,
                    timeInterval: timeFrames_1.TimeFrames.DAY,
                    groups: ['test'],
                },
                dim2_DAY: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.DATE,
                    name: 'dim2_DAY',
                    label: 'dim2_DAY',
                    table: 'b',
                    tableLabel: 'Custom B label',
                    sql: '${TABLE}.dim2',
                    compiledSql: '"b".dim2',
                    tablesReferences: ['b'],
                    source: sourceMock,
                    hidden: false,
                    timeInterval: timeFrames_1.TimeFrames.DAY,
                    timeIntervalBaseDimensionName: 'dim2',
                    groups: ['test', 'dim2'],
                },
            },
            metrics: {},
            lineageGraph: {},
            groupLabel: undefined,
            source: sourceMock,
            hidden: undefined,
        },
    },
};
exports.exploreReferenceInJoin = {
    ...exports.simpleJoinedExplore,
    tables: {
        ...exports.simpleJoinedExplore.tables,
        b: {
            ...exports.simpleJoinedExplore.tables.b,
            dimensions: {
                ...exports.simpleJoinedExplore.tables.b.dimensions,
                dim2: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.STRING,
                    name: 'dim2',
                    label: 'dim2',
                    table: 'b',
                    tableLabel: 'Custom B label',
                    sql: '${a.dim1}',
                    source: sourceMock,
                    hidden: false,
                },
                dim3: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.STRING,
                    name: 'dim3',
                    label: 'dim3',
                    table: 'b',
                    tableLabel: 'Custom B label',
                    sql: '${TABLE}.dim3',
                    source: sourceMock,
                    hidden: false,
                },
            },
            metrics: {},
            lineageGraph: {},
            groupLabel: undefined,
            source: sourceMock,
        },
    },
};
exports.exploreReferenceInJoinCompiled = {
    ...exports.compiledSimpleJoinedExplore,
    tables: {
        ...exports.compiledSimpleJoinedExplore.tables,
        b: {
            ...exports.compiledSimpleJoinedExplore.tables.b,
            dimensions: {
                ...exports.compiledSimpleJoinedExplore.tables.b.dimensions,
                dim2: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.STRING,
                    name: 'dim2',
                    label: 'dim2',
                    table: 'b',
                    tableLabel: 'Custom B label',
                    sql: '${a.dim1}',
                    compiledSql: '("a".dim1)',
                    tablesReferences: ['b', 'a'],
                    source: sourceMock,
                    hidden: false,
                },
                dim3: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.STRING,
                    name: 'dim3',
                    label: 'dim3',
                    table: 'b',
                    tableLabel: 'Custom B label',
                    sql: '${TABLE}.dim3',
                    compiledSql: '"b".dim3',
                    tablesReferences: ['b'],
                    source: sourceMock,
                    hidden: false,
                },
            },
            metrics: {},
            lineageGraph: {},
            groupLabel: undefined,
            source: sourceMock,
        },
    },
};
exports.joinedExploreOverridingJoinLabel = {
    ...exports.simpleJoinedExplore,
    joinedTables: [
        {
            ...exports.simpleJoinedExplore.joinedTables[0],
            label: 'Custom join label',
        },
    ],
};
exports.compiledJoinedExploreOverridingJoinLabel = {
    ...exports.compiledSimpleJoinedExplore,
    tables: {
        ...exports.compiledSimpleJoinedExplore.tables,
        b: {
            ...exports.compiledSimpleJoinedExplore.tables.b,
            label: 'Custom join label',
            dimensions: {
                ...exports.compiledSimpleJoinedExplore.tables.b.dimensions,
                dim1: {
                    ...exports.compiledSimpleJoinedExplore.tables.b.dimensions.dim1,
                    tableLabel: 'Custom join label',
                },
            },
        },
    },
};
exports.joinedExploreOverridingJoinAlias = {
    ...exports.simpleJoinedExplore,
    joinedTables: [
        {
            table: 'b',
            sqlOn: '${a.dim1} = ${custom_alias.dim1}',
            alias: 'custom_alias',
        },
    ],
};
exports.compiledJoinedExploreOverridingJoinAlias = {
    ...exports.compiledSimpleJoinedExplore,
    joinedTables: [
        {
            table: 'custom_alias',
            sqlOn: '${a.dim1} = ${custom_alias.dim1}',
            compiledSqlOn: '("a".dim1) = ("custom_alias".dim1)',
            tablesReferences: ['a', 'custom_alias'],
            type: undefined,
            hidden: undefined,
            always: undefined,
            relationship: undefined,
        },
    ],
    tables: {
        a: exports.compiledSimpleJoinedExplore.tables.a,
        custom_alias: {
            ...exports.compiledSimpleJoinedExplore.tables.b,
            name: 'custom_alias',
            label: 'Custom alias',
            dimensions: {
                ...exports.compiledSimpleJoinedExplore.tables.b.dimensions,
                dim1: {
                    ...exports.compiledSimpleJoinedExplore.tables.b.dimensions.dim1,
                    table: 'custom_alias',
                    tableLabel: 'Custom alias',
                    compiledSql: '"custom_alias".dim1',
                    tablesReferences: ['custom_alias'],
                },
            },
        },
    },
};
exports.joinedExploreOverridingAliasAndLabel = {
    ...exports.simpleJoinedExplore,
    joinedTables: [
        {
            table: 'b',
            sqlOn: '${a.dim1} = ${custom_alias.dim1}',
            label: 'Custom join label',
            alias: 'custom_alias',
        },
    ],
};
exports.compiledJoinedExploreOverridingAliasAndLabel = {
    ...exports.compiledSimpleJoinedExplore,
    joinedTables: [
        {
            table: 'custom_alias',
            sqlOn: '${a.dim1} = ${custom_alias.dim1}',
            compiledSqlOn: '("a".dim1) = ("custom_alias".dim1)',
            tablesReferences: ['a', 'custom_alias'],
            type: undefined,
            hidden: undefined,
            always: undefined,
            relationship: undefined,
        },
    ],
    tables: {
        a: exports.compiledSimpleJoinedExplore.tables.a,
        custom_alias: {
            ...exports.compiledSimpleJoinedExplore.tables.b,
            name: 'custom_alias',
            label: 'Custom join label',
            dimensions: {
                ...exports.compiledSimpleJoinedExplore.tables.b.dimensions,
                dim1: {
                    ...exports.compiledSimpleJoinedExplore.tables.b.dimensions.dim1,
                    table: 'custom_alias',
                    tableLabel: 'Custom join label',
                    compiledSql: '"custom_alias".dim1',
                    tablesReferences: ['custom_alias'],
                },
            },
        },
    },
};
exports.joinedExploreWithTwoJoinsToTheSameTable = {
    ...exports.simpleJoinedExplore,
    joinedTables: [
        {
            table: 'b',
            sqlOn: '${a.dim1} = ${b.dim1}',
        },
        {
            table: 'b',
            sqlOn: '${a.dim1} = ${custom_alias.dim1}',
            label: 'Custom join label',
            alias: 'custom_alias',
        },
    ],
    tables: {
        ...exports.simpleJoinedExplore.tables,
        a: {
            ...exports.simpleJoinedExplore.tables.a,
            metrics: {
                m1: {
                    fieldType: field_1.FieldType.METRIC,
                    type: field_1.MetricType.SUM,
                    name: 'm1',
                    label: 'm1',
                    table: 'a',
                    tableLabel: 'a',
                    sql: '${custom_alias.dim1}',
                    source: sourceMock,
                    hidden: false,
                },
            },
        },
    },
};
exports.compiledJoinedExploreWithTwoJoinsToTheSameTable = {
    ...exports.compiledSimpleJoinedExplore,
    joinedTables: [
        {
            table: 'b',
            sqlOn: '${a.dim1} = ${b.dim1}',
            compiledSqlOn: '("a".dim1) = ("b".dim1)',
            tablesReferences: ['a', 'b'],
            type: undefined,
            hidden: undefined,
            always: undefined,
            relationship: undefined,
        },
        {
            table: 'custom_alias',
            sqlOn: '${a.dim1} = ${custom_alias.dim1}',
            compiledSqlOn: '("a".dim1) = ("custom_alias".dim1)',
            tablesReferences: ['a', 'custom_alias'],
            type: undefined,
            hidden: undefined,
            always: undefined,
            relationship: undefined,
        },
    ],
    tables: {
        a: {
            ...exports.compiledSimpleJoinedExplore.tables.a,
            metrics: {
                m1: {
                    fieldType: field_1.FieldType.METRIC,
                    type: field_1.MetricType.SUM,
                    name: 'm1',
                    label: 'm1',
                    table: 'a',
                    tableLabel: 'a',
                    sql: '${custom_alias.dim1}',
                    compiledSql: 'SUM(("custom_alias".dim1))',
                    compiledValueSql: '("custom_alias".dim1)',
                    tablesReferences: ['a', 'custom_alias'],
                    source: sourceMock,
                    hidden: false,
                    showUnderlyingValues: undefined,
                },
            },
        },
        b: exports.compiledSimpleJoinedExplore.tables.b,
        custom_alias: {
            ...exports.compiledSimpleJoinedExplore.tables.b,
            name: 'custom_alias',
            label: 'Custom join label',
            dimensions: {
                ...exports.compiledSimpleJoinedExplore.tables.b.dimensions,
                dim1: {
                    ...exports.compiledSimpleJoinedExplore.tables.b.dimensions.dim1,
                    table: 'custom_alias',
                    tableLabel: 'Custom join label',
                    compiledSql: '"custom_alias".dim1',
                    tablesReferences: ['custom_alias'],
                },
            },
        },
    },
};
exports.exploreWithHiddenJoin = {
    ...exports.exploreReferenceInJoin,
    joinedTables: [
        {
            table: 'b',
            sqlOn: '${a.dim1} = ${b.dim1}',
            hidden: true,
        },
    ],
};
exports.compiledExploreWithHiddenJoin = {
    ...exports.exploreReferenceInJoinCompiled,
    joinedTables: [
        {
            table: 'b',
            sqlOn: '${a.dim1} = ${b.dim1}',
            compiledSqlOn: '("a".dim1) = ("b".dim1)',
            tablesReferences: ['a', 'b'],
            type: undefined,
            hidden: true,
            always: undefined,
            relationship: undefined,
        },
    ],
    tables: {
        ...exports.exploreReferenceInJoinCompiled.tables,
        b: {
            ...exports.exploreReferenceInJoinCompiled.tables.b,
            dimensions: Object.entries(exports.exploreReferenceInJoinCompiled.tables.b.dimensions).reduce((acc, [key, value]) => ({
                ...acc,
                [key]: {
                    ...value,
                    hidden: true,
                },
            }), {}),
            hidden: true,
        },
    },
};
exports.joinedExploreWithSubsetOfFields = {
    ...exports.exploreReferenceInJoin,
    joinedTables: [
        {
            table: 'b',
            sqlOn: '${a.dim1} = ${b.dim1}',
            fields: ['dim1'],
        },
    ],
};
exports.compiledJoinedExploreWithSubsetOfFields = {
    ...exports.exploreReferenceInJoinCompiled,
    tables: {
        ...exports.exploreReferenceInJoinCompiled.tables,
        b: {
            ...exports.exploreReferenceInJoinCompiled.tables.b,
            dimensions: {
                dim1: {
                    ...exports.exploreReferenceInJoinCompiled.tables.b.dimensions.dim1,
                },
            },
        },
    },
};
exports.joinedExploreWithSubsetOfFieldsThatDontIncludeSqlFields = {
    ...exports.exploreReferenceInJoin,
    joinedTables: [
        {
            table: 'b',
            sqlOn: '${a.dim1} = ${b.dim1}',
            fields: ['dim2'], // doesn't include "dim1" that is required for join SQL
        },
    ],
};
exports.compiledJoinedExploreWithSubsetOfFieldsThatDontIncludeSqlFields = {
    ...exports.exploreReferenceInJoinCompiled,
    tables: {
        ...exports.exploreReferenceInJoinCompiled.tables,
        b: {
            ...exports.exploreReferenceInJoinCompiled.tables.b,
            dimensions: {
                dim1: {
                    ...exports.exploreReferenceInJoinCompiled.tables.b.dimensions
                        .dim1,
                    hidden: true,
                },
                dim2: {
                    ...exports.exploreReferenceInJoinCompiled.tables.b.dimensions
                        .dim2,
                },
            },
        },
    },
};
exports.joinedExploreWithJoinAliasAndSubsetOfFieldsThatDontIncludeSqlFields = {
    ...exports.exploreReferenceInJoin,
    joinedTables: [
        {
            table: 'b',
            alias: 'custom_alias', // includes alias
            sqlOn: '${a.dim1} = ${custom_alias.dim1}',
            fields: ['dim2', 'dim3'], // doesn't include "dim1" that is required for join SQL
        },
    ],
};
exports.compiledJoinedExploreWithJoinAliasAndSubsetOfFieldsThatDontIncludeSqlFields = {
    ...exports.exploreReferenceInJoinCompiled,
    joinedTables: [
        {
            table: 'custom_alias',
            sqlOn: '${a.dim1} = ${custom_alias.dim1}',
            compiledSqlOn: '("a".dim1) = ("custom_alias".dim1)',
            tablesReferences: ['a', 'custom_alias'],
            type: undefined,
            hidden: undefined,
            always: undefined,
            relationship: undefined,
        },
    ],
    tables: {
        a: exports.exploreReferenceInJoinCompiled.tables.a,
        custom_alias: {
            ...exports.exploreReferenceInJoinCompiled.tables.b,
            name: 'custom_alias',
            label: 'Custom alias',
            dimensions: {
                ...exports.exploreReferenceInJoinCompiled.tables.b.dimensions,
                dim1: {
                    ...exports.exploreReferenceInJoinCompiled.tables.b.dimensions
                        .dim1,
                    table: 'custom_alias',
                    tableLabel: 'Custom alias',
                    compiledSql: '"custom_alias".dim1',
                    tablesReferences: ['custom_alias'],
                    hidden: true,
                },
                dim2: {
                    ...exports.exploreReferenceInJoinCompiled.tables.b.dimensions
                        .dim2,
                    table: 'custom_alias',
                    tableLabel: 'Custom alias',
                    compiledSql: '("a".dim1)',
                    tablesReferences: ['custom_alias', 'a'],
                },
                dim3: {
                    ...exports.exploreReferenceInJoinCompiled.tables.b.dimensions
                        .dim3,
                    table: 'custom_alias',
                    tableLabel: 'Custom alias',
                    compiledSql: '"custom_alias".dim3',
                    tablesReferences: ['custom_alias'],
                },
            },
        },
    },
};
exports.exploreWithMetricNumber = {
    ...exports.exploreBase,
    spotlightConfig: lightdashProjectConfig_1.DEFAULT_SPOTLIGHT_CONFIG,
    meta: {},
    tables: {
        a: {
            name: 'a',
            label: 'a',
            database: 'database',
            schema: 'schema',
            sqlTable: 'test.table',
            sqlWhere: undefined,
            dimensions: {
                dim1: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.NUMBER,
                    name: 'dim1',
                    label: 'dim1',
                    table: 'a',
                    tableLabel: 'a',
                    sql: '${TABLE}.dim1',
                    source: sourceMock,
                    hidden: false,
                },
            },
            metrics: {
                m1: {
                    fieldType: field_1.FieldType.METRIC,
                    type: field_1.MetricType.SUM,
                    name: 'm1',
                    label: 'm1',
                    table: 'a',
                    tableLabel: 'a',
                    sql: '${dim1}',
                    source: sourceMock,
                    hidden: false,
                    spotlight: {
                        visibility: 'hide',
                    },
                },
                m2: {
                    fieldType: field_1.FieldType.METRIC,
                    type: field_1.MetricType.NUMBER,
                    name: 'm2',
                    label: 'm2',
                    table: 'a',
                    tableLabel: 'a',
                    sql: '2 + ${m1}',
                    source: sourceMock,
                    hidden: false,
                },
            },
            lineageGraph: {},
            groupLabel: undefined,
            source: sourceMock,
        },
    },
};
exports.exploreWithMetricNumberCompiled = {
    name: exports.exploreWithMetricNumber.name,
    label: exports.exploreWithMetricNumber.label,
    baseTable: exports.exploreWithMetricNumber.baseTable,
    tags: exports.exploreWithMetricNumber.tags,
    targetDatabase: exports.exploreWithMetricNumber.targetDatabase,
    warehouse: exports.exploreWithMetricNumber.warehouse,
    ymlPath: exports.exploreWithMetricNumber.ymlPath,
    sqlPath: exports.exploreWithMetricNumber.sqlPath,
    groupLabel: exports.exploreWithMetricNumber.groupLabel,
    databricksCompute: exports.exploreWithMetricNumber.databricksCompute,
    spotlight: {
        visibility: 'show',
        categories: [],
    },
    joinedTables: [],
    tables: {
        a: {
            name: 'a',
            label: 'a',
            database: 'database',
            schema: 'schema',
            sqlTable: 'test.table',
            sqlWhere: undefined,
            uncompiledSqlWhere: undefined,
            dimensions: {
                dim1: {
                    ...exports.exploreWithMetricNumber.tables.a.dimensions.dim1,
                    compiledSql: '"a".dim1',
                    tablesReferences: ['a'],
                },
            },
            metrics: {
                m1: {
                    ...exports.exploreWithMetricNumber.tables.a.metrics.m1,
                    compiledSql: 'SUM(("a".dim1))',
                    compiledValueSql: '("a".dim1)',
                    tablesReferences: ['a'],
                    showUnderlyingValues: undefined,
                },
                m2: {
                    ...exports.exploreWithMetricNumber.tables.a.metrics.m2,
                    compiledSql: '2 + (SUM(("a".dim1)))',
                    compiledValueSql: '2 + (SUM(("a".dim1)))',
                    tablesReferences: ['a'],
                    showUnderlyingValues: undefined,
                },
            },
            lineageGraph: {},
            groupLabel: undefined,
            source: sourceMock,
        },
    },
};
/**
 * Test case for non-aggregate metric (type: NUMBER) that has an aggregation
 * function in its SQL and references a dimension. This pattern is common in
 * Looker where type:number measures have sql like "count(distinct ${user_id})".
 */
exports.exploreWithNonAggregateMetricWithAggregationInSql = {
    ...exports.exploreBase,
    baseTable: 'events',
    spotlightConfig: lightdashProjectConfig_1.DEFAULT_SPOTLIGHT_CONFIG,
    meta: {},
    tables: {
        events: {
            name: 'events',
            label: 'events',
            database: 'database',
            schema: 'schema',
            sqlTable: 'test.events',
            sqlWhere: undefined,
            dimensions: {
                user_id: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.STRING,
                    name: 'user_id',
                    label: 'user_id',
                    table: 'events',
                    tableLabel: 'events',
                    sql: '${TABLE}.user_id',
                    source: sourceMock,
                    hidden: false,
                },
                amount: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.NUMBER,
                    name: 'amount',
                    label: 'amount',
                    table: 'events',
                    tableLabel: 'events',
                    sql: '${TABLE}.amount',
                    source: sourceMock,
                    hidden: false,
                },
                status: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.STRING,
                    name: 'status',
                    label: 'status',
                    table: 'events',
                    tableLabel: 'events',
                    sql: '${TABLE}.status',
                    source: sourceMock,
                    hidden: false,
                },
            },
            metrics: {
                // Non-aggregate (NUMBER) with count(distinct) - should allow dimension ref
                user_count: {
                    fieldType: field_1.FieldType.METRIC,
                    type: field_1.MetricType.NUMBER,
                    name: 'user_count',
                    label: 'user_count',
                    table: 'events',
                    tableLabel: 'events',
                    sql: 'count(distinct ${user_id})',
                    source: sourceMock,
                    hidden: false,
                },
                // Non-aggregate (NUMBER) with stddev - should allow dimension ref
                amount_stddev: {
                    fieldType: field_1.FieldType.METRIC,
                    type: field_1.MetricType.NUMBER,
                    name: 'amount_stddev',
                    label: 'amount_stddev',
                    table: 'events',
                    tableLabel: 'events',
                    sql: 'stddev(${amount})',
                    source: sourceMock,
                    hidden: false,
                },
                // Non-aggregate (NUMBER) with CASE containing aggregation
                conditional_count: {
                    fieldType: field_1.FieldType.METRIC,
                    type: field_1.MetricType.NUMBER,
                    name: 'conditional_count',
                    label: 'conditional_count',
                    table: 'events',
                    tableLabel: 'events',
                    sql: "CASE WHEN ${status} = 'active' THEN count(distinct ${user_id}) ELSE 0 END",
                    source: sourceMock,
                    hidden: false,
                },
                // Non-aggregate (NUMBER) with COALESCE-wrapped aggregation
                safe_avg: {
                    fieldType: field_1.FieldType.METRIC,
                    type: field_1.MetricType.NUMBER,
                    name: 'safe_avg',
                    label: 'safe_avg',
                    table: 'events',
                    tableLabel: 'events',
                    sql: 'COALESCE(avg(${amount}), 0)',
                    source: sourceMock,
                    hidden: false,
                },
            },
            lineageGraph: {},
            groupLabel: undefined,
            source: sourceMock,
        },
    },
};
exports.exploreWithNonAggregateMetricWithAggregationInSqlCompiled = {
    name: exports.exploreWithNonAggregateMetricWithAggregationInSql.name,
    label: exports.exploreWithNonAggregateMetricWithAggregationInSql.label,
    baseTable: exports.exploreWithNonAggregateMetricWithAggregationInSql.baseTable,
    tags: exports.exploreWithNonAggregateMetricWithAggregationInSql.tags,
    targetDatabase: exports.exploreWithNonAggregateMetricWithAggregationInSql.targetDatabase,
    warehouse: exports.exploreWithNonAggregateMetricWithAggregationInSql.warehouse,
    ymlPath: exports.exploreWithNonAggregateMetricWithAggregationInSql.ymlPath,
    sqlPath: exports.exploreWithNonAggregateMetricWithAggregationInSql.sqlPath,
    groupLabel: exports.exploreWithNonAggregateMetricWithAggregationInSql.groupLabel,
    databricksCompute: exports.exploreWithNonAggregateMetricWithAggregationInSql.databricksCompute,
    spotlight: {
        visibility: 'show',
        categories: [],
    },
    joinedTables: [],
    tables: {
        events: {
            name: 'events',
            label: 'events',
            database: 'database',
            schema: 'schema',
            sqlTable: 'test.events',
            sqlWhere: undefined,
            uncompiledSqlWhere: undefined,
            dimensions: {
                user_id: {
                    ...exports.exploreWithNonAggregateMetricWithAggregationInSql
                        .tables.events.dimensions.user_id,
                    compiledSql: '"events".user_id',
                    tablesReferences: ['events'],
                },
                amount: {
                    ...exports.exploreWithNonAggregateMetricWithAggregationInSql
                        .tables.events.dimensions.amount,
                    compiledSql: '"events".amount',
                    tablesReferences: ['events'],
                },
                status: {
                    ...exports.exploreWithNonAggregateMetricWithAggregationInSql
                        .tables.events.dimensions.status,
                    compiledSql: '"events".status',
                    tablesReferences: ['events'],
                },
            },
            metrics: {
                user_count: {
                    ...exports.exploreWithNonAggregateMetricWithAggregationInSql
                        .tables.events.metrics.user_count,
                    compiledSql: 'count(distinct ("events".user_id))',
                    compiledValueSql: 'count(distinct ("events".user_id))',
                    tablesReferences: ['events'],
                    showUnderlyingValues: undefined,
                },
                amount_stddev: {
                    ...exports.exploreWithNonAggregateMetricWithAggregationInSql
                        .tables.events.metrics.amount_stddev,
                    compiledSql: 'stddev(("events".amount))',
                    compiledValueSql: 'stddev(("events".amount))',
                    tablesReferences: ['events'],
                    showUnderlyingValues: undefined,
                },
                conditional_count: {
                    ...exports.exploreWithNonAggregateMetricWithAggregationInSql
                        .tables.events.metrics.conditional_count,
                    compiledSql: `CASE WHEN ("events".status) = 'active' THEN count(distinct ("events".user_id)) ELSE 0 END`,
                    compiledValueSql: `CASE WHEN ("events".status) = 'active' THEN count(distinct ("events".user_id)) ELSE 0 END`,
                    tablesReferences: ['events'],
                    showUnderlyingValues: undefined,
                },
                safe_avg: {
                    ...exports.exploreWithNonAggregateMetricWithAggregationInSql
                        .tables.events.metrics.safe_avg,
                    compiledSql: 'COALESCE(avg(("events".amount)), 0)',
                    compiledValueSql: 'COALESCE(avg(("events".amount)), 0)',
                    tablesReferences: ['events'],
                    showUnderlyingValues: undefined,
                },
            },
            lineageGraph: {},
            groupLabel: undefined,
            source: sourceMock,
        },
    },
};
exports.tablesWithMetricsWithFilters = {
    table1: {
        name: 'table1',
        label: 'table1',
        database: 'database',
        schema: 'schema',
        sqlTable: '"db"."schema"."table1"',
        sqlWhere: undefined,
        dimensions: {
            dim1: {
                type: field_1.DimensionType.NUMBER,
                name: 'dim1',
                label: 'dim1',
                table: 'table1',
                tableLabel: 'table1',
                fieldType: field_1.FieldType.DIMENSION,
                sql: '${TABLE}.dim1',
                hidden: false,
            },
            shared: {
                type: field_1.DimensionType.STRING,
                name: 'shared',
                label: 'shared',
                table: 'table1',
                tableLabel: 'table1',
                fieldType: field_1.FieldType.DIMENSION,
                sql: '${TABLE}.shared',
                hidden: false,
            },
            with_reference: {
                type: field_1.DimensionType.NUMBER,
                name: 'with_reference',
                label: 'with_reference',
                table: 'table1',
                tableLabel: 'table1',
                fieldType: field_1.FieldType.DIMENSION,
                sql: '${TABLE}.dim1 + ${table2.dim2}',
                hidden: false,
            },
        },
        metrics: {
            metric1: {
                type: field_1.MetricType.MAX,
                fieldType: field_1.FieldType.METRIC,
                table: 'table1',
                tableLabel: 'table1',
                name: 'metric1',
                label: 'metric1',
                sql: '${TABLE}.number_column',
                hidden: false,
                filters: [
                    {
                        id: 'filter1',
                        target: { fieldRef: 'shared' },
                        operator: filter_1.FilterOperator.INCLUDE,
                        values: ['foo'],
                    },
                ],
            },
            metric_with_sql: {
                type: field_1.MetricType.MAX,
                fieldType: field_1.FieldType.METRIC,
                table: 'table1',
                tableLabel: 'table1',
                name: 'metric_with_sql',
                label: 'metric_with_sql',
                sql: 'CASE WHEN ${TABLE}.number_column THEN 1 ELSE 0 END',
                hidden: false,
                filters: [
                    {
                        id: 'filter1',
                        target: { fieldRef: 'shared' },
                        operator: filter_1.FilterOperator.INCLUDE,
                        values: ['foo'],
                    },
                ],
            },
        },
        lineageGraph: {},
        groupLabel: undefined,
    },
    table2: {
        name: 'table2',
        label: 'table2',
        database: 'database',
        schema: 'schema',
        sqlTable: '"db"."schema"."table2"',
        sqlWhere: undefined,
        dimensions: {
            dim2: {
                type: field_1.DimensionType.NUMBER,
                name: 'dim2',
                label: 'dim2',
                table: 'table2',
                tableLabel: 'table2',
                fieldType: field_1.FieldType.DIMENSION,
                sql: '${TABLE}.dim2',
                hidden: false,
            },
            shared: {
                type: field_1.DimensionType.STRING,
                name: 'shared',
                label: 'shared',
                table: 'table2',
                tableLabel: 'table2',
                fieldType: field_1.FieldType.DIMENSION,
                sql: '${TABLE}.shared',
                hidden: false,
            },
        },
        metrics: {
            metric2: {
                type: field_1.MetricType.MAX,
                fieldType: field_1.FieldType.METRIC,
                table: 'table2',
                tableLabel: 'table2',
                name: 'metric2',
                label: 'metric2',
                sql: '${TABLE}.number_column',
                hidden: false,
                filters: [
                    {
                        id: 'filter2_1',
                        target: { fieldRef: 'dim2' },
                        operator: filter_1.FilterOperator.LESS_THAN,
                        values: [10],
                    },
                    {
                        id: 'filter2_2',
                        target: { fieldRef: 'dim2' },
                        operator: filter_1.FilterOperator.GREATER_THAN,
                        values: [5],
                    },
                ],
            },
        },
        lineageGraph: {},
        groupLabel: undefined,
    },
};
exports.exploreWithRequiredAttributes = {
    ...exports.exploreBase,
    spotlightConfig: lightdashProjectConfig_1.DEFAULT_SPOTLIGHT_CONFIG,
    meta: {},
    joinedTables: [
        {
            table: 'b',
            sqlOn: '',
        },
    ],
    tables: {
        a: {
            name: 'a',
            label: 'a',
            database: 'database',
            schema: 'schema',
            sqlTable: 'test.table',
            sqlWhere: undefined,
            dimensions: {
                dim1: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.NUMBER,
                    name: 'dim1',
                    label: 'dim1',
                    table: 'a',
                    tableLabel: 'a',
                    sql: '${TABLE}.dim1',
                    source: sourceMock,
                    hidden: false,
                    requiredAttributes: {
                        is_admin: 'true',
                    },
                },
            },
            metrics: {
                met1: {
                    fieldType: field_1.FieldType.METRIC,
                    type: field_1.MetricType.NUMBER,
                    name: 'met1',
                    label: 'met1',
                    table: 'a',
                    tableLabel: 'a',
                    sql: `100 - $\{b.met1}`, // joined table reference
                    source: sourceMock,
                    hidden: false,
                },
            },
            lineageGraph: {},
            groupLabel: undefined,
            source: sourceMock,
        },
        b: {
            name: 'b',
            label: 'b',
            database: 'database',
            schema: 'schema',
            sqlTable: 'test.table',
            sqlWhere: undefined,
            dimensions: {
                dim1: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.NUMBER,
                    name: 'dim1',
                    label: 'dim1',
                    table: 'b',
                    tableLabel: 'b',
                    sql: '${TABLE}.dim1',
                    source: sourceMock,
                    hidden: false,
                    requiredAttributes: {
                        section: 'marketing',
                    },
                },
            },
            metrics: {
                met1: {
                    fieldType: field_1.FieldType.METRIC,
                    type: field_1.MetricType.SUM,
                    name: 'met1',
                    label: 'met1',
                    table: 'b',
                    tableLabel: 'b',
                    sql: '${b.dim1}',
                    source: sourceMock,
                    hidden: false,
                },
            },
            lineageGraph: {},
            groupLabel: undefined,
            source: sourceMock,
            requiredAttributes: {
                is_admin: 'true',
            },
        },
    },
};
exports.exploreWithRequiredAttributesCompiled = {
    ...exports.exploreBase,
    joinedTables: [
        {
            compiledSqlOn: '',
            tablesReferences: [],
            sqlOn: '',
            table: 'b',
            type: undefined,
            hidden: undefined,
            always: undefined,
            relationship: undefined,
        },
    ],
    tables: {
        a: {
            name: 'a',
            label: 'a',
            database: 'database',
            schema: 'schema',
            sqlTable: 'test.table',
            sqlWhere: undefined,
            uncompiledSqlWhere: undefined,
            dimensions: {
                dim1: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.NUMBER,
                    name: 'dim1',
                    label: 'dim1',
                    table: 'a',
                    tableLabel: 'a',
                    sql: '${TABLE}.dim1',
                    compiledSql: '"a".dim1',
                    tablesReferences: ['a'],
                    source: sourceMock,
                    hidden: false,
                    requiredAttributes: {
                        is_admin: 'true',
                    },
                },
            },
            metrics: {
                met1: {
                    fieldType: field_1.FieldType.METRIC,
                    type: field_1.MetricType.NUMBER,
                    name: 'met1',
                    label: 'met1',
                    table: 'a',
                    tableLabel: 'a',
                    sql: '100 - ${b.met1}',
                    compiledSql: '100 - (SUM(("b".dim1)))',
                    compiledValueSql: '100 - (SUM(("b".dim1)))',
                    source: sourceMock,
                    hidden: false,
                    tablesReferences: ['a', 'b'],
                    tablesRequiredAttributes: {
                        b: {
                            is_admin: 'true',
                        },
                    },
                    showUnderlyingValues: undefined,
                },
            },
            lineageGraph: {},
            groupLabel: undefined,
            source: sourceMock,
        },
        b: {
            name: 'b',
            originalName: 'b',
            label: 'b',
            database: 'database',
            schema: 'schema',
            sqlTable: 'test.table',
            sqlWhere: undefined,
            uncompiledSqlWhere: undefined,
            hidden: undefined,
            dimensions: {
                dim1: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.NUMBER,
                    name: 'dim1',
                    label: 'dim1',
                    table: 'b',
                    tableLabel: 'b',
                    sql: '${TABLE}.dim1',
                    compiledSql: '"b".dim1',
                    source: sourceMock,
                    hidden: false,
                    requiredAttributes: {
                        section: 'marketing',
                    },
                    tablesReferences: ['b'],
                    tablesRequiredAttributes: {
                        b: {
                            is_admin: 'true',
                        },
                    },
                },
            },
            metrics: {
                met1: {
                    fieldType: field_1.FieldType.METRIC,
                    type: field_1.MetricType.SUM,
                    name: 'met1',
                    label: 'met1',
                    table: 'b',
                    tableLabel: 'b',
                    sql: '${b.dim1}',
                    compiledSql: 'SUM(("b".dim1))',
                    compiledValueSql: '("b".dim1)',
                    source: sourceMock,
                    hidden: false,
                    tablesReferences: ['b'],
                    tablesRequiredAttributes: {
                        b: {
                            is_admin: 'true',
                        },
                    },
                    showUnderlyingValues: undefined,
                },
            },
            lineageGraph: {},
            groupLabel: undefined,
            source: sourceMock,
            requiredAttributes: {
                is_admin: 'true',
            },
        },
    },
};
exports.simpleJoinedExploreWithAlwaysTrue = {
    ...exports.simpleJoinedExplore,
    joinedTables: [
        {
            table: 'b',
            sqlOn: '${a.dim1} = ${b.dim1}',
            always: true,
        },
    ],
};
exports.compiledSimpleJoinedExploreWithAlwaysTrue = {
    ...exports.compiledSimpleJoinedExplore,
    joinedTables: [
        {
            table: 'b',
            sqlOn: '${a.dim1} = ${b.dim1}',
            compiledSqlOn: '("a".dim1) = ("b".dim1)',
            tablesReferences: ['a', 'b'],
            type: undefined,
            hidden: undefined,
            always: true,
            relationship: undefined,
        },
    ],
};
exports.customSqlDimensionWithNoReferences = {
    id: 'test',
    name: 'Test',
    table: 'orders',
    type: field_1.CustomDimensionType.SQL,
    sql: '`orders`.`id`',
    dimensionType: field_1.DimensionType.STRING,
};
exports.expectedCompiledCustomSqlDimensionWithNoReferences = {
    ...exports.customSqlDimensionWithNoReferences,
    compiledSql: '`orders`.`id`',
    tablesReferences: [],
};
exports.customSqlDimensionWithReferences = {
    id: 'test',
    name: 'Test',
    table: 'orders',
    type: field_1.CustomDimensionType.SQL,
    sql: '${a.dim1} + ${b.dim1}',
    dimensionType: field_1.DimensionType.STRING,
};
exports.expectedCompiledCustomSqlDimensionWithReferences = {
    ...exports.customSqlDimensionWithReferences,
    compiledSql: '("a".dim1) + ("b".dim1)',
    tablesReferences: ['a', 'b'],
};
// Simple mock data for parameter testing - reusing existing working mock structure
exports.exploreWithParameters = {
    ...exports.simpleJoinedExplore,
    name: 'explore_with_parameters',
    label: 'Explore with Parameters',
    joinedTables: [
        {
            table: 'b',
            sqlOn: "${a.dim1} = ${b.dim1} AND ${ld.parameters.b.active_status} = 'active'",
        },
    ],
    tables: {
        ...exports.simpleJoinedExplore.tables,
        a: {
            ...exports.simpleJoinedExplore.tables.a,
            parameters: {
                region: {
                    label: 'Region',
                    description: 'Filter by region',
                    default: 'US',
                },
            },
        },
        b: {
            ...exports.simpleJoinedExplore.tables.b,
            parameters: {
                active_status: {
                    label: 'Active Status',
                    description: 'Define active status',
                    default: 'active',
                },
            },
        },
    },
};
exports.compiledExploreWithParameters = {
    ...exports.compiledSimpleJoinedExplore,
    name: 'explore_with_parameters',
    label: 'Explore with Parameters',
    joinedTables: [
        {
            table: 'b',
            sqlOn: "${a.dim1} = ${b.dim1} AND ${ld.parameters.b.active_status} = 'active'",
            compiledSqlOn: '("a".dim1) = ("b".dim1) AND ${ld.parameters.b.active_status} = \'active\'',
            tablesReferences: ['a', 'b'],
            parameterReferences: ['b.active_status'],
            type: undefined,
            hidden: undefined,
            always: undefined,
            relationship: undefined,
        },
    ],
    tables: {
        ...exports.compiledSimpleJoinedExplore.tables,
        a: {
            ...exports.compiledSimpleJoinedExplore.tables.a,
            parameters: {
                region: {
                    label: 'Region',
                    description: 'Filter by region',
                    default: 'US',
                },
            },
        },
        b: {
            ...exports.compiledSimpleJoinedExplore.tables.b,
            parameters: {
                active_status: {
                    label: 'Active Status',
                    description: 'Define active status',
                    default: 'active',
                },
            },
        },
    },
};
exports.exploreWithInvalidParameterReference = {
    ...exports.simpleJoinedExplore,
    name: 'explore_with_invalid_params',
    label: 'Explore with Invalid Parameters',
    joinedTables: [
        {
            table: 'b',
            sqlOn: "${a.dim1} = ${b.dim1} AND ${ld.parameters.b.nonexistent_param} = 'active'",
        },
    ],
    tables: {
        ...exports.simpleJoinedExplore.tables,
        a: {
            ...exports.simpleJoinedExplore.tables.a,
            parameters: {},
        },
        b: {
            ...exports.simpleJoinedExplore.tables.b,
            parameters: {
                valid_status: {
                    label: 'Valid Status',
                    description: 'A valid parameter',
                    default: 'active',
                },
            },
        },
    },
};
// Test data for join description overrides
exports.simpleJoinedExploreWithBaseTableDescription = {
    ...exports.simpleJoinedExplore,
    tables: {
        ...exports.simpleJoinedExplore.tables,
        b: {
            ...exports.simpleJoinedExplore.tables.b,
            description: 'Base table B description',
        },
    },
};
exports.compiledSimpleJoinedExploreWithBaseTableDescription = {
    ...exports.compiledSimpleJoinedExplore,
    tables: {
        ...exports.compiledSimpleJoinedExplore.tables,
        b: {
            ...exports.compiledSimpleJoinedExplore.tables.b,
            description: 'Base table B description',
        },
    },
};
exports.joinedExploreOverridingJoinDescription = {
    ...exports.simpleJoinedExplore,
    joinedTables: [
        {
            ...exports.simpleJoinedExplore.joinedTables[0],
            description: 'Custom join description',
        },
    ],
    tables: {
        ...exports.simpleJoinedExplore.tables,
        b: {
            ...exports.simpleJoinedExplore.tables.b,
            description: 'Base table B description',
        },
    },
};
exports.compiledJoinedExploreOverridingJoinDescription = {
    ...exports.compiledSimpleJoinedExplore,
    tables: {
        ...exports.compiledSimpleJoinedExplore.tables,
        b: {
            ...exports.compiledSimpleJoinedExplore.tables.b,
            description: 'Custom join description',
        },
    },
};
/**
 * Test case for non-aggregate metric (type: NUMBER) that has aggregation
 * in SQL and references BOTH dimensions AND metrics. This pattern is common
 * in Looker where type:number measures have sql like "sum(${dim}) / ${metric}".
 */
exports.exploreWithMixedDimensionAndMetricReferences = {
    ...exports.exploreBase,
    baseTable: 'events',
    spotlightConfig: lightdashProjectConfig_1.DEFAULT_SPOTLIGHT_CONFIG,
    meta: {},
    tables: {
        events: {
            name: 'events',
            label: 'events',
            database: 'database',
            schema: 'schema',
            sqlTable: 'test.events',
            sqlWhere: undefined,
            dimensions: {
                user_id: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.STRING,
                    name: 'user_id',
                    label: 'user_id',
                    table: 'events',
                    tableLabel: 'events',
                    sql: '${TABLE}.user_id',
                    source: sourceMock,
                    hidden: false,
                },
                amount: {
                    fieldType: field_1.FieldType.DIMENSION,
                    type: field_1.DimensionType.NUMBER,
                    name: 'amount',
                    label: 'amount',
                    table: 'events',
                    tableLabel: 'events',
                    sql: '${TABLE}.amount',
                    source: sourceMock,
                    hidden: false,
                },
            },
            metrics: {
                // Non-aggregate (NUMBER) metric with aggregation in SQL (Looker pattern)
                user_count: {
                    fieldType: field_1.FieldType.METRIC,
                    type: field_1.MetricType.NUMBER,
                    name: 'user_count',
                    label: 'user_count',
                    table: 'events',
                    tableLabel: 'events',
                    sql: 'count(distinct ${user_id})',
                    source: sourceMock,
                    hidden: false,
                },
                // Non-aggregate (NUMBER) with BOTH dimension AND metric references
                // This pattern is: sum(${dim}) / ${metric}
                amount_per_user: {
                    fieldType: field_1.FieldType.METRIC,
                    type: field_1.MetricType.NUMBER,
                    name: 'amount_per_user',
                    label: 'amount_per_user',
                    table: 'events',
                    tableLabel: 'events',
                    sql: 'sum(${amount}) / NULLIF(${user_count}, 0)',
                    source: sourceMock,
                    hidden: false,
                },
            },
            lineageGraph: {},
            groupLabel: undefined,
            source: sourceMock,
        },
    },
};
exports.exploreWithMixedDimensionAndMetricReferencesCompiled = {
    name: exports.exploreWithMixedDimensionAndMetricReferences.name,
    label: exports.exploreWithMixedDimensionAndMetricReferences.label,
    baseTable: exports.exploreWithMixedDimensionAndMetricReferences.baseTable,
    tags: exports.exploreWithMixedDimensionAndMetricReferences.tags,
    targetDatabase: exports.exploreWithMixedDimensionAndMetricReferences.targetDatabase,
    warehouse: exports.exploreWithMixedDimensionAndMetricReferences.warehouse,
    ymlPath: exports.exploreWithMixedDimensionAndMetricReferences.ymlPath,
    sqlPath: exports.exploreWithMixedDimensionAndMetricReferences.sqlPath,
    groupLabel: exports.exploreWithMixedDimensionAndMetricReferences.groupLabel,
    databricksCompute: exports.exploreWithMixedDimensionAndMetricReferences.databricksCompute,
    spotlight: {
        visibility: 'show',
        categories: [],
    },
    joinedTables: [],
    tables: {
        events: {
            name: 'events',
            label: 'events',
            database: 'database',
            schema: 'schema',
            sqlTable: 'test.events',
            sqlWhere: undefined,
            uncompiledSqlWhere: undefined,
            dimensions: {
                user_id: {
                    ...exports.exploreWithMixedDimensionAndMetricReferences.tables
                        .events.dimensions.user_id,
                    compiledSql: '"events".user_id',
                    tablesReferences: ['events'],
                },
                amount: {
                    ...exports.exploreWithMixedDimensionAndMetricReferences.tables
                        .events.dimensions.amount,
                    compiledSql: '"events".amount',
                    tablesReferences: ['events'],
                },
            },
            metrics: {
                user_count: {
                    ...exports.exploreWithMixedDimensionAndMetricReferences.tables
                        .events.metrics.user_count,
                    compiledSql: 'count(distinct ("events".user_id))',
                    compiledValueSql: 'count(distinct ("events".user_id))',
                    tablesReferences: ['events'],
                    showUnderlyingValues: undefined,
                },
                amount_per_user: {
                    ...exports.exploreWithMixedDimensionAndMetricReferences.tables
                        .events.metrics.amount_per_user,
                    // amount is a dimension, user_count is a metric
                    compiledSql: 'sum(("events".amount)) / NULLIF((count(distinct ("events".user_id))), 0)',
                    compiledValueSql: 'sum(("events".amount)) / NULLIF((count(distinct ("events".user_id))), 0)',
                    tablesReferences: ['events'],
                    showUnderlyingValues: undefined,
                },
            },
            lineageGraph: {},
            groupLabel: undefined,
            source: sourceMock,
        },
    },
};
//# sourceMappingURL=exploreCompiler.mock.js.map