private static void replaceASTChild(ASTNode child, ASTNode newChild) { ASTNode parent = (ASTNode) child.parent; int childIndex = child.childIndex; parent.deleteChild(childIndex); parent.insertChild(childIndex, newChild); }
private static void replaceASTChild(ASTNode child, ASTNode newChild) { ASTNode parent = (ASTNode) child.parent; int childIndex = child.childIndex; parent.deleteChild(childIndex); parent.insertChild(childIndex, newChild); }
private void fixUpASTNoAggregateIncrementalRebuild(ASTNode newAST) throws SemanticException { // Replace INSERT OVERWRITE by INSERT INTO // AST tree will have this shape: // TOK_QUERY // TOK_FROM // ... // TOK_INSERT // TOK_DESTINATION <- THIS TOKEN IS REPLACED BY 'TOK_INSERT_INTO' // TOK_TAB // TOK_TABNAME // default.cmv_mat_view // TOK_SELECT // ... ASTNode dest = new ASTSearcher().simpleBreadthFirstSearch(newAST, HiveParser.TOK_QUERY, HiveParser.TOK_INSERT, HiveParser.TOK_DESTINATION); ASTNode newChild = (ASTNode) ParseDriver.adaptor.create( HiveParser.TOK_INSERT_INTO, "TOK_INSERT_INTO"); newChild.addChildren(dest.getChildren()); ASTNode destParent = (ASTNode) dest.getParent(); int childIndex = dest.childIndex; destParent.deleteChild(childIndex); destParent.insertChild(childIndex, newChild); }
parent.deleteChild(ix); for (ASTNode node : newChildren) { parent.insertChild(ix++, node);
parent.deleteChild(ix); for (ASTNode node : newChildren) { parent.insertChild(ix++, node);
int childIndex = destinationNode.childIndex; destinationParentNode.deleteChild(childIndex); destinationParentNode.insertChild(childIndex, newInsertInto); ParseDriver.adaptor.addChild(dotNodeInUpdate, rowIdNodeInUpdate); ParseDriver.adaptor.addChild(columnTokNodeInUpdate, tableNameNodeInUpdate); selectNodeInUpdate.insertChild(0, ParseDriver.adaptor.dupTree(selectExprNodeInUpdate));
private static void replaceASTChild(ASTNode child, ASTNode newChild) { ASTNode parent = (ASTNode) child.parent; int childIndex = child.childIndex; parent.deleteChild(childIndex); parent.insertChild(childIndex, newChild); }
final ASTNode indexIdentifier = new ASTNode(new CommonToken(HiveParser.Identifier, index)); indexIdentifier.setParent(dbSchemaTable); dbSchemaTable.insertChild(0, indexIdentifier); } catch (HiveException e) { throw new LensException("Error occured when trying to communicate with metastore");
final ASTNode indexIdentifier = new ASTNode(new CommonToken(HiveParser.Identifier, index)); indexIdentifier.setParent(dbSchemaTable); dbSchemaTable.insertChild(0, indexIdentifier); } catch (HiveException e) { throw new LensException("Error occured when trying to communicate with metastore");
ASTNode dbIdentifier = new ASTNode(new CommonToken(HiveParser.Identifier, dbName)); dbIdentifier.setParent(tabNameChild); tabNameChild.insertChild(0, dbIdentifier);
ASTNode dbIdentifier = new ASTNode(new CommonToken(HiveParser.Identifier, dbName)); dbIdentifier.setParent(tabNameChild); tabNameChild.insertChild(0, dbIdentifier);