001package gudusoft.gsqlparser.dlineage.dataflow.model;
002
003/**
004 * Authoritative classification of <em>what</em> a dlineage table endpoint is, so a
005 * consumer can decide bind-to-catalog vs collapse-through without re-deriving it from
006 * {@code name}/{@code type}/{@code subType} heuristics. This is orthogonal to
007 * {@link EndpointIntroduction} ("how it was introduced"): a {@code CREATE TABLE … AS
008 * SELECT} is a {@code CATALOG_OBJECT} introduced by {@code CTAS}.
009 *
010 * <p>Strictly additive: this is carried only by the new endpoint fields and never
011 * back-fills {@link SubType}. See
012 * docs/tmp/dlineage-authoritative-endpoint-classification.md.
013 *
014 * <p>The full value set is defined here; the §5.6 "minimum complete" scope only
015 * <em>produces</em> {@link #CATALOG_OBJECT}, {@link #LOCAL_TEMP_TABLE},
016 * {@link #GLOBAL_TEMP_TABLE}, {@link #TABLE_VARIABLE}, {@link #TEMPDB_OBJECT},
017 * {@link #DYNAMIC_TEMPLATE} and {@link #UNKNOWN}. The remaining values
018 * ({@code CTE}, {@code DERIVED_RESULTSET}, {@code TVF_RESULT}, {@code CONSTANT},
019 * {@code VARIABLE}) are reserved for later coverage.
020 */
021public enum EndpointKind {
022        CATALOG_OBJECT, LOCAL_TEMP_TABLE, GLOBAL_TEMP_TABLE, TABLE_VARIABLE,
023        TEMPDB_OBJECT, CTE, DERIVED_RESULTSET, TVF_RESULT, CONSTANT, VARIABLE,
024        /**
025         * The endpoint's identifier was assembled at runtime: the analyzed statement is the
026         * partially-folded text of a dynamic-SQL site, and at least one segment of this
027         * object's name overlaps an unresolved hole (an unbound variable / parameter spliced
028         * into the string). The name is a TEMPLATE, not a catalog object name — binding it to
029         * metadata will fail or, worse, hit an unrelated object that happens to match.
030         *
031         * <p>Set only inside a dynamic-fold context, so a static statement referencing a
032         * legally delimited {@code [weird@name]} is never marked. See
033         * docs/tmp/dynamic-template-endpoint-provenance.md; the affected name segments are
034         * reported separately by {@code Table.getTemplatedParts()}.
035         */
036        DYNAMIC_TEMPLATE, UNKNOWN
037}