muttakin2301/ccr_train_1000 huggingface dataset:
Code review comment: ```suggestion             return new LogicalSubQueryAlias<>(ctx.identifier().getText(), columnNames, queryPlan); ```

Code before review:
public LogicalSubQueryAlias<Plan> visitAliasQuery(AliasQueryContext ctx) {
return ParserUtils.withOrigin(ctx, () -> {
LogicalPlan queryPlan = plan(ctx.query());
Optional<List<String>> columnNames = optionalVisit(ctx.columnAliases(), () ->
ctx.columnAliases().identifier().stream()
.map(RuleContext::getText)
.collect(ImmutableList.toImmutableList())
);
return new LogicalSubQueryAlias(ctx.identifier().getText(), columnNames, queryPlan);
});
}

Line under review: return new LogicalSubQueryAlias(ctx.identifier().getText(), columnNames, queryPlan);

Code after addressing the review:
public LogicalSubQueryAlias<Plan> visitAliasQuery(AliasQueryContext ctx) {
return ParserUtils.withOrigin(ctx, () -> {
LogicalPlan queryPlan = plan(ctx.query());
Optional<List<String>> columnNames = optionalVisit(ctx.columnAliases(), () ->
ctx.columnAliases().identifier().stream()
.map(RuleContext::getText)
.collect(ImmutableList.toImmutableList())
);
return new LogicalSubQueryAlias<>(ctx.identifier().getText(), columnNames, queryPlan);
});
}
Code review comment: ```suggestion       // Note this takes ownership of newValues. This object is no longer used after it has been closed. ```

Code before review:
public void asyncClose() throws Exception {
checkState(
!isClosed,
"Bag user state is no longer usable because it is closed for %s",
request.getStateKey());
isClosed = true;
if (!isCleared && newValues.isEmpty()) {
return;
}
if (isCleared) {
beamFnStateClient.handle(
request.toBuilder().setClear(StateClearRequest.getDefaultInstance()));
}
if (!newValues.isEmpty()) {
ByteString.Output out = ByteString.newOutput();
for (T newValue : newValues) {
valueCoder.encode(newValue, out);
}
beamFnStateClient.handle(
request
.toBuilder()
.setAppend(StateAppendRequest.newBuilder().setData(out.toByteString())));
}
if (isCleared) {
oldValues.clearAndAppend(newValues);
} else {
oldValues.append(newValues);
}
}


Code after addressing the review:
public void asyncClose() throws Exception {
checkState(
!isClosed,
"Bag user state is no longer usable because it is closed for %s",
request.getStateKey());
isClosed = true;
if (!isCleared && newValues.isEmpty()) {
return;
}
if (isCleared) {
beamFnStateClient.handle(
request.toBuilder().setClear(StateClearRequest.getDefaultInstance()));
}
if (!newValues.isEmpty()) {
ByteString.Output out = ByteString.newOutput();
for (T newValue : newValues) {
valueCoder.encode(newValue, out);
}
beamFnStateClient.handle(
request
.toBuilder()
.setAppend(StateAppendRequest.newBuilder().setData(out.toByteString())));
}
if (isCleared) {
oldValues.clearAndAppend(newValues);
} else {
oldValues.append(newValues);
}
}
Code review comment: You are modifying a code that you have introduced in the same PR (increasing PR size). It would be better to have reversed order of the commits.

Code before review:
private void finishBroadcastBufferBuilder() {
if (broadcastBufferBuilder != null) {
numBytesOut.inc(broadcastBufferBuilder.finish() * numSubpartitions);
numBuffersOut.inc(numSubpartitions);
broadcastBufferBuilder.close();
broadcastBufferBuilder = null;
}
}

Line under review: broadcastBufferBuilder.close();

Code after addressing the review:
private void finishBroadcastBufferBuilder() {
if (broadcastBufferBuilder != null) {
numBytesOut.inc(broadcastBufferBuilder.finish() * numSubpartitions);
numBuffersOut.inc(numSubpartitions);
broadcastBufferBuilder.close();
broadcastBufferBuilder = null;
}
}
Code review comment: Hmm, it is nullable, but veneer will have it's default? 

Code before review:
public Read withAttemptTimeout(Duration timeout) {
checkArgument(timeout.isLongerThan(Duration.ZERO), "attempt timeout must be positive");
BigtableReadOptions readOptions = getBigtableReadOptions();
return toBuilder()
.setBigtableReadOptions(readOptions.toBuilder().setAttemptTimeout(timeout).build())
.build();
}

Line under review: checkArgument(timeout.isLongerThan(Duration.ZERO), "attempt timeout must be positive");

Code after addressing the review:
public Read withAttemptTimeout(Duration timeout) {
checkArgument(timeout.isLongerThan(Duration.ZERO), "attempt timeout must be positive");
BigtableReadOptions readOptions = getBigtableReadOptions();
return toBuilder()
.setBigtableReadOptions(readOptions.toBuilder().setAttemptTimeout(timeout).build())
.build();
}
Code review comment: Any reason why response tag is modifiable but failure tag is final?

Code before review:
private Result(TupleTag<KV<RequestT, ResponseT>> responseTag, PCollectionTuple pct) {
this.pipeline = pct.getPipeline();
this.responseTag = responseTag;
this.responses = pct.get(responseTag);
this.failures = pct.get(FAILURE_TAG);
}

Line under review: this.failures = pct.get(FAILURE_TAG);

Code after addressing the review:
private Result(TupleTag<KV<RequestT, ResponseT>> responseTag, PCollectionTuple pct) {
this.pipeline = pct.getPipeline();
this.responseTag = responseTag;
this.responses = pct.get(responseTag);
this.failures = pct.get(FAILURE_TAG);
}
Code review comment: This can be replaced by ArrayDeque as well.

Code before review:
public Collection<String> process(String input) throws PreprocessorException {
List<String> snippets = new ArrayList<>();
StringBuilder builder = new StringBuilder();
Deque<Character> brackets = new ConcurrentLinkedDeque<>();
boolean isInBacktickLiteral = false;
boolean isInQuoteLiteral = false;
boolean isInComment = false;
for (int i = 0; i < input.length(); i++) {
char character = input.charAt(i);
if (isInComment && character == NEW_LINE) {
isInComment = false;
}
if (!isInComment) {
builder.append(character);
if (character == DOUBLE_QUOTE && isNotEscaped(input, i)) {
isInQuoteLiteral = !isInQuoteLiteral;
} else if (character == BACK_TICK && isNotEscaped(input, i)) {
isInBacktickLiteral = !isInBacktickLiteral;
}
if (!isInBacktickLiteral && !isInQuoteLiteral) {
if (isInComment = isCommentStart(input, i)) {
builder.deleteCharAt(builder.length() - 1);
} else if (character == SEMICOLON && brackets.isEmpty()) {
addToList(snippets, builder);
builder.setLength(0);
} else if (isOpeningBracket(character)) {
brackets.push(character);
} else if (!brackets.isEmpty() && isBracketPair(brackets.peek(), character)) {
brackets.pop();
} else if (isClosingBracket(character)) {
if (brackets.isEmpty()) {
addErrorDiagnostic("syntax error: found closing brackets but opening one not found.");
throw new PreprocessorException();
}
}
}
}
}
if (!builder.isEmpty()) {
addToList(snippets, builder);
}
return snippets;
}

