muttakin2301/ccr_train_1000 huggingface dataset:
Code review comment: BTW I'm already changing these here: https://github.com/apache/flink/pull/18770

Code before review:
static ValidationException lookupDisabled(ObjectIdentifier objectIdentifier) {
return new ValidationException(
String.format(
"The persisted plan does not include all required catalog metadata for table '%s'. "
+ "However, lookup is disabled because option '%s' = '%s'. "
+ "Either enable the catalog lookup with '%s' = '%s' / '%s' or "
+ "regenerate the plan with '%s' != '%s'. "
+ "Make sure the table is not compiled as a temporary table.",
objectIdentifier.asSummaryString(),
PLAN_RESTORE_CATALOG_OBJECTS.key(),
CatalogPlanRestore.ALL_ENFORCED.name(),
PLAN_RESTORE_CATALOG_OBJECTS.key(),
IDENTIFIER.name(),
CatalogPlanRestore.ALL.name(),
PLAN_COMPILE_CATALOG_OBJECTS.key(),
CatalogPlanCompilation.IDENTIFIER.name()));
}

Line under review: "The persisted plan does not include all required catalog metadata for table '%s'. "

Code after addressing the review:
static ValidationException lookupDisabled(ObjectIdentifier objectIdentifier) {
return new ValidationException(
String.format(
"The persisted plan does not include all required catalog metadata for table '%s'. "
+ "However, lookup is disabled because option '%s' = '%s'. "
+ "Either enable the catalog lookup with '%s' = '%s' / '%s' or "
+ "regenerate the plan with '%s' != '%s'. "
+ "Make sure the table is not compiled as a temporary table.",
objectIdentifier.asSummaryString(),
PLAN_RESTORE_CATALOG_OBJECTS.key(),
CatalogPlanRestore.ALL_ENFORCED.name(),
PLAN_RESTORE_CATALOG_OBJECTS.key(),
IDENTIFIER.name(),
CatalogPlanRestore.ALL.name(),
PLAN_COMPILE_CATALOG_OBJECTS.key(),
CatalogPlanCompilation.IDENTIFIER.name()));
}
Code review comment: It's `null != jobItemProgress` in if condition, but it use `jobItemInfo` here, it's not clear enough as before

Code before review:
public void init(final ShardingSphereDatabase database, final SQLStatement sqlStatement) {
List<InventoryIncrementalJobItemInfo> jobItemInfos = JOB_API.getJobItemInfos(((ShowMigrationStatusStatement) sqlStatement).getJobId());
data = jobItemInfos.stream().map(each -> {
MigrationJobItemInfo jobItemInfo = (MigrationJobItemInfo) each;
Collection<Object> result = new LinkedList<>();
result.add(jobItemInfo.getShardingItem());
InventoryIncrementalJobItemProgress jobItemProgress = jobItemInfo.getJobItemProgress();
if (null != jobItemProgress) {
result.add(jobItemProgress.getDataSourceName());
result.add(jobItemProgress.getStatus());
result.add(jobItemProgress.isActive() ? Boolean.TRUE.toString() : Boolean.FALSE.toString());
result.add(jobItemProgress.getProcessedRecordsCount());
result.add(jobItemInfo.getInventoryFinishedPercentage());
result.add(jobItemInfo.getIncrementalIdleSeconds());
} else {
result.add("");
result.add("");
result.add("");
result.add("");
result.add("");
result.add("");
}
result.add(jobItemInfo.getErrorMessage());
return result;
}).collect(Collectors.toList()).iterator();
}

Line under review: result.add(jobItemInfo.getIncrementalIdleSeconds());

Code after addressing the review:
public void init(final ShardingSphereDatabase database, final SQLStatement sqlStatement) {
long currentTimeMillis = System.currentTimeMillis();
List<InventoryIncrementalJobItemInfo> jobItemInfos = JOB_API.getJobItemInfos(((ShowMigrationStatusStatement) sqlStatement).getJobId());
data = jobItemInfos.stream().map(each -> {
Collection<Object> result = new LinkedList<>();
result.add(each.getShardingItem());
InventoryIncrementalJobItemProgress jobItemProgress = each.getJobItemProgress();
if (null != jobItemProgress) {
result.add(jobItemProgress.getDataSourceName());
result.add(jobItemProgress.getStatus());
result.add(jobItemProgress.isActive() ? Boolean.TRUE.toString() : Boolean.FALSE.toString());
result.add(jobItemProgress.getProcessedRecordsCount());
result.add(each.getInventoryFinishedPercentage());
String incrementalIdleSeconds = "";
if (jobItemProgress.getIncremental().getIncrementalLatestActiveTimeMillis() > 0) {
long latestActiveTimeMillis = Math.max(each.getStartTimeMillis(), jobItemProgress.getIncremental().getIncrementalLatestActiveTimeMillis());
incrementalIdleSeconds = String.valueOf(TimeUnit.MILLISECONDS.toSeconds(currentTimeMillis - latestActiveTimeMillis));
}
result.add(incrementalIdleSeconds);
} else {
result.add("");
result.add("");
result.add("");
result.add("");
result.add("");
result.add("");
}
result.add(each.getErrorMessage());
return result;
}).collect(Collectors.toList()).iterator();
}
Code review comment: Since I'm writing the scopes to the buffer on the fly, to write the scope count I'll have to start a brand new buffer and write to it. I felt like thats an overkill. WDYT?

Code before review:
private void writeTaintTable(ByteBuf buf, TaintTable taintTable) {
ByteBuf birbuf = Unpooled.buffer();
birbuf.writeShort(taintTable.rowCount);
birbuf.writeShort(taintTable.columnCount);
for (Integer paramIndex : taintTable.taintTable.keySet()) {
birbuf.writeShort(paramIndex);
List<Byte> taintRecord = taintTable.taintTable.get(paramIndex);
for (Byte taintStatus : taintRecord) {
birbuf.writeByte(taintStatus);
}
}
int length = birbuf.nioBuffer().limit();
buf.writeLong(length);
buf.writeBytes(birbuf.nioBuffer().array(), 0, length);
}

Line under review: birbuf.writeShort(taintTable.rowCount);

