Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug that cast decimal or bool to other type #1152

Merged
merged 1 commit into from
May 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions fe/src/main/java/org/apache/doris/analysis/BoolLiteral.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ public int compareLiteral(LiteralExpr expr) {

@Override
public String toSqlImpl() {
return getStringValue();
return value ? "TRUE" : "FALSE";
}

@Override
public String getStringValue() {
return value ? "TRUE" : "FALSE";
return value ? "1" : "0";
}

@Override
Expand Down
10 changes: 10 additions & 0 deletions fe/src/main/java/org/apache/doris/analysis/DecimalLiteral.java
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,16 @@ public String getStringValue() {
return value.toString();
}

@Override
public long getLongValue() {
return value.longValue();
}

@Override
public double getDoubleValue() {
return value.doubleValue();
}

@Override
protected void toThrift(TExprNode msg) {
// TODO(hujie01) deal with loss information
Expand Down