提交 c808b054 authored 作者: Thomas Mueller's avatar Thomas Mueller

EXPLAIN SELECT didn't include the sample size if one was set.

上级 1af923c9
......@@ -956,8 +956,9 @@ public class Select extends Query {
buff.append("DISTINCT ");
}
for (int i = 0; i < visibleColumnCount; i++) {
buff.appendExceptFirst(", ");
buff.append(exprList[i].getSQL());
buff.appendExceptFirst(",");
buff.append("\n");
buff.append(StringUtils.indent(exprList[i].getSQL(), 4, false));
}
buff.append("\nFROM ");
TableFilter filter = topTableFilter;
......@@ -1025,6 +1026,9 @@ public class Select extends Query {
buff.append(" OFFSET ").append(StringUtils.unEnclose(offsetExpr.getSQL()));
}
}
if (sampleSize != 0) {
buff.append("\nSAMPLE_SIZE ").append(sampleSize);
}
if (isForUpdate) {
buff.append("\nFOR UPDATE");
}
......
......@@ -338,16 +338,16 @@ public class SelectUnion extends Query {
buff.append('(').append(left.getPlanSQL()).append(')');
switch (unionType) {
case UNION_ALL:
buff.append(" UNION ALL ");
buff.append("\nUNION ALL\n");
break;
case UNION:
buff.append(" UNION ");
buff.append("\nUNION\n");
break;
case INTERSECT:
buff.append(" INTERSECT ");
buff.append("\nINTERSECT\n");
break;
case EXCEPT:
buff.append(" EXCEPT ");
buff.append("\nEXCEPT\n");
break;
default:
DbException.throwInternalError("type=" + unionType);
......@@ -355,16 +355,19 @@ public class SelectUnion extends Query {
buff.append('(').append(right.getPlanSQL()).append(')');
Expression[] exprList = expressions.toArray(new Expression[expressions.size()]);
if (sort != null) {
buff.append(" ORDER BY ").append(sort.getSQL(exprList, exprList.length));
buff.append("\nORDER BY ").append(sort.getSQL(exprList, exprList.length));
}
if (limitExpr != null) {
buff.append(" LIMIT ").append(StringUtils.unEnclose(limitExpr.getSQL()));
buff.append("\nLIMIT ").append(StringUtils.unEnclose(limitExpr.getSQL()));
if (offsetExpr != null) {
buff.append(" OFFSET ").append(StringUtils.unEnclose(offsetExpr.getSQL()));
buff.append("\nOFFSET ").append(StringUtils.unEnclose(offsetExpr.getSQL()));
}
}
if (sampleSize != 0) {
buff.append("\nSAMPLE_SIZE ").append(sampleSize);
}
if (isForUpdate) {
buff.append(" FOR UPDATE");
buff.append("\nFOR UPDATE");
}
return buff.toString();
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论