Code after addressing the review:
private void writeTaintTable(ByteBuf buf, TaintTable taintTable) {
ByteBuf birbuf = Unpooled.buffer();
birbuf.writeShort(taintTable.rowCount);
birbuf.writeShort(taintTable.columnCount);
birbuf.writeInt(taintTable.taintTable.size());
for (Integer paramIndex : taintTable.taintTable.keySet()) {
birbuf.writeShort(paramIndex);
List<Byte> taintRecord = taintTable.taintTable.get(paramIndex);
birbuf.writeInt(taintRecord.size());
for (Byte taintStatus : taintRecord) {
birbuf.writeByte(taintStatus);
}
}
int length = birbuf.nioBuffer().limit();
buf.writeLong(length);
buf.writeBytes(birbuf.nioBuffer().array(), 0, length);
}
Code review comment: Will this logic work for subtypes and referedTypes?

Code before review:
private boolean getTypeEquality(BType typeA, BType typeB) {
return typeA.tag == typeB.tag && Objects.equals(typeA.name, typeB.name);
}

Line under review: return typeA.tag == typeB.tag && Objects.equals(typeA.name, typeB.name);

Code after addressing the review:
private boolean getTypeEquality(BType typeA, BType typeB) {
return types.isAssignable(typeA, typeB) || types.isAssignable(typeB, typeA);
}
Code review comment: The directories should point to `balo` and `caches` here right?

Code before review:
public void testCleanCommand() {
CleanCommand cleanCommand = new CleanCommand(Paths.get(System.getProperty("user.dir")), false);
new CommandLine(cleanCommand).parse("--sourceroot", this.testResources.resolve("valid-project").toString());
cleanCommand.execute();
Path bin = this.testResources.resolve("valid-project").resolve(ProjectDirConstants.TARGET_DIR_NAME
+ File.separator + ProjectDirConstants.BIN_DIR_NAME);
Path balo = this.testResources.resolve("valid-project").resolve(ProjectDirConstants.TARGET_DIR_NAME
+ File.separator + ProjectDirConstants.BIN_DIR_NAME);
Path caches = this.testResources.resolve("valid-project").resolve(ProjectDirConstants.TARGET_DIR_NAME
+ File.separator + ProjectDirConstants.BIN_DIR_NAME);
Assert.assertFalse(Files.exists(bin), "Check if bin directory is deleted");
Assert.assertFalse(Files.exists(balo), "Check if balo directory is deleted");
Assert.assertFalse(Files.exists(caches), "Check if caches directory is deleted");
}

Line under review: + File.separator + ProjectDirConstants.BIN_DIR_NAME);

Code after addressing the review:
public void testCleanCommand() {
CleanCommand cleanCommand = new CleanCommand(Paths.get(System.getProperty("user.dir")), false);
new CommandLine(cleanCommand).parse("--sourceroot", this.testResources.resolve("valid-project").toString());
cleanCommand.execute();
Path bin = this.testResources.resolve("valid-project").resolve(ProjectDirConstants.TARGET_DIR_NAME
+ File.separator + ProjectDirConstants.BIN_DIR_NAME);
Path balo = this.testResources.resolve("valid-project").resolve(ProjectDirConstants.TARGET_DIR_NAME
+ File.separator + ProjectDirConstants.TARGET_BALO_DIRECTORY);
Path caches = this.testResources.resolve("valid-project").resolve(ProjectDirConstants.TARGET_DIR_NAME
+ File.separator + ProjectDirConstants.CACHES_DIR_NAME);
Assert.assertFalse(Files.exists(bin), "Check if bin directory is deleted");
Assert.assertFalse(Files.exists(balo), "Check if balo directory is deleted");
Assert.assertFalse(Files.exists(caches), "Check if caches directory is deleted");
}
Code review comment: Can do a substring instead? Let's also extract the substring logic out to a method.

Code before review:
public static Object call(BFunctionPointer<Object, Object> func, Object... args) {
BFunctionType functionType = (BFunctionType) func.getType();
List<Type> paramTypes = new LinkedList<>();
List<Type> argTypes = new LinkedList<>();
List<Object> argsList = new java.util.ArrayList<>(List.of(Scheduler.getStrand()));
if (checkIsValidPositionalArgs(args, argsList, functionType, paramTypes, argTypes) ||
checkIsValidRestArgs(args, argsList, functionType, paramTypes, argTypes)) {
Type restType =
functionType.restType != null ? ((BArrayType) functionType.restType).getElementType() : null;
throw ErrorCreator.createError(
getModulePrefixedReason(FUNCTION_LANG_LIB, INCOMPATIBLE_ARGUMENTS),
BLangExceptionHelper.getErrorDetails(RuntimeErrors.INCOMPATIBLE_ARGUMENTS,
new BTupleType(paramTypes, restType, 0, false)
.toString().replace("[", "").replace("]", ""),
new BTupleType(argTypes).toString().replace("[", "").replace("]", "")));
}
return func.asyncCall(argsList.toArray(), METADATA);
}

Line under review: new BTupleType(argTypes).toString().replace("[", "").replace("]", "")));

Code after addressing the review:
public static Object call(BFunctionPointer<Object, Object> func, Object... args) {
BFunctionType functionType = (BFunctionType) func.getType();
List<Type> paramTypes = new LinkedList<>();
List<Type> argTypes = new LinkedList<>();
List<Object> argsList = new java.util.ArrayList<>(List.of(Scheduler.getStrand()));
if (checkIsValidPositionalArgs(args, argsList, functionType, paramTypes, argTypes) ||
checkIsValidRestArgs(args, argsList, functionType, paramTypes, argTypes)) {
Type restType =
functionType.restType != null ? ((BArrayType) functionType.restType).getElementType() : null;
throw ErrorCreator.createError(
getModulePrefixedReason(FUNCTION_LANG_LIB, INCOMPATIBLE_ARGUMENTS),
BLangExceptionHelper.getErrorDetails(RuntimeErrors.INCOMPATIBLE_ARGUMENTS,
removeBracketsFromStringFormatOfTuple(new BTupleType(argTypes)),
removeBracketsFromStringFormatOfTuple(new BTupleType(paramTypes, restType, 0, false))));
}
return func.asyncCall(argsList.toArray(), METADATA);
}
Code review comment: Yeah, it'll be created in `createInner`, through `ensureDefaultPipDefinition`: https://github.com/Azure/azure-sdk-for-java/blob/654650746b7294af2f81457cde7db9afbbee76e2/sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/implementation/ApplicationGatewayImpl.java#L563-L573  Maybe we'll set pip sku to `STANDARD` here if it's not legacy gateway.

Code before review:
public void canCreateApplicationGatewayWithDefaultSku() {
String appGatewayName = generateRandomResourceName("agw", 15);
String appPublicIp = generateRandomResourceName("pip", 15);
PublicIpAddress pip =
networkManager
.publicIpAddresses()
.define(appPublicIp)
.withRegion(Region.US_EAST)
.withNewResourceGroup(rgName)
.withSku(PublicIPSkuType.STANDARD)
.withStaticIP()
.create();
ApplicationGateway appGateway =
networkManager
.applicationGateways()
.define(appGatewayName)
.withRegion(Region.US_EAST)
.withNewResourceGroup(rgName)
.defineRequestRoutingRule("rule1")
.fromPublicFrontend()
.fromFrontendHttpPort(80)
.toBackendHttpPort(8080)
.toBackendIPAddress("11.1.1.1")
.attach()
.withExistingPublicIpAddress(pip)
.create();
Assertions.assertEquals(ApplicationGatewayTier.BASIC, appGateway.tier());
Assertions.assertNotNull(appGateway.requestRoutingRules().get("rule1").priority());
}

Line under review: .withSku(PublicIPSkuType.STANDARD)

Code after addressing the review:
public void canCreateApplicationGatewayWithDefaultSku() {
String appGatewayName = generateRandomResourceName("agw", 15);
String appPublicIp = generateRandomResourceName("pip", 15);
PublicIpAddress pip =
networkManager
.publicIpAddresses()
.define(appPublicIp)
.withRegion(Region.US_EAST)
.withNewResourceGroup(rgName)
.withSku(PublicIPSkuType.STANDARD)
.withStaticIP()
.create();
ApplicationGateway appGateway =
networkManager
.applicationGateways()
.define(appGatewayName)
.withRegion(Region.US_EAST)
.withNewResourceGroup(rgName)
.defineRequestRoutingRule("rule1")
.fromPublicFrontend()
.fromFrontendHttpPort(80)
.toBackendHttpPort(8080)
.toBackendIPAddress("11.1.1.1")
.attach()
.withExistingPublicIpAddress(pip)
.create();
Assertions.assertEquals(ApplicationGatewayTier.BASIC, appGateway.tier());
Assertions.assertNotNull(appGateway.requestRoutingRules().get("rule1").priority());
}
Code review comment: Thanks for the review @dawidwys!  Hmm.. I think the current approach is better because:  1) The code is less and also simpler to understand.  2) The approach makes less assumption in the sense that it just prevents closeOnFlush() from being called recursively (which we know will lead to live lock).   In comparison, the alternative approach assumes that closeOnFlush() will never need to be called more than once for the same Channel), which may be true but is (IMO) not that obvious.  Is there any concern that we allow closeOnFlush() to be called multiple times for the same channel? If not, maybe it is better to take the simpler approach.

Code before review:
static void closeOnFlush(Channel channel) {
if (channel.isConnected() && !channelsBeingClosed.containsKey(channel)) {
channelsBeingClosed.put(channel, channel);
channel.write(ChannelBuffers.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE);
channelsBeingClosed.remove(channel);
}
}

Line under review: }

