release-25.4: hints: add builtin for inserting "hint-injection" statement hints #156128
      
        
          +621
        
        
          −142
        
        
          
        
      
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Backport 4/4 commits from #155864 on behalf of @DrewKimball.
hints: separate out hint protobuf into separate package
This commit adds a new package
hintpbfor the protobuf structs usedto store hints in the
system.statement_hintstable. This will avoiddependency cycles in future commits.
Epic: None
Release note: None
hints: add injection hint and refactor usage of hint union
This commit adds the protobuf struct for injecting "internal" hints
like (index or join hints) into a statement's AST. This can be serialized
and inserted into the
system.statement_hintstable. This commit alsorefactors the way hints are represented in memory.
Informs #153633
Release note: None
sql/hints: extract hints system table interfacing logic
This commit extracts helper functions used by the
hintspackage tointerface with the
system.statement_hintstable and adds tests forthe helpers.
Epic: None
Release note: None
sql,hints: add builtin function to add statement hint for hint "injection"
This commit adds a new builtin function for inserting "hint injection" hints
into the
system.statement_hintstable. Currently, the provided hinted SQLis serialized as-is into the hint. A future PR will add validation to ensure
that the hinted SQL matches the fingerprint, and that the hints can be
transferred.
Informs #153633
Release note: None
Release justification: low-risk preview functionality