⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pierosl.jj

📁 High performance DB query
💻 JJ
📖 第 1 页 / 共 2 页
字号:
        { opLookup.put(opname, new Integer(opNum++)); }        { curOp.setQueryOptions(opOptions); }        { children.add(opChildren); }        { parents.add(opParents); }    { curGraph.addOperator(curOp); }    <OPEND>}void doOpBloom() :{    String type, sendNS, deliverNS, filterName;    String sendRID = null;    int executorNum = 0;}{    type=doTextString() <OPSEP> sendNS=doLiteralTextString() <OPSEP> (sendRID=doLiteralTextString())? <OPSEP> deliverNS=doLiteralTextString() <OPSEP> filterName=doLiteralTextString()    { if (type.equals("DYNAMIC")) executorNum = Operator.DYNAMIC_LOADER; }    { if (type.equals("BLOOMCOLLECTOR")) executorNum = Operator.SPEC_BLOOMCOLLECTOR; }    { curOp = new Bloom(executorNum, sendNS, sendRID, deliverNS, filterName); }}void doOpCache() :{    String type;    int executorNum = 0;}{    type=doTextString()    { if (type.equals("DYNAMIC")) executorNum = Operator.DYNAMIC_LOADER; }    { if (type.equals("MEMCACHE")) executorNum = Operator.SPEC_MEMCACHE; }    { if (type.equals("MEMUPDATECACHE")) executorNum = Operator.SPEC_MEMUPDATECACHE; }    { curOp = new Cache(executorNum); }}void doOpDupElim() :{    String type;    int executorNum = 0;}{    type=doTextString()    { if (type.equals("DYNAMIC")) executorNum = Operator.DYNAMIC_LOADER; }    { if (type.equals("BASIC")) executorNum = Operator.DUPELIM_BASIC; }    { curOp = new DupElim(executorNum); }}void doOpEddy() :{    String type, policy, pullSet, pullStream;;    HashMap sourceMap, doneMap;    int executorNum = 0;    int routingPolicy = 0;}{    type=doTextString() <OPSEP> sourceMap=doHashMap() doneMap=doHashMap() policy=doTextString() <OPSEP> pullSet=doTextString() <OPSEP> pullStream=doTextString()    { if (type.equals("DYNAMIC")) executorNum = Operator.DYNAMIC_LOADER; }    { if (type.equals("BASIC")) executorNum = Operator.EDDY_BASIC; }    { if (policy.equals("BASIC")) routingPolicy = Eddy.BASIC_ROUTING; }    { if (policy.equals("RANDOM")) routingPolicy = Eddy.RANDOM_ROUTING; }    { curOp = new Eddy(executorNum, sourceMap, doneMap, routingPolicy, Boolean.valueOf(pullSet).booleanValue(), Boolean.valueOf(pullStream).booleanValue()); }}void doOpFlowControl() :{    String type, pullSet, pullStream;    int executorNum = 0;}{    type=doTextString() <OPSEP> pullSet=doTextString() <OPSEP> pullStream=doTextString()    { if (type.equals("DYNAMIC")) executorNum = Operator.DYNAMIC_LOADER; }    { if (type.equals("BASIC")) executorNum = Operator.FLOWCONTROL_BASIC; }    { curOp = new FlowControl(executorNum, Boolean.valueOf(pullSet).booleanValue(), Boolean.valueOf(pullStream).booleanValue()); }}void doOpGet() :{    String type, getNS;    int executorNum = 0;}{    type=doTextString() <OPSEP> getNS=doLiteralTextString()    { if (type.equals("DYNAMIC")) executorNum = Operator.DYNAMIC_LOADER; }    { if (type.equals("BASIC")) executorNum = Operator.GET_BASIC; }    { curOp = new Get(executorNum, getNS); }}void doOpGroupBy() :{    String type, tableName, last;    int executorNum = 0;    ArrayList groupByExpressions, aggregateExpressions, aggregateOperations;}{    type=doTextString() <OPSEP> groupByExpressions=doExpressionArrayList() <OPSEP> aggregateExpressions=doExpressionArrayList() <OPSEP> aggregateOperations=convertAggOperators(doStringArrayList()) <OPSEP> tableName=doLiteralTextString() <OPSEP> last=doTextString()    { if (type.equals("DYNAMIC")) executorNum = Operator.DYNAMIC_LOADER; }    { if (type.equals("BASIC")) executorNum = Operator.GROUPBY_BASIC; }    { if (type.equals("DUAL")) executorNum = Operator.GROUPBY_DUAL; }    { if (type.equals("LEARNED")) executorNum = Operator.GROUPBY_LEARNED; }    { if (type.equals("TREE")) executorNum = Operator.GROUPBY_TREE; }    { curOp = new GroupBy(executorNum, groupByExpressions, aggregateExpressions, aggregateOperations, tableName, Boolean.valueOf(last).booleanValue()); }}ArrayList convertAggOperators(ArrayList raw) :{    ArrayList converted = new ArrayList();    for (int i=0; i<raw.size(); i++) {        String curItem = (String) raw.get(i);        if (curItem.compareToIgnoreCase("COUNT") == 0) converted.add(new Integer(GroupBy.AGG_COUNT));        if (curItem.compareToIgnoreCase("SUM") == 0) converted.add(new Integer(GroupBy.AGG_SUM));        if (curItem.compareToIgnoreCase("MAX") == 0) converted.add(new Integer(GroupBy.AGG_MAX));        if (curItem.compareToIgnoreCase("MIN") == 0) converted.add(new Integer(GroupBy.AGG_MIN));        if (curItem.compareToIgnoreCase("AVG") == 0) converted.add(new Integer(GroupBy.AGG_AVG));        if (curItem.compareToIgnoreCase("CONCAT") == 0) converted.add(new Integer(GroupBy.AGG_CONCAT));    }}{    { return converted; }}void doOpJoin() :{    String type, resultTableName;    int executorNum = 0;    SimplePredicateAtomic joinPredicate;}{    type=doTextString() <OPSEP> joinPredicate=doSimplePredicateAtomic() <OPSEP> resultTableName=doLiteralTextString()    { if (type.equals("DYNAMIC")) executorNum = Operator.DYNAMIC_LOADER; }    { if (type.equals("SYMMETRICHASH")) executorNum = Operator.JOIN_SYMMETRICHASH; }    { if (type.equals("INDEX")) executorNum = Operator.JOIN_INDEX; }    { curOp = new Join(executorNum, joinPredicate, resultTableName); }}void doOpNull() :{    String type;    int executorNum = 0;}{    type=doTextString()    { if (type.equals("DYNAMIC")) executorNum = Operator.DYNAMIC_LOADER; }    { curOp = new Null(executorNum); }}void doOpProjection() :{    String type, tableName;    int executorNum = 0;    ArrayList expressionList, renameList = null;}{    type=doTextString() <OPSEP> expressionList=doExpressionArrayList() <OPSEP> renameList=doStringArrayList() <OPSEP> tableName=doLiteralTextString() <OPSEP> ( doLiteralTextString() )?    { if (type.equals("DYNAMIC")) executorNum = Operator.DYNAMIC_LOADER; }    { if (type.equals("BASIC")) executorNum = Operator.PROJECT_BASIC; }    { if (type.equals("NEW")) executorNum = Operator.PROJECT_NEW; }    { if ((renameList != null) && (renameList.size() != expressionList.size())) renameList = null; }    { curOp = new Projection(executorNum, expressionList, renameList, tableName); }}void doOpPut() :{    String type, putNS;    int executorNum = 0;    ArrayList expressionList;}{    type=doTextString() <OPSEP> putNS=doLiteralTextString() <OPSEP> expressionList=doExpressionArrayList()    { if (type.equals("DYNAMIC")) executorNum = Operator.DYNAMIC_LOADER; }    { if (type.equals("BASIC")) executorNum = Operator.PUT_BASIC; }    { if (type.equals("DHT")) executorNum = Operator.PUT_DHT; }    { if (type.equals("EDDY")) executorNum = Operator.PUT_EDDY; }    { if (type.equals("BLOOM")) executorNum = Operator.PUT_BLOOM; }    { if (type.equals("DHTMESSAGE")) executorNum = Operator.PUT_DHTMESSAGE; }    { if (type.equals("IP")) executorNum = Operator.PUT_IP; }    { if (type.equals("TREE")) executorNum = Operator.PUT_TREE; }    { curOp = new Put(executorNum, putNS, expressionList); }}void doOpQueue() :{    String type;    int executorNum = 0;}{    type=doTextString()    { if (type.equals("DYNAMIC")) executorNum = Operator.DYNAMIC_LOADER; }    { if (type.equals("BASIC")) executorNum = Operator.QUEUE_BASIC; }    { curOp = new Queue(executorNum); }}void doOpResult() :{    String type, batching, queryID;    int executorNum = 0;    InetSocketAddress destination;}{    type=doTextString() <OPSEP> destination=doInetSocketAddress() <OPSEP> batching=doTextString() <OPSEP> queryID=doLiteralTextString()    { if (type.equals("DYNAMIC")) executorNum = Operator.DYNAMIC_LOADER; }    { if (type.equals("NETSEND")) executorNum = Operator.RESULT_NETSEND; }    { curOp = new Result(executorNum, destination, Integer.parseInt(batching), Integer.parseInt(queryID)); }}void doOpScan() :{    String type, sourceTable;    int executorNum = 0;}{    type=doTextString() <OPSEP> sourceTable=doLiteralTextString()    { if (type.equals("DYNAMIC")) executorNum = Operator.DYNAMIC_LOADER; }    { if (type.equals("DHT")) executorNum = Operator.SCAN_DHT; }    { if (type.equals("JDBC")) executorNum = Operator.SCAN_JDBC; }    { if (type.equals("GANGLIA")) executorNum = Operator.SCAN_GANGLIA; }    { if (type.equals("DHTMESSAGE")) executorNum = Operator.SCAN_DHTMESSAGE; }    { if (type.equals("CSV")) executorNum = Operator.SCAN_CSV; }    { if (type.equals("PLSENSOR")) executorNum = Operator.SCAN_CSV; }    { if (type.equals("IP")) executorNum = Operator.SCAN_IP; }    { if (type.equals("TREE")) executorNum = Operator.SCAN_TREE; }    { curOp = new Scan(executorNum, sourceTable); }}void doOpSelection() :{    String type;    int executorNum = 0;    SimplePredicate predicate;}{    type=doTextString() <OPSEP> predicate=doSimplePredicate()    { if (type.equals("DYNAMIC")) executorNum = Operator.DYNAMIC_LOADER; }    { if (type.equals("BASIC")) executorNum = Operator.SELECT_BASIC; }    { curOp = new Selection(executorNum, predicate); }}void doOpTee() :{    String type;    int executorNum = 0;}{    type=doTextString()    { if (type.equals("DYNAMIC")) executorNum = Operator.DYNAMIC_LOADER; }    { if (type.equals("BASIC")) executorNum = Operator.TEE_BASIC; }    { curOp = new Tee(executorNum); }}void doOpUnion() :{    String type;    int executorNum = 0;}{    type=doTextString()    { if (type.equals("DYNAMIC")) executorNum = Operator.DYNAMIC_LOADER; }    { if (type.equals("BASIC")) executorNum = Operator.UNION_BASIC; }    { curOp = new Union(executorNum); }}HashMap doHashMap() :{    String option;    Expression value;    int curState;    HashMap theHashMap;}{    { curState = token_source.curLexState; }    { token_source.SwitchTo(PierOSLConstants.HASHMAP); }    { theHashMap = new HashMap(); }    ( option=doLiteralTextString() <HASHMAPEQ> value=doExpression(false)    { theHashMap.put(option, value); }    ( <HASHMAPSEP> option=doLiteralTextString() <HASHMAPEQ> value=doExpression(false)    { theHashMap.put(option, value); }    )* )?    <HASHMAPEND>    { token_source.SwitchTo(curState); }    { return theHashMap; }}SimplePredicate doSimplePredicate() :{    SimplePredicate predicate;    int curState;}{    { curState = token_source.curLexState; }    { token_source.SwitchTo(PierOSLConstants.PREDICATE); }    <PREDICATESTART> (    (<PREDICATETYPEAND>    { predicate = doSimplePredicates(new ConjunctivePredicateSet()); }    ) | ( <PREDICATETYPEOR>    { predicate = doSimplePredicates(new DisjunctivePredicateSet()); }    ) | ( <PREDICATETYPEATOMIC> <PREDICATESEP>    { predicate = doSimplePredicateAtomic(); }    ))    <PREDICATEEND>    { token_source.SwitchTo(curState); }    { return predicate; }}SimplePredicate doSimplePredicates(SimplePredicateSet predicateSet):{    SimplePredicate predicate;}{    ( <PREDICATESEP> predicate=doSimplePredicate()    { predicateSet.addPredicate(predicate); }    )+    { return predicateSet; }}SimplePredicateAtomic doSimplePredicateAtomic() :{    Expression leftExpression, rightExpression;    SimplePredicateAtomic predicate;    byte op;    int curState;}{    { curState = token_source.curLexState; }    { token_source.SwitchTo(PierOSLConstants.PREDICATEATOMIC); }    leftExpression=doExpression(false) op=doPredicateOp() rightExpression=doExpression(false)    { predicate = new SimplePredicateAtomic(leftExpression, rightExpression, op); }    { token_source.SwitchTo(curState); }    { return predicate; }}byte doPredicateOp() :{    Token op;}{    op=<COMPAREOP>    { if (op.image.equals("=")) return 1; }    { if (op.image.equals("!=")) return -1; }    { if (op.image.equals("<>")) return -1; }    { if (op.image.equals(">")) return -3; }    { if (op.image.equals(">=")) return -2; }    { if (op.image.equals("<")) return 2; }    { if (op.image.equals("<=")) return 3; }}ArrayList doStringArrayList() :{    String element;    ArrayList theArray;    int curState;}{    { curState = token_source.curLexState; }    { token_source.SwitchTo(PierOSLConstants.ARRAYLIST); }    <ARRAYSTART>    { theArray = new ArrayList(); }    ( element=doLiteralTextString()    { theArray.add(element); }    ( <ARRAYSEP> element=doLiteralTextString()        { theArray.add(element); }    )* )?    <ARRAYEND>    { token_source.SwitchTo(curState); }    { return theArray; }}ArrayList doExpressionArrayList() :{    Expression element;    ArrayList theArray;    int curState;}{    { curState = token_source.curLexState; }    { token_source.SwitchTo(PierOSLConstants.ARRAYLIST); }    <ARRAYSTART>    { theArray = new ArrayList(); }    ( <ARRAYEXPSTART> element=doExpression(true)    { theArray.add(element); }    ( <ARRAYSEP> element=doExpression(false)        { theArray.add(element); }    )* )?    <ARRAYEND>    { token_source.SwitchTo(curState); }    { return theArray; }}InetSocketAddress doInetSocketAddress() :{    String address, port;    int curState;    InetSocketAddress destination;}{    { curState = token_source.curLexState; }    { token_source.SwitchTo(PierOSLConstants.INETSOCKET); }    address=doTextString() <PORTSEP> port=doTextString()    { token_source.SwitchTo(curState); }    { destination = ((address.equals("null")) || (port.equals("null"))) ? null : new InetSocketAddress(address, Integer.parseInt(port)); }    { return destination; }}String doTextString():{    Token text;}{    text=<BASICTEXTCHARS>    { return text.image; }}Expression doExpression(boolean started):{    String name, type;    Expression subExpression;    int curState;    Expression expression = null;    ArrayList parameters = new ArrayList();}{    { curState = token_source.curLexState; }    { token_source.SwitchTo(PierOSLConstants.EXPRESSION); }    { if (started == false) getExpressionStart(); }    (    (<EXPRESSIONFIELD> <EXPRESSIONSEP> name=doLiteralTextString()    { expression = new ExpressionField(name); }    ) |    (<EXPRESSIONCONSTANT> <EXPRESSIONSEP> name=doLiteralTextString() <EXPRESSIONCAST> type=doTextString()    { expression = new ExpressionConstant(makeTypedObject(type, name)); }    ) |    (<EXPRESSIONFUNCTION> <EXPRESSIONSEP> name=doLiteralTextString() (<EXPRESSIONSEP> subExpression=doExpression(false)    { parameters.add(subExpression); }    )*    { expression = new ExpressionFunction(name, parameters); }    )    )<EXPRESSIONEND>    { token_source.SwitchTo(curState); }    { return expression; }}void getExpressionStart():{}{    <EXPRESSIONSTART>}String doLiteralTextString():{    Token text;    String curStr, escaped;    int curState;}{    (( text=<BASICTEXTCHARS>    { return text.image; }    ) | ( <LITERALSTART>    { curState = token_source.curLexState; }    { token_source.SwitchTo(PierOSLConstants.LITERALS); }    { curStr = new String(); }    (( text=<LITERALTEXT>    { curStr += text.image; }    ) | ( <LITERALESCAPE> escaped=doLiteralEscape()    { curStr += escaped; }    ))* <LITERALEND>    { token_source.SwitchTo(curState); }    { return curStr; }    ))}String doLiteralEscape():{    Token token;}{    (token=<ESCAPEUNICODE>    { int x = Integer.parseInt(token.image.substring(1,4),16); return new String(new Character((char) x).toString()); }    | <ESCAPEQID>    { return "" + sourceID; }    | <ESCAPEQTAG>    { return queryNS; }    | <ESCAPEQADDR>    { return sourceSocketAddress.getAddress().toString().substring(1); }    | <ESCAPESLASH>    { return "\\"; }    | <ESCAPEQUOTE>    { return "\""; }    | <ESCAPENEWLINE>    { return "\n"; }    )}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -