Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Commit

Permalink
Solve #1715, Add properties for storage object (#1716)
Browse files Browse the repository at this point in the history
  • Loading branch information
littlezhou authored and qiyuangong committed May 4, 2018
1 parent 9e8841e commit 1c1750d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand All @@ -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:
Expand Down

0 comments on commit 1c1750d

Please sign in to comment.