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
2 changes: 1 addition & 1 deletion .github/workflows/integ-tests-with-security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ windows-latest, macos-13 ]
os: [ windows-latest, macos-14 ]
java: [ 11, 17, 21 ]

runs-on: ${{ matrix.os }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/sql-test-and-build-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ jobs:
matrix:
entry:
- { os: windows-latest, java: 11, os_build_args: -x doctest -PbuildPlatform=windows }
- { os: macos-13, java: 11}
- { os: macos-14, java: 11, os_build_args: -x doctest }
- { os: windows-latest, java: 17, os_build_args: -x doctest -PbuildPlatform=windows }
- { os: macos-13, java: 17 }
- { os: macos-14, java: 17, os_build_args: -x doctest }
- { os: windows-latest, java: 21, os_build_args: -x doctest -PbuildPlatform=windows }
- { os: macos-13, java: 21 }
- { os: macos-14, java: 21, os_build_args: -x doctest }
runs-on: ${{ matrix.entry.os }}

steps:
Expand Down
2 changes: 1 addition & 1 deletion async-query-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
id 'jacoco'
id 'antlr'
id 'com.diffplug.spotless' version '6.22.0'
id 'com.github.johnrengelman.shadow'
id 'com.gradleup.shadow'
}

repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@

package org.opensearch.sql.expression.datetime;

import static java.time.temporal.ChronoField.ALIGNED_WEEK_OF_YEAR;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.opensearch.sql.data.type.ExprCoreType.LONG;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Locale;
import java.util.stream.Stream;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
Expand Down Expand Up @@ -96,15 +97,12 @@ public void testExtractDatePartWithTimeType() {

datePartWithTimeArgQuery("DAY", timeInput, now.getDayOfMonth());

// To avoid flaky test, skip the testing in December and January because the WEEK is ISO 8601
// week-of-week-based-year which is considered to start on a Monday and week 1 is the first week
// with >3 days. it is possible for early-January dates to be part of the 52nd or 53rd week of
// the previous year, and for late-December dates to be part of the first week of the next year.
// For example, 2005-01-02 is part of the 53rd week of year 2004, while 2012-12-31 is part of
// the first week of 2013
if (now.getMonthValue() != 1 && now.getMonthValue() != 12) {
datePartWithTimeArgQuery("WEEK", datetimeInput, now.get(ALIGNED_WEEK_OF_YEAR));
}
// Use the same week-of-year calculation as the EXTRACT function (DateTimeFormatter "w" with
// Locale.ENGLISH) to avoid flaky mismatches. ALIGNED_WEEK_OF_YEAR uses simple arithmetic
// (dayOfYear-1)/7+1 which diverges from the locale-aware week numbering on many dates.
long expectedWeek =
Long.parseLong(DateTimeFormatter.ofPattern("w", Locale.ENGLISH).format(now.atStartOfDay()));
datePartWithTimeArgQuery("WEEK", datetimeInput, expectedWeek);

datePartWithTimeArgQuery("MONTH", timeInput, now.getMonthValue());

Expand Down
Loading