Code after addressing the review:
static void closeOnFlush(Channel channel) {
if (channel.isConnected() && !channelsBeingClosed.contains(channel)) {
channelsBeingClosed.add(channel);
channel.write(ChannelBuffers.EMPTY_BUFFER).addListener(CLOSE_WITH_BOOKKEEPING);
}
}
Code review comment: The original `Uni` is never cached by the extension. What is cached is an [UnresolvedUniValue](https://github.com/quarkusio/quarkus/blob/main/extensions/cache/runtime/src/main/java/io/quarkus/cache/runtime/UnresolvedUniValue.java) at first which is then replaced with the actual item emitted by the original `Uni` once it's been resolved. After that, when the cached value is accessed, a `Uni.createFrom().item(theResolvedValue)` is returned.  This is another part of the doc update I'm working on 😄 

Code before review:
void testCacheResult() {
Uni<String> uni1 = cachedService.cacheResult1(KEY_1);
assertEquals(0, cachedService.getCacheResultInvocations());
Uni<String> uni2 = cachedService.cacheResult1(KEY_1);
assertEquals(0, cachedService.getCacheResultInvocations());
assertNotSame(uni1, uni2);
String emittedItem1 = uni1.await().indefinitely();
assertEquals(1, cachedService.getCacheResultInvocations());
String emittedItem2 = uni2.await().indefinitely();
assertEquals(1, cachedService.getCacheResultInvocations());
assertSame(emittedItem1, emittedItem2);
String emittedItem3 = cachedService.cacheResult1("another-key").await().indefinitely();
assertEquals(2, cachedService.getCacheResultInvocations());
assertNotSame(emittedItem2, emittedItem3);
}


Code after addressing the review:
void testCacheResult() {
Uni<String> uni1 = cachedService.cacheResult1(KEY_1);
assertEquals(0, cachedService.getCacheResultInvocations());
Uni<String> uni2 = cachedService.cacheResult1(KEY_1);
assertEquals(0, cachedService.getCacheResultInvocations());
assertNotSame(uni1, uni2);
String emittedItem1 = uni1.await().indefinitely();
assertEquals(1, cachedService.getCacheResultInvocations());
String emittedItem2 = uni2.await().indefinitely();
assertEquals(1, cachedService.getCacheResultInvocations());
assertSame(emittedItem1, emittedItem2);
String emittedItem3 = cachedService.cacheResult1("another-key").await().indefinitely();
assertEquals(2, cachedService.getCacheResultInvocations());
assertNotSame(emittedItem2, emittedItem3);
}
Code review comment: This change makes error message not clear as before, right?

Code before review:
public RexNode convertResolvedLiteral(ResolvedLiteral resolvedLiteral) {
TypeKind kind = resolvedLiteral.getType().getKind();
RexNode ret;
switch (kind) {
case TYPE_BOOL:
case TYPE_INT32:
case TYPE_INT64:
case TYPE_FLOAT:
case TYPE_DOUBLE:
case TYPE_STRING:
case TYPE_TIMESTAMP:
case TYPE_DATE:
case TYPE_TIME:
case TYPE_BYTES:
case TYPE_ARRAY:
case TYPE_STRUCT:
case TYPE_ENUM:
ret = convertValueToRexNode(resolvedLiteral.getType(), resolvedLiteral.getValue());
break;
default:
throw new RuntimeException("Unsupported ResolvedLiteral type.");
}
return ret;
}

Line under review: throw new RuntimeException("Unsupported ResolvedLiteral type.");

Code after addressing the review:
public RexNode convertResolvedLiteral(ResolvedLiteral resolvedLiteral) {
TypeKind kind = resolvedLiteral.getType().getKind();
RexNode ret;
switch (kind) {
case TYPE_BOOL:
case TYPE_INT32:
case TYPE_INT64:
case TYPE_FLOAT:
case TYPE_DOUBLE:
case TYPE_STRING:
case TYPE_TIMESTAMP:
case TYPE_DATE:
case TYPE_TIME:
case TYPE_BYTES:
case TYPE_ARRAY:
case TYPE_STRUCT:
case TYPE_ENUM:
ret = convertValueToRexNode(resolvedLiteral.getType(), resolvedLiteral.getValue());
break;
default:
throw new RuntimeException(
MessageFormat.format(
"Unsupported ResolvedLiteral type: {0}, kind: {1}, value: {2}, class: {3}",
resolvedLiteral.getType().typeName(),
kind,
resolvedLiteral.getValue(),
resolvedLiteral.getClass()));
}
return ret;
}
Code review comment: sorry, actually this cannot be synchronized (either using this or isReady). Because synchronized block will block other thread's same synchronized block. Here it will wait for signal indefinitely and cause deadlock.

Code before review:
public void testCloseVisibleToAwaitCompletionCallerAndProducer() throws Exception {
BeamFnDataInboundObserver observer =
BeamFnDataInboundObserver.forConsumers(
Arrays.asList(DataEndpoint.create(TRANSFORM_ID, CODER, (value) -> {})),
Collections.emptyList());
AtomicBoolean isReady = new AtomicBoolean(false);
Future<?> future =
executor.submit(
() -> {
observer.accept(dataWith("ABC"));
synchronized (isReady) {
isReady.set(true);
isReady.notify();
}
assertThrows(
BeamFnDataInboundObserver.CloseException.class,
() -> {
while (true) {
observer.accept(dataWith("ABC"));
}
});
return null;
});
Future<?> future2 =
executor.submit(
() -> {
synchronized (isReady) {
while (!isReady.get()) {
isReady.wait();
}
}
observer.close();
return null;
});
assertThrows(BeamFnDataInboundObserver.CloseException.class, () -> observer.awaitCompletion());
future.get();
future2.get();
}

Line under review: synchronized (isReady) {

Code after addressing the review:
public void testCloseVisibleToAwaitCompletionCallerAndProducer() throws Exception {
BeamFnDataInboundObserver observer =
BeamFnDataInboundObserver.forConsumers(
Arrays.asList(DataEndpoint.create(TRANSFORM_ID, CODER, (value) -> {})),
Collections.emptyList());
AtomicBoolean isReady = new AtomicBoolean(false);
Future<?> future =
executor.submit(
() -> {
observer.accept(dataWith("ABC"));
synchronized (isReady) {
isReady.set(true);
isReady.notify();
}
assertThrows(
BeamFnDataInboundObserver.CloseException.class,
() -> {
while (true) {
observer.accept(dataWith("ABC"));
}
});
return null;
});
Future<?> future2 =
executor.submit(
() -> {
synchronized (isReady) {
while (!isReady.get()) {
isReady.wait();
}
}
observer.close();
return null;
});
assertThrows(BeamFnDataInboundObserver.CloseException.class, () -> observer.awaitCompletion());
future.get();
future2.get();
}
Code review comment: nit: I feel like splitting up ZK paths is also something that should go into ZooKeeperUtils analogously to generating the path.

Code before review:
private void handleChangedLeaderInformation(ChildData childData) {
if (running.get() && leaderLatch.hasLeadership() && isConnectionInfoNode(childData)) {
final String path = childData.getPath();
final String[] splits = path.split("/");
Preconditions.checkState(
splits.length >= 2,
String.format(
"Expecting path consisting of <leader_name>/connection_info. Got path '%s'",
path));
final String leaderName = splits[splits.length - 2];
final LeaderInformation leaderInformation =
tryReadingLeaderInformation(childData, leaderName);
leaderElectionListener.notifyLeaderInformationChange(leaderName, leaderInformation);
}
}

Line under review: final String[] splits = path.split("/");

Code after addressing the review:
private void handleChangedLeaderInformation(ChildData childData) {
if (shouldHandleLeaderInformationEvent(childData.getPath())) {
final String leaderName = extractLeaderName(childData.getPath());
final LeaderInformation leaderInformation =
tryReadingLeaderInformation(childData, leaderName);
leaderElectionListener.notifyLeaderInformationChange(leaderName, leaderInformation);
}
}
Code review comment: why are you changing this?

Code before review:
private static Configuration getConfiguration() {
Configuration configuration = new Configuration();
configuration.set(KubernetesConfigOptions.CLUSTER_ID, CLUSTER_ID);
configuration.set(
HighAvailabilityOptions.HA_MODE,
KubernetesHaServicesFactory.class.getCanonicalName());
try {
temporaryPath = Files.createTempDirectory("haStorage");
} catch (IOException e) {
throw new RuntimeException("can't create ha storage path.");
}
configuration.set(
HighAvailabilityOptions.HA_STORAGE_PATH, temporaryPath.toAbsolutePath().toString());
return configuration;
}

Line under review: throw new RuntimeException("can't create ha storage path.");

Code after addressing the review:
private static Configuration getConfiguration() {
Configuration configuration = new Configuration();
configuration.set(KubernetesConfigOptions.CLUSTER_ID, CLUSTER_ID);
configuration.set(
HighAvailabilityOptions.HA_MODE,
KubernetesHaServicesFactory.class.getCanonicalName());
try {
temporaryPath = Files.createTempDirectory("haStorage");
} catch (IOException e) {
throw new FlinkRuntimeException("Failed to create HA storage", e);
}
configuration.set(
HighAvailabilityOptions.HA_STORAGE_PATH, temporaryPath.toAbsolutePath().toString());
return configuration;
}
Code review comment: use Arrays.asList instead of deps to Guava

Code before review:
public void testSimpleTableSelect() {
Table t1 = tEnv.fromValues(1, 2, 3).as("f1");
tEnv.createTemporaryView("t1", t1);
tEnv.createTemporaryFunction("func", new AsyncFunc());
final List<Row> results = executeSql("select func(f1) from t1");
final List<Row> expectedRows =
ImmutableList.of(Row.of("val 1"), Row.of("val 2"), Row.of("val 3"));
assertThat(results).containsSequence(expectedRows);
}

Line under review: ImmutableList.of(Row.of("val 1"), Row.of("val 2"), Row.of("val 3"));

Code after addressing the review:
public void testSimpleTableSelect() {
Table t1 = tEnv.fromValues(1, 2, 3).as("f1");
tEnv.createTemporaryView("t1", t1);
tEnv.createTemporarySystemFunction("func", new AsyncFunc());
final List<Row> results = executeSql("select func(f1) from t1");
final List<Row> expectedRows =
Arrays.asList(Row.of("val 1"), Row.of("val 2"), Row.of("val 3"));
assertThat(results).containsSequence(expectedRows);
}
Code review comment: I see your point, but I think that preventing the users from creating the project just because the wrapper is missing will be more of a problem than (slightly) incorrect instructions. I am willing to bet that most users will understand that Maven wrapper is missing once they do `./mvnw ...` and get the generic OS error message.  WDYT?

Code before review:
private void createMavenWrapper() {
try {
executeMojo(
plugin(
groupId("io.takari"),
artifactId("maven"),
version(MojoUtils.getMavenWrapperVersion())),
goal("wrapper"),
configuration(
element(name("maven"), MojoUtils.getProposedMavenVersion())),
executionEnvironment(
project,
session,
pluginManager));
} catch (Exception e) {
getLog().debug("Unable to create Maven Wrapper");
}
}

Line under review: getLog().debug("Unable to create Maven Wrapper");

Code after addressing the review:
private void createMavenWrapper() {
try {
executeMojo(
plugin(
groupId("io.takari"),
artifactId("maven"),
version(MojoUtils.getMavenWrapperVersion())),
goal("wrapper"),
configuration(
element(name("maven"), MojoUtils.getProposedMavenVersion())),
executionEnvironment(
project,
session,
pluginManager));
} catch (Exception e) {
getLog().error("Unable to install the Maven wrapper (./mvnw) in the project");
}
}
Code review comment: I think we could create two TM pods and verify that getting the jobmanager deployment should only happen once.

Code before review:
public CompletableFuture<Void> createTaskManagerPod(KubernetesPod kubernetesPod) {
if (masterDeployment == null) {
masterDeployment =
this.internalClient
.apps()
.deployments()
.withName(KubernetesUtils.getDeploymentName(clusterId))
.get();
}
return CompletableFuture.runAsync(
() -> {
if (masterDeployment == null) {
throw new RuntimeException(
"Failed to find Deployment named "
+ clusterId
+ " in namespace "
+ this.namespace);
}
setOwnerReference(
masterDeployment,
Collections.singletonList(kubernetesPod.getInternalResource()));
LOG.debug(
"Start to create pod with spec {}{}",
System.lineSeparator(),
KubernetesUtils.tryToGetPrettyPrintYaml(
kubernetesPod.getInternalResource()));
this.internalClient.pods().create(kubernetesPod.getInternalResource());
},
kubeClientExecutorService);
}

Line under review: masterDeployment =

Code after addressing the review:
public CompletableFuture<Void> createTaskManagerPod(KubernetesPod kubernetesPod) {
return CompletableFuture.runAsync(
() -> {
if (masterDeploymentRef.get() == null) {
final Deployment masterDeployment =
this.internalClient
.apps()
.deployments()
.withName(KubernetesUtils.getDeploymentName(clusterId))
.get();
if (masterDeployment == null) {
throw new RuntimeException(
"Failed to find Deployment named "
+ clusterId
+ " in namespace "
+ this.namespace);
}
masterDeploymentRef.compareAndSet(null, masterDeployment);
}
setOwnerReference(
checkNotNull(masterDeploymentRef.get()),
Collections.singletonList(kubernetesPod.getInternalResource()));
LOG.debug(
"Start to create pod with spec {}{}",
System.lineSeparator(),
KubernetesUtils.tryToGetPrettyPrintYaml(
kubernetesPod.getInternalResource()));
this.internalClient.pods().create(kubernetesPod.getInternalResource());
},
kubeClientExecutorService);
}
Code review comment: ```suggestion                     .allMatch(bVarSymbol -> bVarSymbol.defaultableParam)) { ```

Code before review:
private boolean checkFillerValue(BObjectType type) {
BAttachedFunction initFunction = ((BObjectTypeSymbol) type.tsymbol).initializerFunc;
if (initFunction == null) {
if ((type.tsymbol.flags & Flags.ABSTRACT) == Flags.ABSTRACT) {
return false;
}
} else {
if (initFunction.symbol.getReturnType().getKind() == TypeKind.ERROR) {
return false;
}
if (!hasFillerValue(initFunction.symbol.getReturnType())) {
return false;
}
if (!initFunction.symbol.getParameters().stream()
.allMatch(bVarSymbol -> bVarSymbol.defaultableParam == true)) {
return false;
}
}
return true;
}

Line under review: .allMatch(bVarSymbol -> bVarSymbol.defaultableParam == true)) {

Code after addressing the review:
private boolean checkFillerValue(BObjectType type) {
if ((type.tsymbol.flags & Flags.ABSTRACT) == Flags.ABSTRACT) {
return false;
}
BAttachedFunction initFunction = ((BObjectTypeSymbol) type.tsymbol).initializerFunc;
if (initFunction == null) {
return true;
}
if (initFunction.symbol.getReturnType().getKind() != TypeKind.NIL) {
return false;
}
for (BVarSymbol bVarSymbol : initFunction.symbol.getParameters()) {
if (!bVarSymbol.defaultableParam) {
return false;
}
}
return true;
}
Code review comment: Here is a code snipet to capture a duplicated context, and create if needed: ```java  private Context captureTheRightContext(Vertx vertx) {         Context context = Vertx.currentContext();         if (context == null) {             // Create both a root and a duplicated context             context = ((ContextInternal) vertx.getOrCreateContext()).duplicate();         } else {             if (isRootContext(context)) {                 context = ((ContextInternal) context).duplicate();             }         }         return context;     }      private boolean isRootContext(Context context) {         return context instanceof EventLoopContext || context instanceof WorkerContext;     } ```

Code before review:
public String uri() {
return httpRequest.uri();
}

Line under review: return httpRequest.uri();

Code after addressing the review:
public String uri() {
return httpRequest.uri();
}
Code review comment: @sberyozkin I can add something like that, but I can't imagine how could it happen, you see:  - default token state manager has lesser priority, so it's not used - we assert that token state is in the database (before =1 after =0) (that's exactly the `assertTokenStateCount` you are commenting on), and it simply can't be that 2 token state managers are used due to how CDI works  Anyway, if you are convinced it is needed, I'll do that.

Code before review:
public void testCodeFlow() throws IOException {
try (final WebClient webClient = createWebClient()) {
TextPage textPage = webClient.getPage(url.toString() + "unprotected");
assertEquals("unprotected", textPage.getContent());
HtmlPage page;
page = webClient.getPage(url.toString() + "protected");
assertEquals("Sign in to quarkus", page.getTitleText());
HtmlForm loginForm = page.getForms().get(0);
loginForm.getInputByName("username").setValueAttribute("alice");
loginForm.getInputByName("password").setValueAttribute("alice");
textPage = loginForm.getInputByName("login").click();
assertEquals("alice", textPage.getContent());
assertTokenStateCount(1);
webClient.getOptions().setRedirectEnabled(false);
WebResponse webResponse = webClient
.loadWebResponse(new WebRequest(URI.create(url.toString() + "protected/logout").toURL()));
assertEquals(302, webResponse.getStatusCode());
assertNull(webClient.getCookieManager().getCookie("q_session"));
webClient.getCookieManager().clearCookies();
assertTokenStateCount(0);
}
}

Line under review: assertTokenStateCount(1);

Code after addressing the review:
public void testCodeFlow() throws IOException {
try (final WebClient webClient = createWebClient()) {
TextPage textPage = webClient.getPage(url.toString() + "unprotected");
assertEquals("unprotected", textPage.getContent());
HtmlPage page;
page = webClient.getPage(url.toString() + "protected");
assertEquals("Sign in to quarkus", page.getTitleText());
HtmlForm loginForm = page.getForms().get(0);
loginForm.getInputByName("username").setValueAttribute("alice");
loginForm.getInputByName("password").setValueAttribute("alice");
textPage = loginForm.getInputByName("login").click();
assertEquals("alice", textPage.getContent());
assertTokenStateCount(1);
webClient.getOptions().setRedirectEnabled(false);
WebResponse webResponse = webClient
.loadWebResponse(new WebRequest(URI.create(url.toString() + "protected/logout").toURL()));
assertEquals(302, webResponse.getStatusCode());
assertNull(webClient.getCookieManager().getCookie("q_session"));
webClient.getCookieManager().clearCookies();
assertTokenStateCount(0);
}
}
Code review comment: Builder construction is not expected to be expensive, i.e. this should not be called until `build()`. Here it should only set the flag.

Code before review:
public BeamSqlEnvBuilder loadUdfUdafFromProvider() {
ServiceLoader.<UdfUdafProvider>load(UdfUdafProvider.class)
.forEach(
ins -> {
ins.getBeamSqlUdfs().forEach((udfName, udfClass) -> registerUdf(udfName, udfClass));
ins.getSerializableFunctionUdfs()
.forEach((udfName, udfFn) -> registerUdf(udfName, udfFn));
ins.getUdafs().forEach((udafName, udafFn) -> registerUdaf(udafName, udafFn));
});
return this;
}

Line under review: ServiceLoader.<UdfUdafProvider>load(UdfUdafProvider.class)

Code after addressing the review:
public BeamSqlEnvBuilder loadUdfUdafFromProvider() {
ServiceLoader.<UdfUdafProvider>load(UdfUdafProvider.class)
.forEach(
ins -> {
ins.getBeamSqlUdfs().forEach((udfName, udfClass) -> registerUdf(udfName, udfClass));
ins.getSerializableFunctionUdfs()
.forEach((udfName, udfFn) -> registerUdf(udfName, udfFn));
ins.getUdafs().forEach((udafName, udafFn) -> registerUdaf(udafName, udafFn));
});
return this;
}
Code review comment: do no-op on this. Thanks for the explanation.

Code before review:
private Mac getMacInstance() {
int masterKeyLatestHashCode = this.cosmosKeyCredential.getMasterKey().hashCode();
if (masterKeyLatestHashCode != this.masterKeyHashCode) {
byte[] masterKeyBytes = this.cosmosKeyCredential.getMasterKey().getBytes();
byte[] masterKeyDecodedBytes = Utils.Base64Decoder.decode(masterKeyBytes);
SecretKey signingKey = new SecretKeySpec(masterKeyDecodedBytes, "HMACSHA256");
try {
Mac macInstance = Mac.getInstance("HMACSHA256");
macInstance.init(signingKey);
this.masterKeyHashCode = masterKeyLatestHashCode;
return macInstance;
} catch (NoSuchAlgorithmException | InvalidKeyException e) {
throw new IllegalStateException(e);
}
} else {
try {
return (Mac)this.macInstance.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException(e);
}
}
}

Line under review: int masterKeyLatestHashCode = this.cosmosKeyCredential.getMasterKey().hashCode();

Code after addressing the review:
private Mac getMacInstance() {
int masterKeyLatestHashCode = this.cosmosKeyCredential.keyHashCode();
if (masterKeyLatestHashCode != this.masterKeyHashCode) {
byte[] masterKeyBytes = this.cosmosKeyCredential.key().getBytes();
byte[] masterKeyDecodedBytes = Utils.Base64Decoder.decode(masterKeyBytes);
SecretKey signingKey = new SecretKeySpec(masterKeyDecodedBytes, "HMACSHA256");
try {
Mac macInstance = Mac.getInstance("HMACSHA256");
macInstance.init(signingKey);
this.masterKeyHashCode = masterKeyLatestHashCode;
return macInstance;
} catch (NoSuchAlgorithmException | InvalidKeyException e) {
throw new IllegalStateException(e);
}
} else {
try {
return (Mac)this.macInstance.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException(e);
}
}
}
Code review comment: I would love to, and in both MongoDB and Hibernate Panache! I'll open an issue for it so we will see if someone else would love it :)

Code before review:
public CompletionStage<Void> deleteBook(@PathParam("id") String id) {
return ReactiveBookEntity.findById(new ObjectId(id)).thenCompose(book -> book.delete());
}

Line under review: return ReactiveBookEntity.findById(new ObjectId(id)).thenCompose(book -> book.delete());

Code after addressing the review:
public CompletionStage<Void> deleteBook(@PathParam("id") String id) {
return ReactiveBookEntity.findById(new ObjectId(id)).thenCompose(book -> book.delete());
}
Code review comment: You'll want to remove this before merging as live tests will fail. I've seen something similar to this in multiple project, mind filing an issue to add infrastructure to `azure-core-test` which allows enables test proxying when an environment variable is set. #Resolved

Code before review:
ContainerRegistryClientBuilder getContainerRegistryBuilder(HttpClient httpClient) {
Configuration configuration = new Configuration()
.put("java.net.useSystemProxies", "true")
.put("http.proxyHost", "localhost")
.put("http.proxyPort", "8888")
.put("http.proxyUser", "1")
.put("http.proxyPassword", "1");
List<Function<String, String>> redactors = new ArrayList<>();
redactors.add(data -> redact(data, JSON_PROPERTY_VALUE_REDACTION_PATTERN.matcher(data), "REDACTED"));
ContainerRegistryClientBuilder builder = new ContainerRegistryClientBuilder()
.endpoint(getEndpoint())
.configuration(configuration)
.httpClient(httpClient == null ? interceptorManager.getPlaybackClient() : httpClient)
.httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY))
.addPolicy(interceptorManager.getRecordPolicy(redactors));
if (getTestMode() == TestMode.PLAYBACK) {
builder.credential(new FakeCredentials());
} else {
builder.credential(new DefaultAzureCredentialBuilder().build());
}
return builder;
}

Line under review: .put("http.proxyPassword", "1");

Code after addressing the review:
ContainerRegistryClientBuilder getContainerRegistryBuilder(HttpClient httpClient) {
List<Function<String, String>> redactors = new ArrayList<>();
redactors.add(data -> redact(data, JSON_PROPERTY_VALUE_REDACTION_PATTERN.matcher(data), "REDACTED"));
ContainerRegistryClientBuilder builder = new ContainerRegistryClientBuilder()
.endpoint(getEndpoint())
.httpClient(httpClient == null ? interceptorManager.getPlaybackClient() : httpClient)
.httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY))
.addPolicy(interceptorManager.getRecordPolicy(redactors));
if (getTestMode() == TestMode.PLAYBACK) {
builder.credential(new FakeCredentials());
} else {
builder.credential(new DefaultAzureCredentialBuilder().build());
}
return builder;
}
Code review comment: My original idea of the contract was: higher priority wins but other ``AutoAddScopeBuildItem``s can log a warning or throw an exception.   And if a scope was added in another transformer before ``AutoAddScopeBuildItem``s are processed then just log a debug message (note that all ``AutoAddScopeBuildItem``s are processed in one annotation transformer.)

