@Override public RESULT visitRoot(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, LogicalRootNode node, Stack<LogicalNode> stack) throws TajoException { stack.push(node); RESULT result = visit(context, plan, block, node.getChild(), stack); stack.pop(); return result; }
@Override public LogicalNode visitRoot(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, LogicalRootNode node, Stack<LogicalNode> stack) throws TajoException { return visit(context, plan, block, node.getChild(), stack); }
public void setRoot(LogicalNode blockRoot) { this.rootNode = blockRoot; if (blockRoot instanceof LogicalRootNode) { LogicalRootNode rootNode = (LogicalRootNode) blockRoot; rootType = rootNode.getChild().getType(); } }
@Override public LogicalNode visitRoot(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, LogicalRootNode node, Stack<LogicalNode> stack) throws TajoException { return visit(context, plan, block, node.getChild(), stack); }
public void setRoot(LogicalNode blockRoot) { this.rootNode = blockRoot; if (blockRoot instanceof LogicalRootNode) { LogicalRootNode rootNode = (LogicalRootNode) blockRoot; rootType = rootNode.getChild().getType(); } }
public static boolean checkIfSetSession(LogicalNode node) { LogicalNode baseNode = node; if (node instanceof LogicalRootNode) { baseNode = ((LogicalRootNode) node).getChild(); } return baseNode.getType() == NodeType.SET_SESSION; }
public static boolean checkIfSetSession(LogicalNode node) { LogicalNode baseNode = node; if (node instanceof LogicalRootNode) { baseNode = ((LogicalRootNode) node).getChild(); } return baseNode.getType() == NodeType.SET_SESSION; }
@Override public RESULT visitRoot(CONTEXT context, LogicalPlan plan, LogicalPlan.QueryBlock block, LogicalRootNode node, Stack<LogicalNode> stack) throws TajoException { stack.push(node); RESULT result = visit(context, plan, block, node.getChild(), stack); stack.pop(); return result; }
public static String getStoreTableName(LogicalPlan plan) { LogicalRootNode rootNode = plan.getRootBlock().getRoot(); NodeType nodeType = rootNode.getChild().getType(); if (nodeType == NodeType.CREATE_TABLE) { return ((CreateTableNode)rootNode.getChild()).getTableName(); } else if (nodeType == NodeType.INSERT) { return ((InsertNode)rootNode.getChild()).getTableName(); } else { return null; } }
public static String getDataFormat(LogicalPlan plan) { LogicalRootNode rootNode = plan.getRootBlock().getRoot(); NodeType nodeType = rootNode.getChild().getType(); if (nodeType == NodeType.CREATE_TABLE) { return ((CreateTableNode)rootNode.getChild()).getStorageType(); } else if (nodeType == NodeType.INSERT) { return ((InsertNode)rootNode.getChild()).getStorageType(); } else { return null; } }
public static String getStoreTableName(LogicalPlan plan) { LogicalRootNode rootNode = plan.getRootBlock().getRoot(); NodeType nodeType = rootNode.getChild().getType(); if (nodeType == NodeType.CREATE_TABLE) { return ((CreateTableNode)rootNode.getChild()).getTableName(); } else if (nodeType == NodeType.INSERT) { return ((InsertNode)rootNode.getChild()).getTableName(); } else { return null; } }
public static String getDataFormat(LogicalPlan plan) { LogicalRootNode rootNode = plan.getRootBlock().getRoot(); NodeType nodeType = rootNode.getChild().getType(); if (nodeType == NodeType.CREATE_TABLE) { return ((CreateTableNode)rootNode.getChild()).getStorageType(); } else if (nodeType == NodeType.INSERT) { return ((InsertNode)rootNode.getChild()).getStorageType(); } else { return null; } }
@Override public boolean isEligible(QueryContext queryContext, LogicalPlan plan) { LogicalRootNode rootNode = plan.getRootBlock().getRoot(); return rootNode.getChild().getType() == NodeType.CREATE_TABLE; }
@Override public boolean isEligible(QueryContext queryContext, LogicalPlan plan) { LogicalRootNode rootNode = plan.getRootBlock().getRoot(); return rootNode.getChild().getType() == NodeType.CREATE_TABLE; }
@Override public boolean isEligible(LogicalPlanRewriteRuleContext context) { boolean hbaseMode = "false".equalsIgnoreCase(context.getQueryContext().get(HBaseStorageConstants.INSERT_PUT_MODE, "false")); LogicalRootNode rootNode = context.getPlan().getRootBlock().getRoot(); LogicalNode node = rootNode.getChild(); return hbaseMode && node.getType() == NodeType.CREATE_TABLE || node.getType() == NodeType.INSERT; }
@Override public boolean isEligible(LogicalPlanRewriteRuleContext context) { boolean hbaseMode = "false".equalsIgnoreCase(context.getQueryContext().get(HBaseStorageConstants.INSERT_PUT_MODE, "false")); LogicalRootNode rootNode = context.getPlan().getRootBlock().getRoot(); LogicalNode node = rootNode.getChild(); return hbaseMode && node.getType() == NodeType.CREATE_TABLE || node.getType() == NodeType.INSERT; }
private void handleQueryFailure(Query query, Stage lastStage) { QueryContext context = query.context.getQueryContext(); if (lastStage != null && context.hasOutputTableUri()) { Tablespace space = TablespaceManager.get(context.getOutputTableUri()); try { LogicalRootNode rootNode = lastStage.getMasterPlan().getLogicalPlan().getRootBlock().getRoot(); space.rollbackTable(rootNode.getChild()); } catch (Throwable e) { LOG.warn(query.getId() + ", failed processing cleanup storage when query failed:" + e.getMessage(), e); } } }
@Test public final void testStoreTable() throws CloneNotSupportedException, TajoException { QueryContext qc = createQueryContext(); Expr context = sqlAnalyzer.parse(QUERIES[8]); LogicalNode plan = planner.createPlan(qc, context).getRootBlock().getRoot(); testCloneLogicalNode(plan); assertEquals(NodeType.ROOT, plan.getType()); LogicalRootNode root = (LogicalRootNode) plan; assertEquals(NodeType.CREATE_TABLE, root.getChild().getType()); StoreTableNode storeNode = root.getChild(); testQuery7(storeNode.getChild()); }
@Test public final void testSetPlan() throws TajoException { QueryContext qc = createQueryContext(); Expr expr = sqlAnalyzer.parse(setStatements[0]); LogicalNode plan = planner.createPlan(qc, expr).getRootBlock().getRoot(); assertEquals(NodeType.ROOT, plan.getType()); LogicalRootNode root = (LogicalRootNode) plan; assertEquals(NodeType.UNION, root.getChild().getType()); UnionNode union = root.getChild(); assertEquals(NodeType.PROJECTION, union.getLeftChild().getType()); assertEquals(NodeType.PROJECTION, union.getRightChild().getType()); }