Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ public static Expression log(DoubleLiteral first, DoubleLiteral second) {
if (first.getValue().equals(1.0d)) {
throw new NotSupportedException("the first input of function log can not be 1.0");
}
return checkOutputBoundary(new DoubleLiteral(Math.log(first.getValue()) / Math.log(second.getValue())));
return checkOutputBoundary(new DoubleLiteral(Math.log(second.getValue()) / Math.log(first.getValue())));
}

/**
Expand Down Expand Up @@ -1084,15 +1084,15 @@ public static Expression dpow(DoubleLiteral first, DoubleLiteral second) {
*/
@ExecFunction(name = "fmod")
public static Expression fmod(DoubleLiteral first, DoubleLiteral second) {
return checkOutputBoundary(new DoubleLiteral(first.getValue() / second.getValue()));
return checkOutputBoundary(new DoubleLiteral(first.getValue() % second.getValue()));
}

/**
* fmod
*/
@ExecFunction(name = "fmod")
public static Expression fmod(FloatLiteral first, FloatLiteral second) {
return new FloatLiteral(first.getValue() / second.getValue());
return new FloatLiteral(first.getValue() % second.getValue());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1691,14 +1691,20 @@ class Suite implements GroovyInterceptable {
String openFoldConstant = "set debug_skip_fold_constant=false";
sql(openFoldConstant)
logger.info(foldSql)
List<List<Object>> resultByFoldConstant = sql(foldSql)
Tuple2<List<List<Object>>, ResultSetMetaData> tupleResult = null
tupleResult = JdbcUtils.executeToStringList(context.getConnection(), foldSql)
def (resultByFoldConstant, meta) = tupleResult
logger.info("result by fold constant: " + resultByFoldConstant.toString())
String closeFoldConstant = "set debug_skip_fold_constant=true";
sql(closeFoldConstant)
logger.info(foldSql)
List<List<Object>> resultExpected = sql(foldSql)
logger.info("result expected: " + resultExpected.toString())
Assert.assertEquals(resultExpected, resultByFoldConstant)

String errorMsg = OutputUtils.checkOutput(resultExpected.iterator(), resultByFoldConstant.iterator(),
{ row -> OutputUtils.toCsvString(row as List<Object>) },
{ row -> OutputUtils.toCsvString(row) },
"check output failed", meta)
}

String getJobName(String dbName, String mtmvName) {
Expand Down
Loading
Loading