libenchao commented on code in PR #23849:
URL: https://github.com/apache/flink/pull/23849#discussion_r1416960738
##########
flink-table/flink-sql-gateway/src/test/java/org/apache/flink/table/gateway/service/SqlGatewayServiceStatementITCase.java:
##########
@@ -52,18 +59,49 @@
/** Test {@link SqlGatewayService}#executeStatement. */
public class SqlGatewayServiceStatementITCase extends
AbstractSqlGatewayStatementITCase {
- private final SessionEnvironment defaultSessionEnvironment =
+ private static final SessionEnvironment DEFAULT_SESSION_ENVIRONMENT =
+ SessionEnvironment.newBuilder()
+ .setSessionEndpointVersion(MockedEndpointVersion.V1)
+ .build();
+
+ private static final SessionEnvironment
SESSION_ENVIRONMENT_WITH_PLAN_CACHE_ENABLED =
SessionEnvironment.newBuilder()
.setSessionEndpointVersion(MockedEndpointVersion.V1)
+ .addSessionConfig(
+ Collections.singletonMap(
+
SQL_GATEWAY_SESSION_PLAN_CACHE_ENABLED.key(), "true"))
.build();
private SessionHandle sessionHandle;
+ @Parameters(name = "parameters={0}")
+ public static List<TestParameters> parameters() throws Exception {
+ return listFlinkSqlTests().stream()
+ .map(path -> new StatementTestParameters(path,
path.endsWith("repeated_dql.q")))
+ .collect(Collectors.toList());
+ }
+
@BeforeEach
@Override
public void before(@TempDir Path temporaryFolder) throws Exception {
super.before(temporaryFolder);
- sessionHandle = service.openSession(defaultSessionEnvironment);
+ SessionEnvironment sessionEnvironment =
+ isPlanCacheEnabled()
+ ? SESSION_ENVIRONMENT_WITH_PLAN_CACHE_ENABLED
+ : DEFAULT_SESSION_ENVIRONMENT;
+ sessionHandle = service.openSession(sessionEnvironment);
+ }
+
+ @AfterEach
+ public void after() {
+ if (isPlanCacheEnabled()) {
+ CacheStats cacheStats =
+ ((SqlGatewayServiceImpl) service)
+ .getSession(sessionHandle)
+ .getPlanCacheManager()
+ .getCacheStats();
+ assertThat(cacheStats).isEqualTo(new CacheStats(4, 14, 0, 0, 0,
0));
Review Comment:
I don't have a strong opinion on it, `repeated_dql.iq` is a dedicated test
for verifying cache, so it's ok to bind it with the test expectation.
--
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]