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

📄 ufl.java

📁 High performance DB query
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
  final public void doInput() throws ParseException {    QueryTag queryTag;      queryTag = new QueryTag(sourceSocketAddress, sourceID, (byte) 0);      queryNS = queryTag.getQueryNS();    label_1:    while (true) {      graphNum++;      doOpGraphObj();      switch (jj_nt.kind) {      case OPGRAPHOBJ:        ;        break;      default:        jj_la1[0] = jj_gen;        break label_1;      }    }    switch (jj_nt.kind) {    case END:      jj_consume_token(END);      break;    default:      jj_la1[1] = jj_gen;      ;    }  }  final public void doOpGraphObj() throws ParseException {    HashMap settings = new HashMap();    Operator curOp;    OperatorGraph curGraph = null;    int opNum = 0;    QueryTag queryTag;    String graphName;      opLookup = new HashMap();      children = new ArrayList();      parents = new ArrayList();    jj_consume_token(OPGRAPHOBJ);    jj_consume_token(OBJNAMESTART);    graphName = doLiteralTextString();    jj_consume_token(OBJNAMEEND);    jj_consume_token(OBJSTART);    label_2:    while (true) {      switch (jj_nt.kind) {      case BASICTEXTCHARS:        ;        break;      default:        jj_la1[2] = jj_gen;        break label_2;      }      doKeyValEntry(settings);    }      queryTag = new QueryTag(sourceSocketAddress, sourceID, (byte) graphNum);    curGraph = new OperatorGraph(getValue(settings, "ns", null), getValue(settings, "rid", null), Long.parseLong(getValue(settings, "duration", graphName)), queryTag);    label_3:    while (true) {      switch (jj_nt.kind) {      case OPOBJ:        ;        break;      default:        jj_la1[3] = jj_gen;        break label_3;      }      curOp = doOperator(opNum++);      curGraph.addOperator(curOp);    }    jj_consume_token(OBJEND);      fixOpGraphLinks(curGraph);      if (Output.debuggingEnabled) {logger.debug(new LogMessage(new Object[] {"Processed OpGraph:\n", curGraph})); }      thePlan.addOpGraph(curGraph);  }  final public Operator doOperator(int opNum) throws ParseException {    String name;    HashMap settings = new HashMap();    Object predicate = null;    Operator theOperator = null;    jj_consume_token(OPOBJ);    jj_consume_token(OBJNAMESTART);    name = doTextString();    jj_consume_token(OBJNAMEEND);    jj_consume_token(OBJSTART);    label_4:    while (true) {      switch (jj_nt.kind) {      case PREDOBJ:      case BASICTEXTCHARS:        ;        break;      default:        jj_la1[4] = jj_gen;        break label_4;      }      switch (jj_nt.kind) {      case BASICTEXTCHARS:        doKeyValEntry(settings);        break;      case PREDOBJ:        predicate = doPredicate();        break;      default:        jj_la1[5] = jj_gen;        jj_consume_token(-1);        throw new ParseException();      }    }    jj_consume_token(OBJEND);      String type = getValue(settings, "type", name);        String implementation = getValue(settings, "implementation", name);        int executorNum  = 0;        if (implementation.equalsIgnoreCase("DYNAMIC")) executorNum = Operator.DYNAMIC_LOADER;        if (type.equalsIgnoreCase("BLOOM")) {            if (implementation.equalsIgnoreCase("BLOOMCOLLECTOR")) executorNum = Operator.SPEC_BLOOMCOLLECTOR;            if (executorNum == 0)                {if (true) throw new RuntimeException("Operator " + name + " has invalid implementation specification " + implementation);}            theOperator = new Bloom(executorNum, getValue(settings, "sendns", name), getValue(settings, "sendrid", null), getValue(settings, "deliverns", name), getValue(settings, "filtername", name));        }        if (type.equalsIgnoreCase("CACHE")) {            if (implementation.equalsIgnoreCase("MEMCACHE")) executorNum = Operator.SPEC_MEMCACHE;            if (implementation.equalsIgnoreCase("MEMUPDATECACHE")) executorNum = Operator.SPEC_MEMUPDATECACHE;            if (executorNum == 0)                {if (true) throw new RuntimeException("Operator " + name + " has invalid implementation specification " + implementation);}            theOperator = new Cache(executorNum);        }        if (type.equalsIgnoreCase("DUPELIM")) {            if (implementation.equalsIgnoreCase("BASIC")) executorNum = Operator.DUPELIM_BASIC;            if (executorNum == 0)                {if (true) throw new RuntimeException("Operator " + name + " has invalid implementation specification " + implementation);}            theOperator = new DupElim(executorNum);        }        if (type.equalsIgnoreCase("EDDY")) {            if (implementation.equalsIgnoreCase("BASIC")) executorNum = Operator.EDDY_BASIC;            if (executorNum == 0)                {if (true) throw new RuntimeException("Operator " + name + " has invalid implementation specification " + implementation);}            HashMap sourceMap = (HashMap) settings.remove("sourcemap");            if (sourceMap == null)                getValue(settings, "sourcemap", name);            HashMap doneMap = (HashMap) settings.remove("donemap");            if (doneMap == null)                getValue(settings, "donemap", name);            String policy = getValue(settings, "policy", name);            int routingPolicy = 0;            if (policy.equals("BASIC")) routingPolicy = Eddy.BASIC_ROUTING;                if (policy.equals("RANDOM")) routingPolicy = Eddy.RANDOM_ROUTING;                if (policy.equals("QL")) routingPolicy = Eddy.QL_ROUTING;            if (routingPolicy == 0)                {if (true) throw new RuntimeException("Operator " + name + " has invalid policy specification " + policy);}            theOperator = new Eddy(executorNum, sourceMap, doneMap, routingPolicy, Boolean.valueOf(getValue(settings, "pullset", name)).booleanValue(), Boolean.valueOf(getValue(settings, "pullstream", name)).booleanValue());        }        if (type.equalsIgnoreCase("FLOWCONTROL")) {            if (implementation.equalsIgnoreCase("BASIC")) executorNum = Operator.FLOWCONTROL_BASIC;            if (executorNum == 0)                {if (true) throw new RuntimeException("Operator " + name + " has invalid implementation specification " + implementation);}            theOperator = new FlowControl(executorNum, Boolean.valueOf(getValue(settings, "pullset", name)).booleanValue(), Boolean.valueOf(getValue(settings, "pullstream", name)).booleanValue());        }        if (type.equalsIgnoreCase("GET")) {            if (implementation.equalsIgnoreCase("BASIC")) executorNum = Operator.GET_BASIC;            if (executorNum == 0)                {if (true) throw new RuntimeException("Operator " + name + " has invalid implementation specification " + implementation);}            theOperator = new Get(executorNum, getValue(settings, "getns", name));        }        if (type.equalsIgnoreCase("GROUPBY")) {            if (implementation.equalsIgnoreCase("BASIC")) executorNum = Operator.GROUPBY_BASIC;            if (implementation.equalsIgnoreCase("DUAL")) executorNum = Operator.GROUPBY_DUAL;            if (implementation.equalsIgnoreCase("LEARNED")) executorNum = Operator.GROUPBY_LEARNED;            if (implementation.equalsIgnoreCase("TREE")) executorNum = Operator.GROUPBY_TREE;            if (executorNum == 0)                {if (true) throw new RuntimeException("Operator " + name + " has invalid implementation specification " + implementation);}            ArrayList groupByExpressions = (ArrayList) settings.remove("groupbyexpressions");            if (groupByExpressions == null) groupByExpressions = new ArrayList();            ArrayList aggregateExpressions = (ArrayList) settings.remove("aggregateexpressions");            if (aggregateExpressions == null) aggregateExpressions = new ArrayList();            ArrayList aggregateOps = (ArrayList) settings.remove("aggregateops");            if (aggregateOps == null) aggregateOps = new ArrayList();            theOperator = new GroupBy(executorNum, groupByExpressions, aggregateExpressions, convertAggOperators(aggregateOps), getValue(settings, "sendns", name), Boolean.valueOf(getValue(settings, "last", name)).booleanValue());        }        if (type.equalsIgnoreCase("JOIN")) {            if (implementation.equalsIgnoreCase("SYMMETRICHASH")) executorNum = Operator.JOIN_SYMMETRICHASH;            if (implementation.equalsIgnoreCase("INDEX")) executorNum = Operator.JOIN_INDEX;            if (executorNum == 0)                {if (true) throw new RuntimeException("Operator " + name + " has invalid implementation specification " + implementation);}            theOperator = new Join(executorNum, (SimplePredicateAtomic) predicate, getValue(settings, "resulttable", name));        }        if (type.equalsIgnoreCase("NULL")) {            if (executorNum == 0)                {if (true) throw new RuntimeException("Operator " + name + " has invalid implementation specification " + implementation);}            theOperator = new Null(executorNum);        }        if (type.equalsIgnoreCase("PROJECTION")) {            if (implementation.equalsIgnoreCase("BASIC")) executorNum = Operator.PROJECT_BASIC;            if (implementation.equalsIgnoreCase("NEW")) executorNum = Operator.PROJECT_NEW;            if (executorNum == 0)                {if (true) throw new RuntimeException("Operator " + name + " has invalid implementation specification " + implementation);}            ArrayList expressionList = (ArrayList) settings.remove("expressionlist");            if (expressionList == null)                {if (true) throw new RuntimeException("Operator " + name + " must have an expressionList");}            ArrayList renameList = (ArrayList) settings.remove("renamelist");            theOperator = new Projection(executorNum, expressionList, renameList, getValue(settings, "tablename", name));        }        if (type.equalsIgnoreCase("PUT")) {            if (implementation.equalsIgnoreCase("BASIC")) executorNum = Operator.PUT_BASIC;            if (implementation.equalsIgnoreCase("DHT")) executorNum = Operator.PUT_DHT;            if (implementation.equalsIgnoreCase("EDDY")) executorNum = Operator.PUT_EDDY;            if (implementation.equalsIgnoreCase("BLOOM")) executorNum = Operator.PUT_BLOOM;            if (implementation.equalsIgnoreCase("DHTMESSAGE")) executorNum = Operator.PUT_DHTMESSAGE;            if (implementation.equalsIgnoreCase("IP")) executorNum = Operator.PUT_IP;            if (implementation.equalsIgnoreCase("TREE")) executorNum = Operator.PUT_TREE;            if (executorNum == 0)                {if (true) throw new RuntimeException("Operator " + name + " has invalid implementation specification " + implementation);}            ArrayList expressionList = (ArrayList) settings.remove("expressionlist");                        if (expressionList == null)                {if (true) throw new RuntimeException("Operator " + name + " must have an expressionList");}            theOperator = new Put(executorNum, getValue(settings, "rehashns", name), expressionList);        }        if (type.equalsIgnoreCase("QUEUE")) {            if (implementation.equalsIgnoreCase("BASIC")) executorNum = Operator.QUEUE_BASIC;            if (executorNum == 0)                {if (true) throw new RuntimeException("Operator " + name + " has invalid implementation specification " + implementation);}            theOperator = new Queue(executorNum);        }        if (type.equalsIgnoreCase("RESULT")) {            if (implementation.equalsIgnoreCase("NETSEND")) executorNum = Operator.RESULT_NETSEND;            if (executorNum == 0)                {if (true) throw new RuntimeException("Operator " + name + " has invalid implementation specification " + implementation);}            InetSocketAddress destination = null;            String ip = getValue(settings, "ip", null);            String port = getValue(settings, "port", null);            if ((ip != null) && (port != null))                destination = new InetSocketAddress(ip, Integer.parseInt(port));            theOperator = new Result(executorNum, destination, Integer.parseInt(getValue(settings, "batching", name)), Integer.parseInt(getValue(settings, "queryid", name)));        }        if (type.equalsIgnoreCase("SCAN")) {            if (implementation.equalsIgnoreCase("DHT")) executorNum = Operator.SCAN_DHT;            if (implementation.equalsIgnoreCase("JDBC")) executorNum = Operator.SCAN_JDBC;            if (implementation.equalsIgnoreCase("GANGLIA")) executorNum = Operator.SCAN_GANGLIA;            if (implementation.equalsIgnoreCase("DHTMESSAGE")) executorNum = Operator.SCAN_DHTMESSAGE;            if (implementation.equalsIgnoreCase("PLSENSOR")) executorNum = Operator.SCAN_CSV;            if (implementation.equalsIgnoreCase("CSV")) executorNum = Operator.SCAN_CSV;            if (implementation.equalsIgnoreCase("IP")) executorNum = Operator.SCAN_IP;            if (implementation.equalsIgnoreCase("TREE")) executorNum = Operator.SCAN_TREE;            if (executorNum == 0)                {if (true) throw new RuntimeException("Operator " + name + " has invalid implementation specification " + implementation);}            theOperator = new Scan(executorNum, getValue(settings, "source", name));        }        if (type.equalsIgnoreCase("SELECTION")) {            if (implementation.equalsIgnoreCase("BASIC")) executorNum = Operator.SELECT_BASIC;            if (executorNum == 0)                {if (true) throw new RuntimeException("Operator " + name + " has invalid implementation specification " + implementation);}            theOperator = new Selection(executorNum, (SimplePredicate) predicate);        }        if (type.equalsIgnoreCase("TEE")) {            if (implementation.equalsIgnoreCase("BASIC")) executorNum = Operator.TEE_BASIC;            if (executorNum == 0)                {if (true) throw new RuntimeException("Operator " + name + " has invalid implementation specification " + implementation);}            theOperator = new Tee(executorNum);        }        if (type.equalsIgnoreCase("UNION")) {            if (implementation.equalsIgnoreCase("BASIC")) executorNum = Operator.UNION_BASIC;            if (executorNum == 0)                {if (true) throw new RuntimeException("Operator " + name + " has invalid implementation specification " + implementation);}            theOperator = new Union(executorNum);            }        if (theOperator == null)            {if (true) throw new RuntimeException("Operator " + name + " has invalid type " + type);}        HashMap queryOptions = (HashMap) settings.remove("options");        if (queryOptions != null)            theOperator.setQueryOptions(queryOptions);            opLookup.put(name, new Integer(opNum));            children.add(settings.remove("sources"));            parents.add(settings.remove("parents"));        {if (true) return theOperator;}    throw new Error("Missing return statement in function");  }  final public Object doPredicate() throws ParseException {    String name;    Object subPredicate = null;    ArrayList subPredicates = new ArrayList();    HashMap settings = new HashMap();    jj_consume_token(PREDOBJ);    jj_consume_token(OBJNAMESTART);    name = doTextString();    jj_consume_token(OBJNAMEEND);    jj_consume_token(OBJSTART);    label_5:    while (true) {      switch (jj_nt.kind) {      case PREDOBJ:      case BASICTEXTCHARS:        ;        break;      default:        jj_la1[6] = jj_gen;        break label_5;      }      switch (jj_nt.kind) {      case BASICTEXTCHARS:        doKeyValEntry(settings);        break;      case PREDOBJ:        subPredicate = doPredicate();      subPredicates.add(subPredicate);        break;      default:        jj_la1[7] = jj_gen;        jj_consume_token(-1);        throw new ParseException();      }    }    jj_consume_token(OBJEND);        String type = getValue(settings, "type", name);        if (type.equalsIgnoreCase("AND")) {            ConjunctivePredicateSet theSet = new ConjunctivePredicateSet();            for (int i=0; i<subPredicates.size(); i++) {                 Object subEntry = subPredicates.get(i);                 if (!(subEntry instanceof SimplePredicate))                     {if (true) throw new RuntimeException("Embedded predicate object (" + name + ") is not of correct type (AND/OR/ATOMIC)");}                 theSet.addPredicate((SimplePredicate) subEntry);            }            {if (true) return theSet;}        }        if (type.equalsIgnoreCase("OR")) {            DisjunctivePredicateSet theSet = new DisjunctivePredicateSet();            for (int i=0; i<subPredicates.size(); i++) {                 Object subEntry = subPredicates.get(i);                 if (!(subEntry instanceof SimplePredicate))                     {if (true) throw new RuntimeException("Embedded predicate object (" + name + ") is not of correct type (AND/OR/ATOMIC)");}                 theSet.addPredicate((SimplePredicate) subEntry);            }            {if (true) return theSet;}        }        if (type.equalsIgnoreCase("ATOMIC")) {            Expression leftExpression = getExpressionValue(settings, "leftexpression", null);            Expression rightExpression = getExpressionValue(settings, "rightexpression", null);            {if (true) return new SimplePredicateAtomic(leftExpression, rightExpression, getPredicateOp(getValue(settings, "op", name)));}        }

⌨️ 快捷键说明

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