Skip to content

Commit

Permalink
Merge pull request #1215 from RumbleDB/ghislainfourny-patch-1
Browse files Browse the repository at this point in the history
Fix bug in multiplication and addition native SQL
  • Loading branch information
ghislainfourny authored Jan 17, 2023
2 parents 5464cf1 + 6bea610 commit 1cdfc73
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ public NativeClauseContext generateNativeQuery(NativeClauseContext nativeClauseC
rightResult.getResultingType().isNumeric()
) {
if (!rightResult.getResultingType().isSubtypeOf(BuiltinTypesCatalogue.doubleItem)) {
rightQuery = "(CAST (" + leftQuery + " AS DOUBLE))";
rightQuery = "(CAST (" + rightQuery + " AS DOUBLE))";
}
resultType = BuiltinTypesCatalogue.doubleItem;
} else if (
Expand All @@ -456,7 +456,7 @@ public NativeClauseContext generateNativeQuery(NativeClauseContext nativeClauseC
rightResult.getResultingType().isNumeric()
) {
if (!rightResult.getResultingType().isSubtypeOf(BuiltinTypesCatalogue.floatItem)) {
rightQuery = "(CAST (" + leftQuery + " AS FLOAT))";
rightQuery = "(CAST (" + rightQuery + " AS FLOAT))";
}
resultType = BuiltinTypesCatalogue.floatItem;
} else if (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ public NativeClauseContext generateNativeQuery(NativeClauseContext nativeClauseC
rightResult.getResultingType().isNumeric()
) {
if (!rightResult.getResultingType().isSubtypeOf(BuiltinTypesCatalogue.doubleItem)) {
rightQuery = "(CAST (" + leftQuery + " AS DOUBLE))";
rightQuery = "(CAST (" + rightQuery + " AS DOUBLE))";
}
resultType = BuiltinTypesCatalogue.doubleItem;
} else if (
Expand All @@ -578,7 +578,7 @@ public NativeClauseContext generateNativeQuery(NativeClauseContext nativeClauseC
rightResult.getResultingType().isNumeric()
) {
if (!rightResult.getResultingType().isSubtypeOf(BuiltinTypesCatalogue.floatItem)) {
rightQuery = "(CAST (" + leftQuery + " AS FLOAT))";
rightQuery = "(CAST (" + rightQuery + " AS FLOAT))";
}
resultType = BuiltinTypesCatalogue.floatItem;
} else if (
Expand Down

0 comments on commit 1cdfc73

Please sign in to comment.