Class ResolutionEvidence
Object
gudusoft.gsqlparser.resolver2.model.ResolutionEvidence
Unified evidence model for column resolution.
This class consolidates the scattered evidence/confidence information from various resolver components into a single, consistent structure. It provides:
- Structured evidence type (enum, not string magic values)
- Confidence weight with clear semantics
- Traceability through source location and node
- Human-readable messages for debugging
Confidence Score Semantics
The confidence score represents "how verifiable is this resolution":- 1.0 (Definite): Hard evidence - DDL/metadata/explicit definition
- ~0.9 (High-confidence): Qualified reference without metadata verification
- ~0.7 (Inferred): Star column inference, CTE reverse fill
- ~0.5 (Weak): Context-based guess, should not auto-resolve
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionResolutionEvidence(EvidenceType type, double weight) Create a simple ResolutionEvidence with just type and weight.ResolutionEvidence(EvidenceType type, double weight, String message, TParseTreeNode node) Create a ResolutionEvidence from an AST node.ResolutionEvidence(EvidenceType type, double weight, String message, SourceLocation location) Create a ResolutionEvidence without source node.ResolutionEvidence(EvidenceType type, double weight, String message, SourceLocation location, TParseTreeNode sourceNode) Create a new ResolutionEvidence with all fields. -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic ResolutionEvidencefromCTEExplicitColumn(String cteName, String columnName, TParseTreeNode node) Create evidence for CTE explicit column list.static ResolutionEvidencefromCTEImplicitColumn(String cteName, String columnName, TParseTreeNode node) Create evidence for CTE implicit column (from subquery).static ResolutionEvidencefromDDL(String tableName, String columnName, TParseTreeNode node) Create evidence for DDL-defined column (CREATE TABLE in same script).static ResolutionEvidencefromGuessStrategy(String columnName, String chosenTable, String strategy, TParseTreeNode node) Create evidence for guess strategy application.static ResolutionEvidencefromInsertColumnList(String tableName, String columnName, TParseTreeNode node) Create evidence for INSERT column list.static ResolutionEvidencefromJoinCondition(String tableName, String columnName, TParseTreeNode node) Create evidence for JOIN condition.static ResolutionEvidencefromLegacyEvidence(String legacyEvidence, double confidence, TParseTreeNode node) Deprecated.Use specific factory methods insteadstatic ResolutionEvidencefromMetadata(String tableName, String columnName, TParseTreeNode node) Create evidence for metadata-backed resolution (DDL, SQLEnv).static ResolutionEvidencefromQualifiedReference(String tableName, String columnName, boolean hasMetadata, TParseTreeNode node) Create evidence for qualified reference (table.column).static ResolutionEvidencefromSelectList(String tableName, String columnName, TParseTreeNode node) Create evidence for SELECT list.static ResolutionEvidencefromStarInference(String columnName, String namespaceName, boolean isQualified, TParseTreeNode node) Create evidence for star column inference (outer reference pushdown).static ResolutionEvidencefromStructFieldAccess(String baseColumn, String fieldPath, double baseConfidence, TParseTreeNode node) Create evidence for struct field access (BigQuery/Snowflake).static ResolutionEvidencefromUnqualifiedReference(String columnName, int tableCount, TParseTreeNode node) Create evidence for unqualified reference.static ResolutionEvidencefromUpdateSet(String tableName, String columnName, TParseTreeNode node) Create evidence for UPDATE SET clause.getType()doubleinthashCode()booleanCheck if this evidence represents a definite resolution.booleanCheck if this evidence represents a high-confidence resolution.booleanCheck if this evidence represents an inferred resolution.Convert to legacy string evidence format.toString()withAppendedMessage(String additionalMessage) Create a copy with appended message.withWeight(double newWeight) Create a copy with updated weight.
-
Constructor Details
-
ResolutionEvidence
public ResolutionEvidence(EvidenceType type, double weight, String message, SourceLocation location, TParseTreeNode sourceNode) Create a new ResolutionEvidence with all fields.- Parameters:
type- The evidence typeweight- Confidence weight [0.0, 1.0]message- Human-readable descriptionlocation- Source locationsourceNode- The AST node (optional)
-
ResolutionEvidence
public ResolutionEvidence(EvidenceType type, double weight, String message, SourceLocation location) Create a ResolutionEvidence without source node. -
ResolutionEvidence
Create a ResolutionEvidence from an AST node. -
ResolutionEvidence
Create a simple ResolutionEvidence with just type and weight.
-
-
Method Details
-
fromMetadata
public static ResolutionEvidence fromMetadata(String tableName, String columnName, TParseTreeNode node) Create evidence for metadata-backed resolution (DDL, SQLEnv). Confidence: 1.0 (definite) -
fromDDL
Create evidence for DDL-defined column (CREATE TABLE in same script). Confidence: 1.0 (definite) -
fromQualifiedReference
public static ResolutionEvidence fromQualifiedReference(String tableName, String columnName, boolean hasMetadata, TParseTreeNode node) Create evidence for qualified reference (table.column). Confidence: 0.95 if we have metadata, 0.9 otherwise -
fromUnqualifiedReference
public static ResolutionEvidence fromUnqualifiedReference(String columnName, int tableCount, TParseTreeNode node) Create evidence for unqualified reference. Confidence depends on number of tables in scope. -
fromCTEExplicitColumn
public static ResolutionEvidence fromCTEExplicitColumn(String cteName, String columnName, TParseTreeNode node) Create evidence for CTE explicit column list. Confidence: 1.0 (explicit definition) -
fromCTEImplicitColumn
public static ResolutionEvidence fromCTEImplicitColumn(String cteName, String columnName, TParseTreeNode node) Create evidence for CTE implicit column (from subquery). Confidence: 1.0 (defined in subquery) -
fromStarInference
public static ResolutionEvidence fromStarInference(String columnName, String namespaceName, boolean isQualified, TParseTreeNode node) Create evidence for star column inference (outer reference pushdown). Confidence: 0.7-0.9 depending on context -
fromJoinCondition
public static ResolutionEvidence fromJoinCondition(String tableName, String columnName, TParseTreeNode node) Create evidence for JOIN condition. Confidence: 0.9 (explicit relationship) -
fromInsertColumnList
public static ResolutionEvidence fromInsertColumnList(String tableName, String columnName, TParseTreeNode node) Create evidence for INSERT column list. Confidence: 1.0 (explicit definition) -
fromUpdateSet
public static ResolutionEvidence fromUpdateSet(String tableName, String columnName, TParseTreeNode node) Create evidence for UPDATE SET clause. Confidence: 0.95 (explicit assignment) -
fromSelectList
public static ResolutionEvidence fromSelectList(String tableName, String columnName, TParseTreeNode node) Create evidence for SELECT list. Confidence: 0.85 -
fromStructFieldAccess
public static ResolutionEvidence fromStructFieldAccess(String baseColumn, String fieldPath, double baseConfidence, TParseTreeNode node) Create evidence for struct field access (BigQuery/Snowflake). Confidence: inherits from base column resolution -
fromGuessStrategy
public static ResolutionEvidence fromGuessStrategy(String columnName, String chosenTable, String strategy, TParseTreeNode node) Create evidence for guess strategy application. Confidence: 0.7 (guessed from candidates) -
fromLegacyEvidence
@Deprecated public static ResolutionEvidence fromLegacyEvidence(String legacyEvidence, double confidence, TParseTreeNode node) Deprecated.Use specific factory methods insteadCreate evidence from legacy string evidence. This is for backward compatibility during migration. -
getType
-
getWeight
-
getMessage
-
getLocation
-
getSourceNode
-
isDefinite
Check if this evidence represents a definite resolution. Definite means confidence >= 1.0 (has hard evidence like DDL/metadata). -
isHighConfidence
Check if this evidence represents a high-confidence resolution. High-confidence means confidence >= 0.9. -
isInferred
Check if this evidence represents an inferred resolution. Inferred means confidence < 1.0 or type is INFERRED_FROM_USAGE. -
withWeight
Create a copy with updated weight. -
withAppendedMessage
Create a copy with appended message. -
toLegacyEvidence
Convert to legacy string evidence format. For backward compatibility with existing code. -
toString
-
equals
-
hashCode
-