Code before review:
public void transform(TransformationContext context) {
ClassInfo clazz = context.getTarget().asClass();
if (scopes.isScopeDeclaredOn(clazz)) {
return;
}
DotName scope = scopes.getScope(context.getAnnotations()).map(AnnotationInstance::name).orElse(null);
if (scope != null) {
LOGGER.debugf("Scope %s was already added by another annotation transformer", scope);
return;
}
Boolean requiresContainerServices = null;
String reason = null;
for (AutoAddScopeBuildItem autoScope : sortedAutoScopes) {
if (autoScope.isContainerServicesRequired()) {
if (requiresContainerServices == null) {
requiresContainerServices = requiresContainerServices(clazz, containerAnnotationNames,
beanArchiveIndex.getIndex());
}
if (!requiresContainerServices) {
continue;
}
}
if (autoScope.test(clazz, context.getAnnotations(), beanArchiveIndex.getIndex())) {
if (scope != null) {
LOGGER.debugf("Scope %s was already added for reason: %s", scope, reason);
continue;
}
scope = autoScope.getDefaultScope();
reason = autoScope.getReason();
context.transform().add(scope).done();
if (autoScope.isUnremovable()) {
unremovables.add(clazz.name());
}
LOGGER.debugf("Automatically added scope %s to class %s: %s", scope, clazz, autoScope.getReason());
break;
}
}
}