Line under review: Deque<Character> brackets = new ConcurrentLinkedDeque<>();

Code after addressing the review:
public Collection<String> process(String input) throws PreprocessorException {
List<String> snippets = new ArrayList<>();
StringBuilder builder = new StringBuilder();
Deque<Character> brackets = new ArrayDeque<>();
boolean isInBacktickLiteral = false;
boolean isInQuoteLiteral = false;
boolean isInComment = false;
for (int i = 0; i < input.length(); i++) {
char character = input.charAt(i);
if (isInComment && character == NEW_LINE) {
isInComment = false;
}
if (!isInComment) {
builder.append(character);
if (character == DOUBLE_QUOTE && isNotEscaped(input, i)) {
isInQuoteLiteral = !isInQuoteLiteral;
} else if (character == BACK_TICK && isNotEscaped(input, i)) {
isInBacktickLiteral = !isInBacktickLiteral;
}
if (!isInBacktickLiteral && !isInQuoteLiteral) {
if (isInComment = isCommentStart(input, i)) {
builder.deleteCharAt(builder.length() - 1);
} else if (character == SEMICOLON && brackets.isEmpty()) {
addToList(snippets, builder);
builder.setLength(0);
} else if (isOpeningBracket(character)) {
brackets.push(character);
} else if (!brackets.isEmpty() && isBracketPair(brackets.peek(), character)) {
brackets.pop();
} else if (isClosingBracket(character)) {
if (brackets.isEmpty()) {
addErrorDiagnostic("syntax error: found closing brackets but opening one not found.");
throw new PreprocessorException();
}
}
}
}
}
if (!builder.isEmpty()) {
addToList(snippets, builder);
}
return snippets;
}
Code review comment: seems `buildAuthenticatedRequest` can throw exception if so `response.close();` won't be hit and that can leak connection.

Code before review:
public void applyCredentialsFilter(OkHttpClient.Builder clientBuilder) {
clientBuilder.addInterceptor(new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
Request originalRequest = chain.request();
HttpUrl url = chain.request().url();
Map<String, String> challengeMap = cache.getCachedChallenge(url);
Response response;
Pair<Request, HttpMessageSecurity> authenticatedRequestPair;
if (challengeMap != null) {
authenticatedRequestPair = buildAuthenticatedRequest(originalRequest, challengeMap);
} else {
response = chain.proceed(buildEmptyRequest(originalRequest));
if (response.code() !=  401) {
return response;
}
authenticatedRequestPair = buildAuthenticatedRequest(originalRequest, response);
response.close();
}
response = chain.proceed(authenticatedRequestPair.getLeft());
if (response.code() == 200) {
return authenticatedRequestPair.getRight().unprotectResponse(response);
} else {
return response;
}
}
});
}

Line under review: response.close();

Code after addressing the review:
public void applyCredentialsFilter(OkHttpClient.Builder clientBuilder) {
clientBuilder.addInterceptor(new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
Request originalRequest = chain.request();
HttpUrl url = chain.request().url();
Map<String, String> challengeMap = cache.getCachedChallenge(url);
Response response;
Pair<Request, HttpMessageSecurity> authenticatedRequestPair;
if (challengeMap != null) {
authenticatedRequestPair = buildAuthenticatedRequest(originalRequest, challengeMap);
} else {
response = chain.proceed(buildEmptyRequest(originalRequest));
if (response.code() !=  401) {
return response;
}
try {
authenticatedRequestPair = buildAuthenticatedRequest(originalRequest, response);
} finally {
response.close();
}
}
response = chain.proceed(authenticatedRequestPair.getLeft());
if (response.code() == 200) {
return authenticatedRequestPair.getRight().unprotectResponse(response);
} else {
return response;
}
}
});
}
Code review comment: ```suggestion             .collect(Collectors.joining(", ", "(", ")")); ```

Code before review:
public String toSql() {
return compareExpr.toSql() + " IN " + optionsList.stream()
.map(Expression::toSql)
.collect(Collectors.joining(",", "(", ")"));
}

Line under review: .collect(Collectors.joining(",", "(", ")"));

Code after addressing the review:
public String toSql() {
return compareExpr.toSql() + " IN " + options.stream()
.map(Expression::toSql)
.collect(Collectors.joining(", ", "(", ")"));
}
Code review comment: Resolving as per the offline discussion.

Code before review:
public void visit(BLangLetExpression letExpression) {
SymbolEnv prevEnv = this.env;
letExpression.env.enclInvokable = this.env.enclInvokable;
this.env = letExpression.env;
BLangExpression expr = letExpression.expr;
BLangBlockStmt blockStmt = ASTBuilderUtil.createBlockStmt(letExpression.pos);
blockStmt.scope = letExpression.env.scope;
for (BLangLetVariable letVariable : letExpression.letVarDeclarations) {
BLangNode node  = rewrite((BLangNode) letVariable.definitionNode, env);
if (node.getKind() == NodeKind.BLOCK) {
blockStmt.stmts.addAll(((BLangBlockStmt) node).stmts);
} else {
blockStmt.addStatement((BLangSimpleVariableDef) node);
}
}
BLangSimpleVariableDef tempVarDef = createVarDef(String.format("$let_var_%d_$", letCount++),
expr.getBType(), expr, expr.pos);
BLangSimpleVarRef tempVarRef = ASTBuilderUtil.createVariableRef(expr.pos, tempVarDef.var.symbol);
blockStmt.addStatement(tempVarDef);
BLangStatementExpression stmtExpr = ASTBuilderUtil.createStatementExpression(blockStmt, tempVarRef);
stmtExpr.setBType(expr.getBType());
result = rewrite(stmtExpr, env);
this.env = prevEnv;
}

Line under review: letExpression.env.enclInvokable = this.env.enclInvokable;

