std::shared_ptr<PlanOperation> SimpleRawTableScan::parse(const Json::Value& data) { if (!data.isMember("predicates")) { throw std::runtime_error("There is no reason for a Selection without predicates"); } bool mat = data.isMember("materializing") ? data["materializing"].asBool() : true; // defaults to materializing return std::make_shared<SimpleRawTableScan>(buildExpression(data["predicates"]), mat); }
void SimplePipeliningTableScan::setupPlanOperation() { // check if any input tables are available. if (input.sizeOf<storage::AbstractTable>() == 0) { _tbl = nullptr; return; } setPredicate(buildExpression(_predicates)); _comparator->walk(input.getTables()); _tbl = input.getTable(0); }
boost::optional<VariableDecl> Builder::buildVariableDecl(const cst::VariableDecl& vd, SharedScope scope) { if (!vd.value) { logger_->log(error::Message::uninitializedVariable(vd.name.position, vd.name.value)); return boost::none; } boost::optional<Expression> expr = buildExpression(*vd.value, scope); if (!expr) return boost::none; VariableDecl decl(variableFactory_->createVariable(vd.name, getExpressionType(*expr)), *expr); scope->addVariable(decl.var()); return decl; }
std::shared_ptr<PlanOperation> SimpleTableScan::parse(const Json::Value& data) { std::shared_ptr<SimpleTableScan> pop = std::make_shared<SimpleTableScan>(); if (data.isMember("materializing")) pop->setProducesPositions(!data["materializing"].asBool()); if (!data.isMember("predicates")) { throw std::runtime_error("There is no reason for a Selection without predicates"); } pop->setPredicate(buildExpression(data["predicates"])); if (data.isMember("ofDelta")) { pop->_ofDelta = data["ofDelta"].asBool(); } return pop; }
ExprConstSP Parser::parse(const std::string& source) { if (scanners.empty()) buildScanners(scanners, sBuilder); std::vector<token> tokens; stopLocation = source.begin(); bool success = m_tokenizer->tokenize_priority(source, scanners, tokens); if (!success) { stopLocation = m_tokenizer->stop_location(); return ExprConstSP(); } std::vector<Command> commands; if (!parseTokens(tokens, commands)) return ExprConstSP(); for (std::vector<Command>::const_iterator it = commands.begin(); it != commands.end(); ++it) { //cout << endl << (*it).getNodeName() << ", " << (*it).getNodeType() << ", " << (*it).getNumberOfChildren(); } return buildExpression(commands); }