diff --git a/smart-rule/src/main/java/org/smartdata/rule/objects/StorageObject.java b/smart-rule/src/main/java/org/smartdata/rule/objects/StorageObject.java index ec1c37a986e..a89d2a1f25e 100644 --- a/smart-rule/src/main/java/org/smartdata/rule/objects/StorageObject.java +++ b/smart-rule/src/main/java/org/smartdata/rule/objects/StorageObject.java @@ -33,7 +33,7 @@ public class StorageObject extends SmartObject { PROPERTIES = new HashMap<>(); PROPERTIES.put("capacity", new Property("capacity", ValueType.LONG, Arrays.asList(ValueType.STRING), "storage", "capacity", true, - "type = $0")); + "type = $0 AND capacity")); PROPERTIES.put("free", new Property("free", ValueType.LONG, Arrays.asList(ValueType.STRING), "storage", "free", true, "type = $0 AND free")); diff --git a/smart-rule/src/main/java/org/smartdata/rule/parser/SmartRuleVisitTranslator.java b/smart-rule/src/main/java/org/smartdata/rule/parser/SmartRuleVisitTranslator.java index 5b3da563559..9219ab36892 100644 --- a/smart-rule/src/main/java/org/smartdata/rule/parser/SmartRuleVisitTranslator.java +++ b/smart-rule/src/main/java/org/smartdata/rule/parser/SmartRuleVisitTranslator.java @@ -586,19 +586,19 @@ private TreeNode pharseConstLong(String strLong) { str = str.substring(0, str.length() - unit.length()); switch (unit) { case "PB": - times *= 1024; + times *= 1024L * 1024 * 1024 * 1024 * 1024; break; case "TB": - times *= 1024; + times *= 1024L * 1024 * 1024 * 1024; break; case "GB": - times *= 1024; + times *= 1024L * 1024 * 1024; break; case "MB": - times *= 1024; + times *= 1024L * 1024; break; case "KB": - times *= 1024; + times *= 1024L; break; } ret = Long.parseLong(str); @@ -757,10 +757,12 @@ public NodeTransResult doGenerateSql(TreeNode root, String tableName) throws IOE rop = doGenerateSql(root.getRight(), tableName); } + boolean bEflag = false; if (lop.getTableName() == null && rop.getTableName() != null) { NodeTransResult temp = lop; lop = rop; rop = temp; + bEflag = true; } if (optype == OperatorType.AND || optype == OperatorType.OR || optype == OperatorType.NONE) { @@ -787,6 +789,24 @@ public NodeTransResult doGenerateSql(TreeNode root, String tableName) throws IOE ropStr = ropStr.replace("*", "%"); ropStr = ropStr.replace("?", "_"); } + + if (bEflag && !procAcc) { + switch (optype) { + case LT: + op = ">"; + break; + case LE: + op = ">="; + break; + case GT: + op = "<"; + break; + case GE: + op = "<="; + break; + } + } + if (procAcc) { switch (optype) { case LT: