use of org.voltdb.plannodes.PlanNodeList in project voltdb by VoltDB.
the class TestPushDownAggregates method testLimit.
public void testLimit() {
List<AbstractPlanNode> pn = compileToFragments("select PKEY from T1 order by PKEY limit 5");
PlanNodeList pnl = new PlanNodeList(pn.get(0));
System.out.println(pnl.toDOTString("FRAG0"));
pnl = new PlanNodeList(pn.get(1));
System.out.println(pnl.toDOTString("FRAG1"));
}
use of org.voltdb.plannodes.PlanNodeList in project voltdb by VoltDB.
the class StatementCompiler method writePlanBytes.
/**
* Update the plan fragment and return the bytes of the plan
*/
static byte[] writePlanBytes(VoltCompiler compiler, PlanFragment fragment, AbstractPlanNode planGraph) throws VoltCompilerException {
String json = null;
// get the plan bytes
PlanNodeList node_list = new PlanNodeList(planGraph);
json = node_list.toJSONString();
compiler.captureDiagnosticJsonFragment(json);
// Place serialized version of PlanNodeTree into a PlanFragment
byte[] jsonBytes = json.getBytes(Charsets.UTF_8);
String bin64String = Encoder.compressAndBase64Encode(jsonBytes);
fragment.setPlannodetree(bin64String);
return jsonBytes;
}
use of org.voltdb.plannodes.PlanNodeList in project voltdb by VoltDB.
the class PlanSelector method outputPlanDebugString.
public static String outputPlanDebugString(AbstractPlanNode planGraph) throws JSONException {
PlanNodeList nodeList = new PlanNodeList(planGraph);
// get the json serialized version of the plan
String json = null;
String crunchJson = nodeList.toJSONString();
//System.out.println(crunchJson);
//System.out.flush();
JSONObject jobj = new JSONObject(crunchJson);
json = jobj.toString(4);
return json;
}
use of org.voltdb.plannodes.PlanNodeList in project voltdb by VoltDB.
the class StatementCompiler method writePlanBytes.
/**
* Update the plan fragment and return the bytes of the plan
*/
static byte[] writePlanBytes(PlanFragment fragment, AbstractPlanNode planGraph) {
// get the plan bytes
PlanNodeList node_list = new PlanNodeList(planGraph);
String json = node_list.toJSONString();
// Place serialized version of PlanNodeTree into a PlanFragment
byte[] jsonBytes = json.getBytes(Charsets.UTF_8);
String bin64String = Encoder.compressAndBase64Encode(jsonBytes);
fragment.setPlannodetree(bin64String);
return jsonBytes;
}
use of org.voltdb.plannodes.PlanNodeList in project voltdb by VoltDB.
the class PlanSelector method outputPlanFullDebug.
/**
* @param plan
* @param planGraph
* @param filename
* @return error message if any
*/
private String outputPlanFullDebug(CompiledPlan plan, AbstractPlanNode planGraph, String filename) {
// GENERATE JSON DEBUGGING OUTPUT BEFORE WE CLEAN UP THE
// PlanColumns
// convert a tree into an execution list
PlanNodeList nodeList = new PlanNodeList(planGraph);
String json;
try {
json = outputPlanDebugString(planGraph);
} catch (JSONException e2) {
// Any plan that can't be serialized to JSON to
// write to debugging output is also going to fail
// to get written to the catalog, to sysprocs, etc.
// Just bail.
String errorMsg = "Plan for sql: '" + plan.sql + "' can't be serialized to JSON";
// For now, just skip the output and go on to the next plan.
return errorMsg;
}
// output a description of the parsed stmt
json = "PLAN:\n" + json;
json = "COST: " + String.valueOf(plan.cost) + "\n" + json;
assert (plan.sql != null);
json = "SQL: " + plan.sql + "\n" + json;
// write json to disk
BuildDirectoryUtils.writeFile("statement-all-plans/" + m_procName + "_" + m_stmtName, filename + "-json.txt", json, true);
// create a graph friendly version
BuildDirectoryUtils.writeFile("statement-all-plans/" + m_procName + "_" + m_stmtName, filename + ".dot", nodeList.toDOTString("name"), true);
return null;
}
Aggregations