Skip to content

Commit

Permalink
address comments & add cast timestamp tests
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardBang committed Aug 6, 2024
1 parent fad65a7 commit 27d2f69
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -316,14 +316,13 @@ private static Java.Rvalue generateOtherFunctionOperation(
}

private static Java.Rvalue generateTimezoneFreeTemporalFunctionOperation(String operationName) {
List<Java.Rvalue> timestampFunctionParam = new ArrayList<>();
timestampFunctionParam.add(
new Java.AmbiguousName(Location.NOWHERE, new String[] {DEFAULT_EPOCH_TIME}));
return new Java.MethodInvocation(
Location.NOWHERE,
null,
StringUtils.convertToCamelCase(operationName),
timestampFunctionParam.toArray(new Java.Rvalue[0]));
new Java.Rvalue[] {
new Java.AmbiguousName(Location.NOWHERE, new String[] {DEFAULT_EPOCH_TIME})
});
}

private static Java.Rvalue generateTimezoneRequiredTemporalFunctionOperation(
Expand All @@ -346,19 +345,18 @@ private static Java.Rvalue generateTimezoneFreeTemporalConversionFunctionOperati
Location.NOWHERE,
null,
StringUtils.convertToCamelCase(operationName),
new ArrayList<>().toArray(new Java.Rvalue[0]));
new Java.Rvalue[0]);
}

private static Java.Rvalue generateTimezoneRequiredTemporalConversionFunctionOperation(
String operationName) {
List<Java.Rvalue> timestampFunctionParam = new ArrayList<>();
timestampFunctionParam.add(
new Java.AmbiguousName(Location.NOWHERE, new String[] {DEFAULT_TIME_ZONE}));
return new Java.MethodInvocation(
Location.NOWHERE,
null,
StringUtils.convertToCamelCase(operationName),
timestampFunctionParam.toArray(new Java.Rvalue[0]));
new Java.Rvalue[] {
new Java.AmbiguousName(Location.NOWHERE, new String[] {DEFAULT_TIME_ZONE})
});
}

private static Java.Rvalue generateTypeConvertMethod(
Expand Down Expand Up @@ -415,7 +413,10 @@ private static Java.Rvalue generateTypeConvertMethod(
Location.NOWHERE,
null,
"castToTimestamp",
timestampFunctionParam.toArray(new Java.Rvalue[0]));
new Java.Rvalue[] {
new Java.AmbiguousName(
Location.NOWHERE, new String[] {DEFAULT_TIME_ZONE})
});
default:
throw new ParseException(
"Unsupported data type cast: " + sqlDataTypeSpec.toString());
Expand Down
Loading

0 comments on commit 27d2f69

Please sign in to comment.