Skip to content

Commit 669ee3b

Browse files
committed
Add a unit test for direct format
- additionally rename parseRelativeTime to resolveTimeModifier Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
1 parent 6e4855e commit 669ee3b

3 files changed

Lines changed: 161 additions & 154 deletions

File tree

core/src/main/java/org/opensearch/sql/utils/DateTimeUtils.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ private static String normalizeUnit(String rawUnit) {
296296
}
297297

298298
/**
299-
* Convert a PPL time modifier expression to a <a
299+
* Translate a PPL time modifier expression to a <a
300300
* href="https://docs.opensearch.org/latest/field-types/supported-field-types/date/#date-math"
301301
* >OpenSearch date math expression</a>.
302302
*
@@ -310,11 +310,11 @@ private static String normalizeUnit(String rawUnit) {
310310
* <li>2020-12-10 12:00:00.123@month -> 2020-12-10T12:00:00.123Z/M
311311
* </ul>
312312
*
313-
* @param input The time string in PPL format
313+
* @param timeModifier The time modifier string in PPL format
314314
* @return The time string in OpenSearch date math format
315315
*/
316-
public static String parseRelativeTime(String input) {
317-
return parseRelativeTime(input, ZonedDateTime.now(ZoneOffset.UTC));
316+
public static String resolveTimeModifier(String timeModifier) {
317+
return resolveTimeModifier(timeModifier, ZonedDateTime.now(ZoneOffset.UTC));
318318
}
319319

320320
/**
@@ -326,7 +326,7 @@ public static String parseRelativeTime(String input) {
326326
* month then subtracting 0 to 2 months from it. In order to know how many months to subtract, it
327327
* is useful to know when is it now.
328328
*/
329-
static String parseRelativeTime(String input, ZonedDateTime nowReference) {
329+
static String resolveTimeModifier(String input, ZonedDateTime nowReference) {
330330
if (input == null || input.isEmpty()) {
331331
return null;
332332
}

0 commit comments

Comments
 (0)