org.apache.hadoop.hive.ql.parse
Interface HiveSemanticAnalyzerHook

All Superinterfaces:
Hook
All Known Implementing Classes:
AbstractSemanticAnalyzerHook

public interface HiveSemanticAnalyzerHook
extends Hook

HiveSemanticAnalyzerHook allows Hive to be extended with custom logic for semantic analysis of QL statements. This interface and any Hive internals it exposes are currently "limited private and evolving" (unless otherwise stated elsewhere) and intended mainly for use by the Howl project.

Note that the lifetime of an instantiated hook object is scoped to the analysis of a single statement; hook instances are never reused.


Method Summary
 void postAnalyze(HiveSemanticAnalyzerHookContext context, List<Task<? extends Serializable>> rootTasks)
          Invoked after Hive performs its own semantic analysis on a statement (including optimization).
 ASTNode preAnalyze(HiveSemanticAnalyzerHookContext context, ASTNode ast)
          Invoked before Hive performs its own semantic analysis on a statement.
 

Method Detail

preAnalyze

ASTNode preAnalyze(HiveSemanticAnalyzerHookContext context,
                   ASTNode ast)
                   throws SemanticException
Invoked before Hive performs its own semantic analysis on a statement. The implementation may inspect the statement AST and prevent its execution by throwing a SemanticException. Optionally, it may also augment/rewrite the AST, but must produce a form equivalent to one which could have been returned directly from Hive's own parser.

Parameters:
context - context information for semantic analysis
ast - AST being analyzed and optionally rewritten
Returns:
replacement AST (typically the same as the original AST unless the entire tree had to be replaced; must not be null)
Throws:
SemanticException

postAnalyze

void postAnalyze(HiveSemanticAnalyzerHookContext context,
                 List<Task<? extends Serializable>> rootTasks)
                 throws SemanticException
Invoked after Hive performs its own semantic analysis on a statement (including optimization). Hive calls postAnalyze on the same hook object as preAnalyze, so the hook can maintain state across the calls.

Parameters:
context - context information for semantic analysis
rootTasks - root tasks produced by semantic analysis; the hook is free to modify this list or its contents
Throws:
SemanticException


Copyright © 2014 The Apache Software Foundation. All rights reserved.