Code after addressing the review:
public void visit(BLangLetExpression letExpression) {
SymbolEnv prevEnv = this.env;
letExpression.env.enclInvokable = this.env.enclInvokable;
this.env = letExpression.env;
BLangExpression expr = letExpression.expr;
BLangBlockStmt blockStmt = ASTBuilderUtil.createBlockStmt(letExpression.pos);
blockStmt.scope = letExpression.env.scope;
for (BLangLetVariable letVariable : letExpression.letVarDeclarations) {
BLangNode node  = rewrite((BLangNode) letVariable.definitionNode, env);
if (node.getKind() == NodeKind.BLOCK) {
blockStmt.stmts.addAll(((BLangBlockStmt) node).stmts);
} else {
blockStmt.addStatement((BLangSimpleVariableDef) node);
}
}
BLangSimpleVariableDef tempVarDef = createVarDef(String.format("$let_var_%d_$", letCount++),
expr.getBType(), expr, expr.pos);
BLangSimpleVarRef tempVarRef = ASTBuilderUtil.createVariableRef(expr.pos, tempVarDef.var.symbol);
blockStmt.addStatement(tempVarDef);
BLangStatementExpression stmtExpr = ASTBuilderUtil.createStatementExpression(blockStmt, tempVarRef);
stmtExpr.setBType(expr.getBType());
result = rewrite(stmtExpr, env);
this.env = prevEnv;
}
Code review comment: Thanks, we'll need to add proper tests for this.

Code before review:
private DefaultArtifactSources processJarPluginExecutionConfig(PluginExecution e, boolean test) {
final Object config = e.getConfiguration();
if (config == null || !(config instanceof Xpp3Dom)) {
return null;
}
Xpp3Dom dom = (Xpp3Dom) config;
PathFilter filter = null;
final Xpp3Dom includes = dom.getChild("includes");
if (includes != null) {
final Xpp3Dom[] includeElements = includes.getChildren();
final List<String> list = new ArrayList<>(includeElements.length);
for (Xpp3Dom include : includeElements) {
list.add(include.getValue());
}
filter = PathFilter.forIncludes(list);
} else {
final Xpp3Dom excludes = dom.getChild("excludes");
if (excludes != null) {
final Xpp3Dom[] excludeElements = excludes.getChildren();
final List<String> list = new ArrayList<>(excludeElements.length);
for (Xpp3Dom exclude : excludes.getChildren()) {
list.add(exclude.getValue());
}
filter = PathFilter.forExcludes(list);
}
}
if (filter != null) {
final String classifier = getClassifier(dom, test);
final DefaultArtifactSources src = new DefaultArtifactSources(classifier);
src.addSources(
new DefaultSourceDir(new DirectoryPathTree(test ? getTestSourcesSourcesDir() : getSourcesSourcesDir()),
new DirectoryPathTree(test ? getTestClassesDir() : getClassesDir(), filter),
Collections.emptyMap()));
if (test) {
addTestResources(src, filter);
} else {
addMainResources(src, filter);
}
return src;
}
return null;
}