Line under review: LOGGER.debugf("Scope %s was already added for reason: %s", scope, reason);

Code after addressing the review:
public void transform(TransformationContext context) {
if (scopes.isScopeIn(context.getAnnotations())) {
return;
}
ClassInfo clazz = context.getTarget().asClass();
DotName scope = null;
Boolean requiresContainerServices = null;
String reason = null;
for (AutoAddScopeBuildItem autoScope : sortedAutoScopes) {
if (autoScope.isContainerServicesRequired()) {
if (requiresContainerServices == null) {
requiresContainerServices = requiresContainerServices(clazz, containerAnnotationNames,
beanArchiveIndex.getIndex());
}
if (!requiresContainerServices) {
continue;
}
}
if (autoScope.test(clazz, context.getAnnotations(), beanArchiveIndex.getIndex())) {
if (scope != null) {
BiConsumer<DotName, String> consumer = autoScope.getScopeAlreadyAdded();
if (consumer != null) {
consumer.accept(scope, reason);
} else {
LOGGER.debugf("Scope %s was already added for reason: %s", scope, reason);
}
continue;
}
scope = autoScope.getDefaultScope();
reason = autoScope.getReason();
context.transform().add(scope).done();
if (autoScope.isUnremovable()) {
unremovables.add(clazz.name());
}
LOGGER.debugf("Automatically added scope %s to class %s: %s", scope, clazz, autoScope.getReason());
}
}
}
Code review comment: just to note - make sure inner().retentionPolicy() is initialized before accessing its properties (`withEnabled(..))

Code before review:
public Update withRetentionPolicyEnabled() {
this.inner().retentionPolicy().withEnabled(true);
return this;
}

Line under review: return this;

Code after addressing the review:
public Update withRetentionPolicyEnabled() {
ensureRetentionPolicy();
this.inner().retentionPolicy().withEnabled(true);
return this;
}
Code review comment: `outputCompletedElements` is called after an element has been completed by the asyncUserFunction. Only at that point, the queue entries have actually a changed state. There is no other code path that can actually make any queue entry completed. So consuming the queue at any other location will not yield a different result.  The only other way an item can be actually be completed is if we insert a watermark into an empty queue, as watermarks are always completed.

Code before review:
private ResultFuture<OUT> addToWorkQueue(StreamElement streamElement) throws InterruptedException {
assert(Thread.holdsLock(checkpointingLock));
pendingStreamElement = streamElement;
Optional<ResultFuture<OUT>> queueEntry;
while (!(queueEntry = queue.tryPut(streamElement)).isPresent()) {
mailboxExecutor.yield();
}
pendingStreamElement = null;
return queueEntry.get();
}

Line under review: assert(Thread.holdsLock(checkpointingLock));

Code after addressing the review:
private ResultFuture<OUT> addToWorkQueue(StreamElement streamElement) throws InterruptedException {
assert(Thread.holdsLock(checkpointingLock));
Optional<ResultFuture<OUT>> queueEntry;
while (!(queueEntry = queue.tryPut(streamElement)).isPresent()) {
mailboxExecutor.yield();
}
return queueEntry.get();
}
Code review comment: The most risky bug in this code is: Incorrect logic in the `checkComplexTypeInvalid` function may lead to incorrect pruning of columns based on their types and access paths, potentially causing data integrity issues or incorrect query results.  You can modify the code like this: ```java +            if (checkComplexTypeInvalid(scan, column)) { -                continue; +                // Depending on your intended logic, either handle the invalid state or correct the condition. +                // For example, removing 'continue;' may skip the erroneous skipping of process for certain columns, +                // but ensure to validate the desired behavior and adjust the method implementation accordingly.              } ```  And ensure that `checkComplexTypeInvalid` accurately reflects the intended logic, especially regarding the conditions under which a complex type is considered "invalid" for pruning. The current logic suggests a column is deemed invalid if all children have the `TAccessPathType.OFFSET` type, but the real intention might necessitate revising these checks or clarifying the conditions that define an invalid state for processing in this context.

Code before review:
private void collectPredicate(Operator operator, DecodeInfo info) {
if (operator.getPredicate() == null) {
return;
}
DictExpressionCollector dictExpressionCollector = new DictExpressionCollector(info.outputStringColumns);
dictExpressionCollector.collect(operator.getPredicate());
info.outputStringColumns.getStream().forEach(c -> {
List<ScalarOperator> expressions = dictExpressionCollector.getDictExpressions(c);
if (!expressions.isEmpty()) {
stringExpressions.computeIfAbsent(c, l -> Lists.newArrayList()).addAll(expressions);
}
});
}

Line under review: return;

Code after addressing the review:
private void collectPredicate(Operator operator, DecodeInfo info) {
if (operator.getPredicate() == null) {
return;
}
DictExpressionCollector dictExpressionCollector = new DictExpressionCollector(info.outputStringColumns);
dictExpressionCollector.collect(operator.getPredicate());
info.outputStringColumns.getStream().forEach(c -> {
List<ScalarOperator> expressions = dictExpressionCollector.getDictExpressions(c);
if (!expressions.isEmpty()) {
stringExpressions.computeIfAbsent(c, l -> Lists.newArrayList()).addAll(expressions);
}
});
}
Code review comment: Nit ```suggestion assertThat(                         ((AlterTableChangeOperation) operation)                                 .getNewTable()                                 .getUnresolvedSchema()                                 .getPrimaryKey()                                 )                 .isNotPresent(); ```

Code before review:
public void testAlterTableDropConstraint() throws Exception {
prepareNonManagedTable(true);
String expectedSummaryString = "ALTER TABLE cat1.db1.tb1\n  DROP CONSTRAINT ct1";
Operation operation = parse("alter table tb1 drop constraint ct1");
assertThat(operation).isInstanceOf(AlterTableChangeOperation.class);
assertThat(operation.asSummaryString()).isEqualTo(expectedSummaryString);
assertThat(
((AlterTableChangeOperation) operation)
.getNewTable()
.getUnresolvedSchema()
.getPrimaryKey()
.isPresent())
.isEqualTo(false);
operation = parse("alter table tb1 drop primary key");
assertThat(operation).isInstanceOf(AlterTableChangeOperation.class);
assertThat(operation.asSummaryString()).isEqualTo(expectedSummaryString);
assertThat(
((AlterTableChangeOperation) operation)
.getNewTable()
.getUnresolvedSchema()
.getPrimaryKey()
.isPresent())
.isEqualTo(false);
}

Line under review: .isEqualTo(false);

Code after addressing the review:
public void testAlterTableDropConstraint() throws Exception {
prepareNonManagedTable(true);
String expectedSummaryString = "ALTER TABLE cat1.db1.tb1\n  DROP CONSTRAINT ct1";
Operation operation = parse("alter table tb1 drop constraint ct1");
assertThat(operation).isInstanceOf(AlterTableChangeOperation.class);
assertThat(operation.asSummaryString()).isEqualTo(expectedSummaryString);
assertThat(
((AlterTableChangeOperation) operation)
.getNewTable()
.getUnresolvedSchema()
.getPrimaryKey())
.isNotPresent();
operation = parse("alter table tb1 drop primary key");
assertThat(operation).isInstanceOf(AlterTableChangeOperation.class);
assertThat(operation.asSummaryString()).isEqualTo(expectedSummaryString);
assertThat(
((AlterTableChangeOperation) operation)
.getNewTable()
.getUnresolvedSchema()
.getPrimaryKey())
.isNotPresent();
}
Code review comment: could you also verify that increasing the bytes would let something in similarly?

Code before review:
public void testRecordTotalTimeMaxActiveThreadsUsed() throws Exception {
CountDownLatch processStart1 = new CountDownLatch(1);
CountDownLatch processStart2 = new CountDownLatch(1);
CountDownLatch processStart3 = new CountDownLatch(1);
CountDownLatch stop = new CountDownLatch(1);
Runnable m1 = createSleepProcessWorkFn(processStart1, stop);
Runnable m2 = createSleepProcessWorkFn(processStart2, stop);
Runnable m3 = createSleepProcessWorkFn(processStart3, stop);
assertEquals(0, executor.activeCount());
assertEquals(2, executor.maximumThreadCount());
executor.execute(m1, 1);
processStart1.await();
assertEquals(1, executor.activeCount());
executor.execute(m2, 1);
processStart2.await();
assertEquals(2, executor.activeCount());
executor.execute(m3, 1);
assertFalse(processStart3.await(1000, TimeUnit.MILLISECONDS));
assertEquals(0l, executor.allThreadsActiveTime());
stop.countDown();
while (executor.activeCount() != 0) {
}
assertThat(executor.allThreadsActiveTime(), greaterThan(0l));
executor.shutdown();
}

Line under review: assertFalse(processStart3.await(1000, TimeUnit.MILLISECONDS));

Code after addressing the review:
public void testRecordTotalTimeMaxActiveThreadsUsed() throws Exception {
CountDownLatch processStart1 = new CountDownLatch(1);
CountDownLatch processStart2 = new CountDownLatch(1);
CountDownLatch processStart3 = new CountDownLatch(1);
CountDownLatch stop = new CountDownLatch(1);
Runnable m1 = createSleepProcessWorkFn(processStart1, stop);
Runnable m2 = createSleepProcessWorkFn(processStart2, stop);
Runnable m3 = createSleepProcessWorkFn(processStart3, stop);
assertEquals(0, executor.activeCount());
assertEquals(2, executor.getMaximumPoolSize());
executor.execute(m1, 1);
processStart1.await();
assertEquals(1, executor.activeCount());
executor.execute(m2, 1);
processStart2.await();
assertEquals(2, executor.activeCount());
executor.execute(m3, 1);
assertFalse(processStart3.await(1000, TimeUnit.MILLISECONDS));
assertEquals(0l, executor.allThreadsActiveTime());
stop.countDown();
while (executor.activeCount() != 0) {
Thread.sleep(200);
}
assertThat(executor.allThreadsActiveTime(), greaterThan(0l));
executor.shutdown();
}