Copilot commented on code in PR #19909:
URL: https://github.com/apache/druid/pull/19909#discussion_r3736993811
##########
sql/src/test/java/org/apache/druid/sql/calcite/parser/DruidSqlParserUtilsTest.java:
##########
@@ -60,46 +61,36 @@ public class DruidSqlParserUtilsTest
/**
* Sanity checking that the formats of TIME_FLOOR(__time, Period) work as
expected
*/
- @RunWith(Parameterized.class)
- public static class TimeFloorToGranularityConversionTest
+ @Nested
+ public class TimeFloorToGranularityConversionTest
{
- @Parameterized.Parameters(name = "{1}")
public static Iterable<Object[]> constructorFeeder()
Review Comment:
`@Nested` inner test classes cannot declare non-constant `static` members;
the static `constructorFeeder()` here will not compile. Make the method
non-static and use `PER_CLASS` lifecycle so `@MethodSource` can reference the
instance factory method.
This issue also appears on line 91 of the same file.
##########
sql/src/test/java/org/apache/druid/sql/calcite/parser/DruidSqlParserUtilsTest.java:
##########
@@ -453,7 +452,8 @@ public void
testConvertSqlNodeToGranularityWithIncorrectIngestionGranularityInTi
}
}
- public static class NonParameterizedTests
+ @Nested
+ public class NonParameterizedTests
{
private static final DateTimeZone TZ_LOS_ANGELES =
DateTimes.inferTzFromString("America/Los_Angeles");
Review Comment:
This `@Nested` (non-static) inner class declares a non-constant `static`
field, which is illegal in Java and will not compile. Make it an instance
`final` field instead.
##########
sql/src/test/java/org/apache/druid/sql/calcite/rule/DruidLogicalValuesRuleTest.java:
##########
@@ -52,10 +51,9 @@ public class DruidLogicalValuesRuleTest
{
private static final PlannerContext DEFAULT_CONTEXT =
Mockito.mock(PlannerContext.class);
- @RunWith(Parameterized.class)
- public static class GetValueFromLiteralSimpleTypesTest extends
InitializedNullHandlingTest
+ @Nested
+ public class GetValueFromLiteralSimpleTypesTest extends
InitializedNullHandlingTest
Review Comment:
`@Nested` creates a non-static inner class, which cannot legally contain the
existing non-constant `static` helpers in this class (e.g., the
`constructorFeeder()` method and other static helpers below), causing
compilation to fail. Since those static helpers are already present, make this
a `static` nested class and remove `@Nested` instead.
This issue also appears on line 101 of the same file.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]