Line under review: } else {

Code after addressing the review:
private DefaultArtifactSources processJarPluginExecutionConfig(PluginExecution e, boolean test) {
final Object config = e.getConfiguration();
if (config == null || !(config instanceof Xpp3Dom)) {
return null;
}
Xpp3Dom dom = (Xpp3Dom) config;
final List<String> includes = collectChildValues(dom.getChild("includes"));
final List<String> excludes = collectChildValues(dom.getChild("excludes"));
if (includes == null && excludes == null) {
return null;
}
final PathFilter filter = new PathFilter(includes, excludes);
final String classifier = getClassifier(dom, test);
final Collection<SourceDir> sources = Collections.singletonList(
new DefaultSourceDir(new DirectoryPathTree(test ? getTestSourcesSourcesDir() : getSourcesSourcesDir()),
new DirectoryPathTree(test ? getTestClassesDir() : getClassesDir(), filter),
Collections.emptyMap()));
final Collection<SourceDir> resources = test ? collectTestResources(filter) : collectMainResources(filter);
return new DefaultArtifactSources(classifier, sources, resources);
}
Code review comment: Please improve the error message specifying that withSnowPipe is required for streaming / unbounded PCollections

Code before review:
private void checkArguments(PCollection<T> input) {
checkArgument(getStagingBucketName() != null, "withStagingBucketName is required");
checkArgument(getUserDataMapper() != null, "withUserDataMapper() is required");
checkArgument(
(getDataSourceProviderFn() != null),
"withDataSourceConfiguration() or withDataSourceProviderFn() is required");
if (input.isBounded() == PCollection.IsBounded.UNBOUNDED) {
checkArgument(getSnowPipe() != null, "withSnowPipe() is required");
} else {
checkArgument(getTable() != null, "to() is required");
}
}

Line under review: checkArgument(getSnowPipe() != null, "withSnowPipe() is required");

Code after addressing the review:
private void checkArguments(PCollection<T> input) {
checkArgument(getStagingBucketName() != null, "withStagingBucketName is required");
checkArgument(getUserDataMapper() != null, "withUserDataMapper() is required");
checkArgument(
(getDataSourceProviderFn() != null),
"withDataSourceConfiguration() or withDataSourceProviderFn() is required");
if (input.isBounded() == PCollection.IsBounded.UNBOUNDED) {
checkArgument(
getSnowPipe() != null,
"in streaming (unbounded) write it is required to specify SnowPipe name via withSnowPipe() method.");
} else {
checkArgument(
getTable() != null,
"in batch writing it is required to specify destination table name via to() method.");
}
}
Code review comment: Is `targetDatabaseName = targetDatabase.getName();` necessary? Migration is compatible with upper and lower database name.

Code before review:
public void executeUpdate(final MigrateTableStatement sqlStatement, final ContextManager contextManager) {
InstanceContext instanceContext = contextManager.getInstanceContext();
ShardingSpherePreconditions.checkState(instanceContext.isCluster(),
() -> new PipelineInvalidParameterException(String.format("Only `Cluster` is supported now, but current mode type is `%s`", instanceContext.getModeConfiguration().getType())));
checkTargetDatabase(sqlStatement);
String targetDatabaseName;
if (Strings.isNullOrEmpty(sqlStatement.getTargetDatabaseName())) {
targetDatabaseName = database.getName();
} else {
ShardingSphereDatabase targetDatabase = PipelineContextManager.getProxyContext().getContextManager().getDatabase(sqlStatement.getTargetDatabaseName());
ShardingSpherePreconditions.checkNotNull(targetDatabase, () -> new PipelineInvalidParameterException(String.format("Target database `%s` is not exists",
sqlStatement.getTargetDatabaseName())));
targetDatabaseName = targetDatabase.getName();
}
MigrationJobAPI jobAPI = (MigrationJobAPI) TypedSPILoader.getService(TransmissionJobAPI.class, "MIGRATION");
jobAPI.start(new PipelineContextKey(InstanceType.PROXY), new MigrateTableStatement(sqlStatement.getSourceTargetEntries(), targetDatabaseName));
}

Line under review: targetDatabaseName = targetDatabase.getName();

Code after addressing the review:
public void executeUpdate(final MigrateTableStatement sqlStatement, final ContextManager contextManager) {
InstanceContext instanceContext = contextManager.getInstanceContext();
ShardingSpherePreconditions.checkState(instanceContext.isCluster(),
() -> new PipelineInvalidParameterException(String.format("Only `Cluster` is supported now, but current mode type is `%s`", instanceContext.getModeConfiguration().getType())));
String targetDatabaseName = null == sqlStatement.getTargetDatabaseName() ? database.getName() : sqlStatement.getTargetDatabaseName();
ShardingSpherePreconditions.checkState(contextManager.getMetaDataContexts().getMetaData().containsDatabase(targetDatabaseName),
() -> new MissingRequiredTargetDatabaseException(sqlStatement.getTargetDatabaseName()));
MigrationJobAPI jobAPI = (MigrationJobAPI) TypedSPILoader.getService(TransmissionJobAPI.class, "MIGRATION");
jobAPI.start(new PipelineContextKey(InstanceType.PROXY), new MigrateTableStatement(sqlStatement.getSourceTargetEntries(), targetDatabaseName));
}
Code review comment: because the executable functions' signatures are all varchar but not string.

Code before review:
private Expression translateJavaFormatter(Expression formatterExpr) {
if (formatterExpr.isLiteral() && formatterExpr.getDataType().isStringLikeType()) {
Literal literal = (Literal) formatterExpr;
String originFormatter = literal.getStringValue();
if (originFormatter.equals("yyyyMMdd")) {
return new VarcharLiteral("%Y%m%d");
} else if (originFormatter.equals("yyyy-MM-dd")) {
return new VarcharLiteral("%Y-%m-%d");
} else if (originFormatter.equals("yyyy-MM-dd HH:mm:ss")) {
return new VarcharLiteral("%Y-%m-%d %H:%i:%s");
}
}
return formatterExpr;
}

Line under review: return new VarcharLiteral("%Y-%m-%d %H:%i:%s");

Code after addressing the review:
private Expression translateJavaFormatter(Expression formatterExpr) {
if (formatterExpr.isLiteral() && formatterExpr.getDataType().isStringLikeType()) {
Literal literal = (Literal) formatterExpr;
String originFormatter = literal.getStringValue();
if (originFormatter.equals("yyyyMMdd")) {
return new VarcharLiteral("%Y%m%d");
} else if (originFormatter.equals("yyyy-MM-dd")) {
return new VarcharLiteral("%Y-%m-%d");
} else if (originFormatter.equals("yyyy-MM-dd HH:mm:ss")) {
return new VarcharLiteral("%Y-%m-%d %H:%i:%s");
}
}
return formatterExpr;
}
Code review comment: This will also include application-level endpoints now (if declared), but we haven't modeled that on the config server side yet.

Code before review:
private void createEndpointList(DeployState deployState) {
if( deployState.getProperties().applicationId().instance().isTester()) return;
List<ApplicationClusterEndpoint> endpoints = new ArrayList<>();
List<String> hosts = getContainers().stream()
.map(AbstractService::getHostName)
.collect(Collectors.toList());
for(String suffix : deployState.getProperties().zoneDnsSuffixes()) {
ApplicationClusterEndpoint.DnsName l4Name = ApplicationClusterEndpoint.DnsName.sharedL4NameFrom(
ClusterSpec.Id.from(getName()),
deployState.getProperties().applicationId(),
suffix);
endpoints.add(ApplicationClusterEndpoint.builder()
.zoneScope()
.sharedL4Routing()
.dnsName(l4Name)
.hosts(hosts)
.build());
ApplicationClusterEndpoint.DnsName l7Name = ApplicationClusterEndpoint.DnsName.sharedNameFrom(
ClusterSpec.Id.from(getName()),
deployState.getProperties().applicationId(),
suffix);
endpoints.add(ApplicationClusterEndpoint.builder()
.zoneScope()
.sharedRouting()
.dnsName(l7Name)
.hosts(hosts)
.build());
}
Set<ContainerEndpoint> endpointsFromController = deployState.getEndpoints();
endpointsFromController.stream()
.filter(ce -> ce.clusterId().equals(getName()))
.forEach(ce -> ce.names().forEach(
name -> endpoints.add(ApplicationClusterEndpoint.builder()
.globalScope()
.sharedL4Routing()
.dnsName(ApplicationClusterEndpoint.DnsName.from(name))
.hosts(hosts)
.build())
));
endpointList = List.copyOf(endpoints);
}

Line under review: Set<ContainerEndpoint> endpointsFromController = deployState.getEndpoints();

Code after addressing the review:
private void createEndpointList(DeployState deployState) {
if(!deployState.isHosted()) return;
if(deployState.getProperties().applicationId().instance().isTester()) return;
List<ApplicationClusterEndpoint> endpoints = new ArrayList<>();
List<String> hosts = getContainers().stream()
.map(AbstractService::getHostName)
.collect(Collectors.toList());
for(String suffix : deployState.getProperties().zoneDnsSuffixes()) {
ApplicationClusterEndpoint.DnsName l4Name = ApplicationClusterEndpoint.DnsName.sharedL4NameFrom(
ClusterSpec.Id.from(getName()),
deployState.getProperties().applicationId(),
suffix);
endpoints.add(ApplicationClusterEndpoint.builder()
.zoneScope()
.sharedL4Routing()
.dnsName(l4Name)
.hosts(hosts)
.build());
ApplicationClusterEndpoint.DnsName l7Name = ApplicationClusterEndpoint.DnsName.sharedNameFrom(
ClusterSpec.Id.from(getName()),
deployState.getProperties().applicationId(),
suffix);
endpoints.add(ApplicationClusterEndpoint.builder()
.zoneScope()
.sharedRouting()
.dnsName(l7Name)
.hosts(hosts)
.build());
}
Set<ContainerEndpoint> endpointsFromController = deployState.getEndpoints();
endpointsFromController.stream()
.filter(ce -> ce.clusterId().equals(getName()))
.forEach(ce -> ce.names().forEach(
name -> endpoints.add(ApplicationClusterEndpoint.builder()
.scope(ce.scope())
.sharedL4Routing()
.dnsName(ApplicationClusterEndpoint.DnsName.from(name))
.hosts(hosts)
.build())
));
endpointList = List.copyOf(endpoints);
}
Code review comment: ```suggestion       // Java uses BigDecimal so 0.2 * 170 = 63.9...       // BigDecimal.longValue() will round down to 63 instead of the expected 64 ``` 

Code before review:
public void testTrySplitForProcessSplitOnMiddleWindow() throws Exception {
List<BoundedWindow> windows = ImmutableList.copyOf(currentElement.getWindows());
OffsetRangeTracker tracker = new OffsetRangeTracker(currentRestriction);
tracker.tryClaim(30L);
KV<WindowedSplitResult, Integer> result =
FnApiDoFnRunner.trySplitForProcess(
currentElement,
currentRestriction,
window2,
windows,
currentWatermarkEstimatorState,
0.2,
tracker,
watermarkAndState,
1,
3);
assertEquals(2, (int) result.getValue());
KV<WindowedValue, WindowedValue> expectedElementSplit =
createSplitInWindow(new OffsetRange(0, 63), new OffsetRange(63, 100), window2);
KV<WindowedValue, WindowedValue> expectedWindowSplit =
createSplitAcrossWindows(ImmutableList.of(window1), ImmutableList.of(window3));
assertEquals(expectedElementSplit.getKey(), result.getKey().getPrimarySplitRoot());
assertEquals(expectedElementSplit.getValue(), result.getKey().getResidualSplitRoot());
assertEquals(
expectedWindowSplit.getKey(), result.getKey().getPrimaryInFullyProcessedWindowsRoot());
assertEquals(
expectedWindowSplit.getValue(), result.getKey().getResidualInUnprocessedWindowsRoot());
}

Line under review: createSplitInWindow(new OffsetRange(0, 63), new OffsetRange(63, 100), window2);

Code after addressing the review:
public void testTrySplitForProcessSplitOnMiddleWindow() throws Exception {
List<BoundedWindow> windows = ImmutableList.copyOf(currentElement.getWindows());
OffsetRangeTracker tracker = new OffsetRangeTracker(currentRestriction);
tracker.tryClaim(30L);
KV<WindowedSplitResult, Integer> result =
FnApiDoFnRunner.trySplitForProcess(
currentElement,
currentRestriction,
window2,
windows,
currentWatermarkEstimatorState,
0.2,
tracker,
watermarkAndState,
1,
3);
assertEquals(2, (int) result.getValue());
KV<WindowedValue, WindowedValue> expectedElementSplit =
createSplitInWindow(new OffsetRange(0, 63), new OffsetRange(63, 100), window2);
KV<WindowedValue, WindowedValue> expectedWindowSplit =
createSplitAcrossWindows(ImmutableList.of(window1), ImmutableList.of(window3));
assertEquals(expectedElementSplit.getKey(), result.getKey().getPrimarySplitRoot());
assertEquals(expectedElementSplit.getValue(), result.getKey().getResidualSplitRoot());
assertEquals(
expectedWindowSplit.getKey(), result.getKey().getPrimaryInFullyProcessedWindowsRoot());
assertEquals(
expectedWindowSplit.getValue(), result.getKey().getResidualInUnprocessedWindowsRoot());
}
Code review comment: Can't this be simplified to: ```         return billablePlans().stream()                 .flatMap(p -> billing.tenantsWithPlan(tenants, p.id()).stream())                 .toList(); ```

Code before review:
private List<TenantName> billableTenants(List<TenantName> tenants) {
return billablePlans().stream()
.collect(Collectors.toMap(
p -> p,
p -> billing.tenantsWithPlan(tenants, p.id())))
.values()
.stream()
.flatMap(Collection::stream)
.toList();
}

Line under review: .toList();

Code after addressing the review:
private List<TenantName> billableTenants(List<TenantName> tenants) {
return billablePlans().stream()
.flatMap(p -> billing.tenantsWithPlan(tenants, p.id()).stream())
.toList();
}
Code review comment: I am wondering why this wasn't a problem with `InetSocketAddress` ? It was also present in `toString()` and was not initialized in Constructor.  

Code before review:
public String toString() {
return "GatewayConnectionConfig{" +
"requestTimeout=" + requestTimeout +
", maxConnectionPoolSize=" + maxConnectionPoolSize +
", idleConnectionTimeout=" + idleConnectionTimeout +
", proxyType=" + proxy.getType() +
", inetSocketProxyAddress=" + proxy.getAddress() +
'}';
}

Line under review: ", proxyType=" + proxy.getType() +

Code after addressing the review:
public String toString() {
String proxyType = proxy != null ? proxy.getType().toString() : null;
String proxyAddress = proxy != null ? proxy.getAddress().toString() : null;
return "GatewayConnectionConfig{" +
"requestTimeout=" + requestTimeout +
", maxConnectionPoolSize=" + maxConnectionPoolSize +
", idleConnectionTimeout=" + idleConnectionTimeout +
", proxyType=" + proxyType +
", inetSocketProxyAddress=" + proxyAddress +
'}';
}
Code review comment: Is it supposed to be `!result.isSetStatus()`?

Code before review:
public String getProxyStatus() {
if (result == null) {
return QueryState.MysqlStateType.UNKNOWN.name();
}
if (result.isSetStatus()) {
return QueryState.MysqlStateType.UNKNOWN.name();
} else {
return result.getStatus();
}
}

Line under review: if (result.isSetStatus()) {

Code after addressing the review:
public String getProxyStatus() {
if (result == null) {
return QueryState.MysqlStateType.UNKNOWN.name();
}
if (!result.isSetStatus()) {
return QueryState.MysqlStateType.UNKNOWN.name();
} else {
return result.getStatus();
}
}
Code review comment: @jsquire may know... Do we allow users to set a client identifier for EventProcessorClient? (ie. does that mean all the new underlying AMQP connections it creates, also use that identifier?)

Code before review:
EventHubAsyncClient buildAsyncClient() {
if (retryOptions == null) {
retryOptions = DEFAULT_RETRY;
}
if (scheduler == null) {
scheduler = Schedulers.boundedElastic();
}
if (prefetchCount == null) {
prefetchCount = DEFAULT_PREFETCH_COUNT;
}
final MessageSerializer messageSerializer = new EventHubMessageSerializer();
final EventHubConnectionProcessor processor;
if (isSharedConnection.get()) {
synchronized (connectionLock) {
if (eventHubConnectionProcessor == null) {
eventHubConnectionProcessor = buildConnectionProcessor(messageSerializer);
}
}
processor = eventHubConnectionProcessor;
final int numberOfOpenClients = openClients.incrementAndGet();
LOGGER.info("
} else {
processor = buildConnectionProcessor(messageSerializer);
}
final TracerProvider tracerProvider = new TracerProvider(ServiceLoader.load(Tracer.class));
String identifier;
if (clientOptions != null && clientOptions instanceof AmqpClientOptions) {
String clientOptionIdentifier = ((AmqpClientOptions) clientOptions).getIdentifier();
identifier = clientOptionIdentifier == null ? UUID.randomUUID().toString() : clientOptionIdentifier;
} else {
identifier = UUID.randomUUID().toString();
}
return new EventHubAsyncClient(processor, tracerProvider, messageSerializer, scheduler,
isSharedConnection.get(), this::onClientClose,
identifier);
}

Line under review: }

Code after addressing the review:
EventHubAsyncClient buildAsyncClient() {
if (retryOptions == null) {
retryOptions = DEFAULT_RETRY;
}
if (scheduler == null) {
scheduler = Schedulers.boundedElastic();
}
if (prefetchCount == null) {
prefetchCount = DEFAULT_PREFETCH_COUNT;
}
final MessageSerializer messageSerializer = new EventHubMessageSerializer();
final EventHubConnectionProcessor processor;
if (isSharedConnection.get()) {
synchronized (connectionLock) {
if (eventHubConnectionProcessor == null) {
eventHubConnectionProcessor = buildConnectionProcessor(messageSerializer);
}
}
processor = eventHubConnectionProcessor;
final int numberOfOpenClients = openClients.incrementAndGet();
LOGGER.info("
} else {
processor = buildConnectionProcessor(messageSerializer);
}
final TracerProvider tracerProvider = new TracerProvider(ServiceLoader.load(Tracer.class));
String identifier;
if (clientOptions instanceof AmqpClientOptions) {
String clientOptionIdentifier = ((AmqpClientOptions) clientOptions).getIdentifier();
identifier = CoreUtils.isNullOrEmpty(clientOptionIdentifier) ? UUID.randomUUID().toString() : clientOptionIdentifier;
} else {
identifier = UUID.randomUUID().toString();
}
return new EventHubAsyncClient(processor, tracerProvider, messageSerializer, scheduler,
isSharedConnection.get(), this::onClientClose,
identifier);
}
Code review comment: Do we need this previous constructor? Will this end up confusing users/making things error prone?

Code before review:
public BLangDiagnosticLocation(String filePath, int startLine, int endLine, int startColumn, int endColumn) {
this.lineRange = LineRange.from(filePath, LinePosition.from(startLine, startColumn),
LinePosition.from(endLine, endColumn));
this.textRange = TextRange.from(0, 0);
}

Line under review: }

Code after addressing the review:
public BLangDiagnosticLocation(String filePath, int startLine, int endLine, int startColumn, int endColumn) {
this.lineRange = LineRange.from(filePath, LinePosition.from(startLine, startColumn),
LinePosition.from(endLine, endColumn));
this.textRange = TextRange.from(0, 0);
}
Code review comment: The code for the source metric tests looks very similar can you try to generify this a bit?

Code before review:
public void testMetrics() throws Exception {
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
int numSplits = 2;
int parallelism = 4;
env.setParallelism(parallelism);
int numRecordsPerSplit = 10;
SharedReference<CyclicBarrier> beforeBarrier =
sharedObjects.add(new CyclicBarrier(numSplits + 1));
SharedReference<CyclicBarrier> afterBarrier =
sharedObjects.add(new CyclicBarrier(numSplits + 1));
int stopAtRecord1 = 4;
int stopAtRecord2 = numRecordsPerSplit - 1;
env.fromSequence(0, numSplits)
.<Long>flatMap(
(split, collector) ->
LongStream.range(0, numRecordsPerSplit).forEach(collector::collect))
.returns(BasicTypeInfo.LONG_TYPE_INFO)
.map(
i -> {
if (i % numRecordsPerSplit == stopAtRecord1
|| i % numRecordsPerSplit == stopAtRecord2) {
beforeBarrier.get().await();
afterBarrier.get().await();
}
return i;
})
.sinkTo(TestSink.newBuilder().setWriter(new MetricWriter()).build())
.name("TestSink");
JobClient jobClient = env.executeAsync();
beforeBarrier.get().await();
assertSinkMetrics(stopAtRecord1, env.getParallelism(), numSplits);
afterBarrier.get().await();
beforeBarrier.get().await();
assertSinkMetrics(stopAtRecord2, env.getParallelism(), numSplits);
afterBarrier.get().await();
jobClient.getJobExecutionResult().get();
}

Line under review: int parallelism = 4;

Code after addressing the review:
public void testMetrics() throws Exception {
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
int numSplits = Math.max(1, env.getParallelism() - 2);
int numRecordsPerSplit = 10;
SharedReference<CyclicBarrier> beforeBarrier =
sharedObjects.add(new CyclicBarrier(numSplits + 1));
SharedReference<CyclicBarrier> afterBarrier =
sharedObjects.add(new CyclicBarrier(numSplits + 1));
int stopAtRecord1 = 4;
int stopAtRecord2 = numRecordsPerSplit - 1;
env.fromSequence(0, numSplits - 1)
.<Long>flatMap(
(split, collector) ->
LongStream.range(0, numRecordsPerSplit).forEach(collector::collect))
.returns(BasicTypeInfo.LONG_TYPE_INFO)
.map(
i -> {
if (i % numRecordsPerSplit == stopAtRecord1
|| i % numRecordsPerSplit == stopAtRecord2) {
beforeBarrier.get().await();
afterBarrier.get().await();
}
return i;
})
.sinkTo(TestSink.newBuilder().setWriter(new MetricWriter()).build())
.name("TestSink");
JobClient jobClient = env.executeAsync();
beforeBarrier.get().await();
assertSinkMetrics(stopAtRecord1, env.getParallelism(), numSplits);
afterBarrier.get().await();
beforeBarrier.get().await();
assertSinkMetrics(stopAtRecord2, env.getParallelism(), numSplits);
afterBarrier.get().await();
jobClient.getJobExecutionResult().get();
}
Code review comment: `jsonRow != null`? So what will be happen when `jsonRow` is null?

Code before review:
public RowData readRecord(RowData reuse, byte[] bytes, int offset, int numBytes) throws IOException {
GenericRowData returnRecord = rowData;
if (this.getDelimiter() != null && this.getDelimiter().length == 1
&& this.getDelimiter()[0] == NEW_LINE && offset + numBytes >= 1
&& bytes[offset + numBytes - 1] == CARRIAGE_RETURN){
numBytes -= 1;
}
byte[] trimBytes = Arrays.copyOfRange(bytes, offset, offset + numBytes);
GenericRowData jsonRow = (GenericRowData) deserializationSchema.deserialize(trimBytes);
if (jsonRow != null) {
for (int i = 0; i < jsonSelectFieldNames.size(); i++) {
returnRecord.setField(jsonFieldMapping[i], jsonRow.getField(i));
}
}
emitted++;
return returnRecord;
}

Line under review: if (jsonRow != null) {

Code after addressing the review:
public RowData readRecord(RowData reuse, byte[] bytes, int offset, int numBytes) throws IOException {
if (this.getDelimiter() != null && this.getDelimiter().length == 1
&& this.getDelimiter()[0] == NEW_LINE && offset + numBytes >= 1
&& bytes[offset + numBytes - 1] == CARRIAGE_RETURN) {
numBytes -= 1;
}
byte[] trimBytes = Arrays.copyOfRange(bytes, offset, offset + numBytes);
GenericRowData jsonRow = (GenericRowData) deserializationSchema.deserialize(trimBytes);
if (jsonRow == null) {
return null;
}
GenericRowData returnRecord = rowData;
for (int i = 0; i < jsonSelectFieldToJsonFieldMapping.length; i++) {
returnRecord.setField(jsonSelectFieldToProjectFieldMapping[i],
jsonRow.getField(jsonSelectFieldToJsonFieldMapping[i]));
}
emitted++;
return returnRecord;
}
Code review comment: [Optional]  you can write something like:  ``` return configContext.provider.refreshTokens(refreshToken)      .plug(u -> {          if (! BlockingOperationControl.isBlockingAllowed()) {              return u.runSubscriptionOn(resolver.getBlockingExecutor());          }           return u;      }); ```

Code before review:
private Uni<AuthorizationCodeTokens> refreshTokensUni(TenantConfigContext configContext, String refreshToken) {
if (BlockingOperationControl.isBlockingAllowed()) {
return configContext.provider.refreshTokens(refreshToken);
}
return configContext.provider.refreshTokens(refreshToken)
.runSubscriptionOn(resolver.getBlockingExecutor());
}

Line under review: return configContext.provider.refreshTokens(refreshToken);

Code after addressing the review:
private Uni<AuthorizationCodeTokens> refreshTokensUni(TenantConfigContext configContext, String refreshToken) {
return configContext.provider.refreshTokens(refreshToken).plug(u -> {
if (!BlockingOperationControl.isBlockingAllowed()) {
return u.runSubscriptionOn(resolver.getBlockingExecutor());
}
return u;
});
}
Code review comment: Shall we add an API to the RenameContext to get the honorChangeAnnotation flag, because otherwise we have to pass the flag as function args.

Code before review:
public CompletableFuture<WorkspaceEdit> rename(RenameParams params) {
return CompletableFuture.supplyAsync(() -> {
try {
RenameContext context = ContextBuilder.buildRenameContext(params.getTextDocument().getUri(),
this.workspaceManager,
this.serverContext,
params.getPosition());
boolean honorsChangeAnnotations = this.clientCapabilities.getTextDocCapabilities()
.getRename().getHonorsChangeAnnotations() != null ?
this.clientCapabilities.getTextDocCapabilities().getRename().getHonorsChangeAnnotations()
: false;
return RenameUtil.rename(context, params.getNewName(), honorsChangeAnnotations);
} catch (UserErrorException e) {
this.clientLogger.notifyUser("Rename", e);
} catch (Throwable e) {
String msg = "Operation 'text/rename' failed!";
this.clientLogger.logError(LSContextOperation.TXT_RENAME, msg, e, params.getTextDocument(),
params.getPosition());
}
return new WorkspaceEdit();
});
}

Line under review: return RenameUtil.rename(context, params.getNewName(), honorsChangeAnnotations);

Code after addressing the review:
public CompletableFuture<WorkspaceEdit> rename(RenameParams params) {
return CompletableFuture.supplyAsync(() -> {
try {
RenameContext context = ContextBuilder.buildRenameContext(params,
this.workspaceManager,
this.serverContext,
this.clientCapabilities);
return RenameUtil.rename(context);
} catch (UserErrorException e) {
this.clientLogger.notifyUser("Rename", e);
} catch (Throwable e) {
String msg = "Operation 'text/rename' failed!";
this.clientLogger.logError(LSContextOperation.TXT_RENAME, msg, e, params.getTextDocument(),
params.getPosition());
}
return null;
});
}
Code review comment: It can be done. But that would require altering all the tests that use this constant value. Will that be fine if we do that?

Code before review:
public void testEmptyLzoProgress() throws IOException {
File tmpFile = tmpFolder.newFile("empty.lzo_deflate");
String filename = tmpFile.toPath().toString();
writeFile(tmpFile, new byte[0], CompressionMode.LZO);
PipelineOptions options = PipelineOptionsFactory.create();
CompressedSource<Byte> source =
CompressedSource.from(new ByteSource(filename, 1)).withDecompression(CompressionMode.LZO);
try (BoundedReader<Byte> readerOrig = source.createReader(options)) {
assertThat(readerOrig, instanceOf(CompressedReader.class));
CompressedReader<Byte> reader = (CompressedReader<Byte>) readerOrig;
assertEquals(0.0, reader.getFractionConsumed(), 1e-6);
assertEquals(0, reader.getSplitPointsConsumed());
assertEquals(1, reader.getSplitPointsRemaining());
assertFalse(reader.start());
assertEquals(1.0, reader.getFractionConsumed(), 1e-6);
assertEquals(0, reader.getSplitPointsConsumed());
assertEquals(0, reader.getSplitPointsRemaining());
}
}

Line under review: assertEquals(0.0, reader.getFractionConsumed(), 1e-6);

Code after addressing the review:
public void testEmptyLzoProgress() throws IOException {
File tmpFile = tmpFolder.newFile("empty.lzo_deflate");
String filename = tmpFile.toPath().toString();
writeFile(tmpFile, new byte[0], CompressionMode.LZO);
PipelineOptions options = PipelineOptionsFactory.create();
CompressedSource<Byte> source =
CompressedSource.from(new ByteSource(filename, 1)).withDecompression(CompressionMode.LZO);
try (BoundedReader<Byte> readerOrig = source.createReader(options)) {
assertThat(readerOrig, instanceOf(CompressedReader.class));
CompressedReader<Byte> reader = (CompressedReader<Byte>) readerOrig;
assertEquals(0.0, reader.getFractionConsumed(), delta);
assertEquals(0, reader.getSplitPointsConsumed());
assertEquals(1, reader.getSplitPointsRemaining());
assertFalse(reader.start());
assertEquals(1.0, reader.getFractionConsumed(), delta);
assertEquals(0, reader.getSplitPointsConsumed());
assertEquals(0, reader.getSplitPointsRemaining());
}
}
Code review comment: I think this should be changed to get/setOptionalParticipation()

Code before review:
public By withOptionalParticipation() {
return toBuilder().setOuterJoinParticipation(true).build();
}

Line under review: return toBuilder().setOuterJoinParticipation(true).build();

Code after addressing the review:
public By withOptionalParticipation() {
return toBuilder().setOptionalParticipation(true).build();
}
Code review comment: I just want to have this check in one place so it's easy to change if needed in the future. I could change this line to `configserverConfig.cloud().equals("aws") || configserverConfig.cloud().equals("gcp")` if you think that's better?

Code before review:
public Zone(ConfigserverConfig configserverConfig, CloudConfig cloudConfig) {
this(Cloud.builder()
.name(CloudName.from(configserverConfig.cloud()))
.dynamicProvisioning(cloudConfig.dynamicProvisioning())
.allowHostSharing(cloudConfig.allowHostSharing())
.allowEnclave(cloudConfig.dynamicProvisioning())
.requireAccessControl(cloudConfig.requireAccessControl())
.account(CloudAccount.from(cloudConfig.account()))
.build(),
SystemName.from(configserverConfig.system()),
Environment.from(configserverConfig.environment()),
RegionName.from(configserverConfig.region()));
}

Line under review: .allowEnclave(cloudConfig.dynamicProvisioning())

Code after addressing the review:
public Zone(ConfigserverConfig configserverConfig, CloudConfig cloudConfig) {
this(Cloud.builder()
.name(CloudName.from(configserverConfig.cloud()))
.dynamicProvisioning(cloudConfig.dynamicProvisioning())
.allowHostSharing(cloudConfig.allowHostSharing())
.allowEnclave(cloudConfig.dynamicProvisioning())
.requireAccessControl(cloudConfig.requireAccessControl())
.account(CloudAccount.from(cloudConfig.account()))
.build(),
SystemName.from(configserverConfig.system()),
Environment.from(configserverConfig.environment()),
RegionName.from(configserverConfig.region()));
}
Code review comment: Replace this with a switch case

Code before review:
private void checkDuplicateVarRefs(List<BLangExpression> varRefs, Set<BSymbol> symbols) {
for (BLangExpression varRef : varRefs) {
NodeKind kind = varRef.getKind();
if (kind == NodeKind.SIMPLE_VARIABLE_REF) {
BLangSimpleVarRef simpleVarRef = (BLangSimpleVarRef) varRef;
if (simpleVarRef.symbol != null && !symbols.add(simpleVarRef.symbol)) {
this.dlog.error(varRef.pos, DiagnosticErrorCode.DUPLICATE_VARIABLE_IN_BINDING_PATTERN,
simpleVarRef.symbol);
}
} else if (kind == NodeKind.RECORD_VARIABLE_REF) {
checkDuplicateVarRefs(getVarRefs((BLangRecordVarRef) varRef), symbols);
} else if (kind == NodeKind.ERROR_VARIABLE_REF) {
checkDuplicateVarRefs(getVarRefs((BLangErrorVarRef) varRef), symbols);
} else if (kind == NodeKind.TUPLE_VARIABLE_REF) {
checkDuplicateVarRefs(getVarRefs((BLangTupleVarRef) varRef), symbols);
}
}
}

Line under review: if (kind == NodeKind.SIMPLE_VARIABLE_REF) {

Code after addressing the review:
private void checkDuplicateVarRefs(List<BLangExpression> varRefs, Set<BSymbol> symbols) {
for (BLangExpression varRef : varRefs) {
NodeKind kind = varRef.getKind();
switch (kind) {
case SIMPLE_VARIABLE_REF:
BLangSimpleVarRef simpleVarRef = (BLangSimpleVarRef) varRef;
if (simpleVarRef.symbol != null && !symbols.add(simpleVarRef.symbol)) {
this.dlog.error(varRef.pos, DiagnosticErrorCode.DUPLICATE_VARIABLE_IN_BINDING_PATTERN,
simpleVarRef.symbol);
}
break;
case RECORD_VARIABLE_REF:
checkDuplicateVarRefs(getVarRefs((BLangRecordVarRef) varRef), symbols);
break;
case ERROR_VARIABLE_REF:
checkDuplicateVarRefs(getVarRefs((BLangErrorVarRef) varRef), symbols);
break;
case TUPLE_VARIABLE_REF:
checkDuplicateVarRefs(getVarRefs((BLangTupleVarRef) varRef), symbols);
break;
default:
}
}
}
Code review comment: Services are more @Sanne expertise, but it seems to make sense. I'm surprised that the failure only happens for native queries if this is what was missing.

Code before review:
void services(BuildProducer<ServiceProviderBuildItem> producer) {
producer.produce(
new ServiceProviderBuildItem(org.hibernate.service.spi.SessionFactoryServiceContributor.class.getName(),
org.hibernate.reactive.service.internal.ReactiveSessionFactoryServiceContributor.class.getName()));
}

Line under review: org.hibernate.reactive.service.internal.ReactiveSessionFactoryServiceContributor.class.getName()));

Code after addressing the review:
void services(BuildProducer<ServiceProviderBuildItem> producer) {
producer.produce(
new ServiceProviderBuildItem(org.hibernate.service.spi.SessionFactoryServiceContributor.class.getName(),
org.hibernate.reactive.service.internal.ReactiveSessionFactoryServiceContributor.class.getName()));
}
Code review comment: How do we get the executor service from ExecutorOptions? As far as I can see, PipelineOptions should be then a reader field, but how do we get the ExecutorService from PipelineOptions?

Code before review:
private void doClose() {
try {
closeAutoscaler();
closeConsumer();
ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
executorService.schedule(
() -> {
LOG.debug(
"Closing session and connection after delay {}", source.spec.getCloseTimeout());
checkpointMark.discard();
closeSession();
closeConnection();
},
source.spec.getCloseTimeout(),
TimeUnit.MILLISECONDS);
} catch (Exception e) {
LOG.error("Error closing reader", e);
}
}

Line under review: ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();

Code after addressing the review:
private void doClose() {
try {
closeAutoscaler();
closeConsumer();
ScheduledExecutorService executorService =
options.as(ExecutorOptions.class).getScheduledExecutorService();
executorService.schedule(
() -> {
LOG.debug(
"Closing session and connection after delay {}", source.spec.getCloseTimeout());
checkpointMark.discard();
closeSession();
closeConnection();
},
source.spec.getCloseTimeout().getMillis(),
TimeUnit.MILLISECONDS);
} catch (Exception e) {
LOG.error("Error closing reader", e);
}
}