* - For a SubQuery: set the source to the alias returned by processSubQuery
* - For a PTF invocation: recursively call processPTFChain.
*/
private PTFInputSpec processPTFSource(QB qb, ASTNode inputNode) throws SemanticException{
PTFInputSpec qInSpec = null;
int type = inputNode.getType();
String alias;
switch(type)
{
case HiveParser.TOK_TABREF:
alias = processTable(qb, inputNode);
qInSpec = new PTFQueryInputSpec();
((PTFQueryInputSpec)qInSpec).setType(PTFQueryInputType.TABLE);
((PTFQueryInputSpec)qInSpec).setSource(alias);
break;
case HiveParser.TOK_SUBQUERY:
alias = processSubQuery(qb, inputNode);
qInSpec = new PTFQueryInputSpec();
((PTFQueryInputSpec)qInSpec).setType(PTFQueryInputType.SUBQUERY);
((PTFQueryInputSpec)qInSpec).setSource(alias);
break;
case HiveParser.TOK_PTBLFUNCTION:
qInSpec = processPTFChain(qb, inputNode);
break;
default:
throw new SemanticException(generateErrorMessage(inputNode,
"Unknown input type to PTF"));
}
qInSpec.setAstNode(inputNode);
return qInSpec;
}