Class NamespaceEnhancer

Object
gudusoft.gsqlparser.resolver2.enhancement.NamespaceEnhancer

public class NamespaceEnhancer extends Object
Handles explicit namespace enhancement between resolution passes. The enhancement process: 1. During resolution, collect column references that target namespaces with star columns 2. Between passes, explicitly add these columns to the namespaces 3. Track which columns were added in which pass for debugging This makes the column inference process explicit and traceable, rather than happening implicitly during resolution.
  • Constructor Details

  • Method Details

    • initialize

      public void initialize(ScopeBuildResult scopeBuildResult)
      Initialize the enhancer with scope build result. Caches namespaces that have star columns and builds TTable -> INamespace mapping.
    • startPass

      public void startPass(int passNumber)
      Start a new resolution pass. Clears pending references from previous pass.
    • collectColumnRef

      public void collectColumnRef(String columnName, INamespace targetNamespace, TObjectName sourceReference, double confidence, String evidence)
      Collect a column reference that could not be resolved. Called during resolution when a column targets a star namespace.
      Parameters:
      columnName - The column name
      targetNamespace - The namespace the column should belong to
      sourceReference - The AST node
      confidence - Confidence score
      evidence - Reason for this inference
    • collectColumnRef

      public void collectColumnRef(String columnName, INamespace targetNamespace, TObjectName sourceReference, ResolutionEvidence evidenceDetail)
      Collect a column reference with structured evidence. Called during resolution when a column targets a star namespace.
      Parameters:
      columnName - The column name
      targetNamespace - The namespace the column should belong to
      sourceReference - The AST node
      evidenceDetail - Structured evidence detail
    • collectFromResolution

      public void collectFromResolution(TObjectName column, ResolutionResult result, INamespace candidateNamespace)
      Collect a column reference based on resolution result. Automatically determines if collection is needed based on resolution status.
    • enhance

      Perform namespace enhancement using collected column references. This is called BETWEEN resolution passes.
      Returns:
      EnhancementResult with details of what was added
    • getEnhancementHistory

      Get all enhancement results history
    • getTotalColumnsAdded

      public int getTotalColumnsAdded()
      Get total columns added across all passes
    • getPendingCount

      public int getPendingCount()
      Get number of pending references (not yet enhanced)
    • isStarNamespace

      public boolean isStarNamespace(INamespace namespace)
      Check if a namespace is a star namespace
    • getStarNamespaces

      Get all star namespaces
    • generateReport

      Generate a summary report of all enhancements