Skip to content

Commit

Permalink
Remove function formatDatetime
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangfu0 committed May 23, 2020
1 parent 8d84161 commit cc89fe3
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,4 @@ static Long fromDateTime(String dateTimeString, String pattern) {
static Long now() {
return System.currentTimeMillis();
}

/**
* Return epoch millis value based on a given date time string and it's corresponding format.
*/
public static Long formatDatetime(String input, String format) {
return DateTimeFormat.forPattern(format).parseMillis(input);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ public static boolean containsFunctionByName(String funcName) {
FunctionRegistry.registerFunction(DateTimeFunctions.class.getDeclaredMethod("toDateTime", Long.class, String.class));
FunctionRegistry.registerFunction(DateTimeFunctions.class.getDeclaredMethod("fromDateTime", String.class, String.class));
FunctionRegistry.registerFunction(DateTimeFunctions.class.getDeclaredMethod("now"));
FunctionRegistry.registerFunction(DateTimeFunctions.class.getDeclaredMethod("formatDatetime", String.class, String.class));

FunctionRegistry.registerFunction(JsonFunctions.class.getDeclaredMethod("toJsonMapStr", Map.class));
} catch (NoSuchMethodException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1507,7 +1507,7 @@ public void testCompilationInvokedFunction() {
Assert.assertTrue(nowTs >= lowerBound);
Assert.assertTrue(nowTs <= upperBound);

query = "SELECT a FROM foo where time_col > formatDatetime('2020-01-01 UTC', 'yyyy-MM-dd z')";
query = "SELECT a FROM foo where time_col > fromDateTime('2020-01-01 UTC', 'yyyy-MM-dd z')";
pinotQuery = CalciteSqlParser.compileToPinotQuery(query);
greaterThan = pinotQuery.getFilterExpression().getFunctionCall();
nowTs = greaterThan.getOperands().get(1).getLiteral().getLongValue();
Expand Down

0 comments on commit cc89fe3

Please sign in to comment.