Fix bug that was adding extra commas for non-required computed
columns.
This commit is contained in:
@@ -347,23 +347,26 @@ public abstract class BuildVisitor implements ExpressionVisitor
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// iterate over the fields we're filling in and figure out whence each one comes
|
// iterate over the fields we're filling in and figure out whence each one comes
|
||||||
boolean skip = true;
|
boolean comma = false;
|
||||||
|
|
||||||
// while expanding column names in the SELECT query, do aliasing and expansion
|
// while expanding column names in the SELECT query, do aliasing and expansion
|
||||||
_enableAliasing = _enableOverrides = true;
|
_enableAliasing = _enableOverrides = true;
|
||||||
|
|
||||||
for (String field : selectClause.getFields()) {
|
for (String field : selectClause.getFields()) {
|
||||||
if (!skip) {
|
// write column to a temporary buffer
|
||||||
_builder.append(", ");
|
StringBuilder saved = _builder;
|
||||||
}
|
_builder = new StringBuilder();
|
||||||
skip = false;
|
|
||||||
|
|
||||||
int len = _builder.length();
|
|
||||||
appendRhsColumn(pClass, field);
|
appendRhsColumn(pClass, field);
|
||||||
|
String column = _builder.toString();
|
||||||
|
_builder = saved;
|
||||||
|
|
||||||
// if nothing was added, don't add a comma
|
// append if non-empty
|
||||||
if (_builder.length() == len) {
|
if (column.length() > 0) {
|
||||||
skip = true;
|
if (comma) {
|
||||||
|
_builder.append(", ");
|
||||||
|
}
|
||||||
|
comma = true;
|
||||||
|
_builder.append(column);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user