本文整理汇总了Java中org.voltdb.utils.Encoder.hexDecodeToString方法的典型用法代码示例。如果您正苦于以下问题:Java Encoder.hexDecodeToString方法的具体用法?Java Encoder.hexDecodeToString怎么用?Java Encoder.hexDecodeToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.voltdb.utils.Encoder
的用法示例。
在下文中一共展示了Encoder.hexDecodeToString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: debugJSON
import org.voltdb.utils.Encoder; //导入方法依赖的package包/类
/**
* @param catalog_stmt
* @return
*/
public static String debugJSON(Statement catalog_stmt) {
String jsonString = Encoder.hexDecodeToString(catalog_stmt.getFullplan());
String line = "\n----------------------------------------\n";
String ret = "FULL PLAN ORIG STRING:\n" + jsonString + line;
for (PlanFragment catalog_frgmt : catalog_stmt.getFragments()) {
jsonString = Encoder.hexDecodeToString(catalog_frgmt.getPlannodetree());
try {
JSONObject jsonObject = new JSONObject(jsonString);
ret += "FRAGMENT " + catalog_frgmt.getName() + "\n" + jsonObject.toString(2) + line;
} catch (Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
} // FOR
return (ret);
}
示例2: compileSQL
import org.voltdb.utils.Encoder; //导入方法依赖的package包/类
public static AbstractPlanNode compileSQL(final Procedure catalog_proc, String name, String sql) throws Exception {
VoltCompiler compiler = new VoltCompiler();
HSQLInterface hsql = HSQLInterface.loadHsqldb();
Database catalog_db = (Database) catalog_proc.getParent();
Catalog catalog = catalog_db.getCatalog();
Statement catalog_stmt = catalog_proc.getStatements().add(name);
StatementCompiler.compile(compiler, hsql, catalog, catalog_db, new DatabaseEstimates(), catalog_stmt, sql, true);
// HACK: For now just return the PlanNodeList from the first fragment
System.err.println("CATALOG_STMT: " + CatalogUtil.debug(catalog_stmt.getFragments()));
assert (catalog_stmt.getFragments().get(0) != null);
String serialized = catalog_stmt.getFragments().get(0).getPlannodetree();
String jsonString = Encoder.hexDecodeToString(serialized);
PlanNodeList list = null; // FIXME
// (PlanNodeList)PlanNodeTree.fromJSONObject(new
// JSONObject(jsonString), catalog_db);
return (list.getRootPlanNode());
}
示例3: getExplainPlans
import org.voltdb.utils.Encoder; //导入方法依赖的package包/类
/**
* Get textual explain plan info for each plan from the
* catalog to be shoved into the catalog jarfile.
*/
HashMap<String, byte[]> getExplainPlans(Catalog catalog) {
HashMap<String, byte[]> retval = new HashMap<String, byte[]>();
Database db = getCatalogDatabase();
assert(db != null);
for (Procedure proc : db.getProcedures()) {
for (Statement stmt : proc.getStatements()) {
String s = "SQL: " + stmt.getSqltext() + "\n";
s += "COST: " + Integer.toString(stmt.getCost()) + "\n";
s += "PLAN:\n\n";
s += Encoder.hexDecodeToString(stmt.getExplainplan()) + "\n";
byte[] b = s.getBytes(Constants.UTF8ENCODING);
retval.put(proc.getTypeName() + "_" + stmt.getTypeName() + ".txt", b);
}
}
return retval;
}
示例4: deserializeExpression
import org.voltdb.utils.Encoder; //导入方法依赖的package包/类
/**
* @param catalog_db
* @param exptree
* @return
* @throws Exception
*/
public static AbstractExpression deserializeExpression(Database catalog_db, String exptree) throws Exception {
AbstractExpression exp = null;
if (exptree != null && !exptree.isEmpty()) {
JSONObject json_obj = new JSONObject(Encoder.hexDecodeToString(exptree));
exp = AbstractExpression.fromJSONObject(json_obj, catalog_db);
}
return (exp);
}
示例5: initializeHSQLBackend
import org.voltdb.utils.Encoder; //导入方法依赖的package包/类
static public HsqlBackend initializeHSQLBackend(long siteId,
CatalogContext context)
{
synchronized(backendLock) {
if (m_backend == null) {
try {
m_backend = new HsqlBackend(siteId);
final String binDDL = context.database.getSchema();
final String ddl = Encoder.decodeBase64AndDecompress(binDDL);
final String[] commands = ddl.split("\n");
for (String command : commands) {
String decoded_cmd = Encoder.hexDecodeToString(command);
decoded_cmd = decoded_cmd.trim();
if (decoded_cmd.length() == 0) {
continue;
}
m_backend.runDDL(decoded_cmd);
}
}
catch (final Exception ex) {
hostLog.fatal("Unable to construct HSQL backend");
VoltDB.crashLocalVoltDB(ex.getMessage(), true, ex);
}
}
return m_backend;
}
}
示例6: PlannerTool
import org.voltdb.utils.Encoder; //导入方法依赖的package包/类
public PlannerTool(final Cluster cluster, final Database database, byte[] catalogHash)
{
assert(cluster != null);
assert(database != null);
m_database = database;
m_cluster = cluster;
m_catalogHash = catalogHash;
m_cache = AdHocCompilerCache.getCacheForCatalogHash(catalogHash);
// LOAD HSQL
m_hsql = HSQLInterface.loadHsqldb();
String binDDL = m_database.getSchema();
String ddl = Encoder.decodeBase64AndDecompress(binDDL);
String[] commands = ddl.split("\n");
for (String command : commands) {
String decoded_cmd = Encoder.hexDecodeToString(command);
decoded_cmd = decoded_cmd.trim();
if (decoded_cmd.length() == 0)
continue;
try {
m_hsql.runDDLCommand(decoded_cmd);
}
catch (HSQLParseException e) {
// need a good error message here
throw new RuntimeException("Error creating hsql: " + e.getMessage() + " in DDL statement: " + decoded_cmd);
}
}
hostLog.debug("hsql loaded");
// Create and register a singleton planner stats collector, if this is the first time.
// In mock test environments there may be no stats agent.
synchronized (this) {
if (m_plannerStats == null) {
final StatsAgent statsAgent = VoltDB.instance().getStatsAgent();
if (statsAgent != null) {
m_plannerStats = new PlannerStatsCollector(-1);
statsAgent.registerStatsSource(StatsSelector.PLANNER, -1, m_plannerStats);
}
}
}
}