muttakin2301/ccr2000 huggingface dataset:
Code review comment: `throw new NumberFormatException("invalid id: " + id + " " + e.getMessage());`

Code under review:
public static TUniqueId parseTUniqueIdFromString(String id) {
        if (Strings.isNullOrEmpty(id)) {
            throw new NumberFormatException("invalid query id");
        }

        String[] parts = id.split("-");
        if (parts.length != 2) {
            throw new NumberFormatException("invalid query id");
        }

        TUniqueId uniqueId = new TUniqueId();
        try {
            uniqueId.setHi(Long.parseUnsignedLong(parts[0], 16));
            uniqueId.setLo(Long.parseUnsignedLong(parts[1], 16));
        } catch (NumberFormatException e) {
            throw new NumberFormatException("invalid query id:" + e.getMessage());
        }

        return uniqueId;
    }

Line commented on: throw new NumberFormatException("invalid query id:" + e.getMessage());

Revised code:
public static TUniqueId parseTUniqueIdFromString(String id) {
        if (Strings.isNullOrEmpty(id)) {
            throw new NumberFormatException("invalid query id");
        }

        String[] parts = id.split("-");
        if (parts.length != 2) {
            throw new NumberFormatException("invalid query id");
        }

        TUniqueId uniqueId = new TUniqueId();
        try {
            uniqueId.setHi(Long.parseUnsignedLong(parts[0], 16));
            uniqueId.setLo(Long.parseUnsignedLong(parts[1], 16));
        } catch (NumberFormatException e) {
            throw new NumberFormatException("invalid query id:" + e.getMessage());
        }

        return uniqueId;
    }
Code review comment: Missing space between text end and URL

Code under review:
private void validateMajorVersion(TenantAndApplicationId id, Submission submission) {
        submission.applicationPackage().deploymentSpec().majorVersion().ifPresent(explicitMajor -> {
            if (explicitMajor < 8)
                controller.notificationsDb().setNotification(NotificationSource.from(id),
                                                             Type.applicationPackage,
                                                             Notification.Level.warning,
                                                             "Vespa 7 will soon be end of life, upgrade to Vespa 8 now:" +
                                                             "https:
            else
                controller.notificationsDb().removeNotification(NotificationSource.from(id), Type.applicationPackage);
        });
    }

Line commented on: "Vespa 7 will soon be end of life, upgrade to Vespa 8 now:" +

Revised code:
private void validateMajorVersion(TenantAndApplicationId id, Submission submission) {
        submission.applicationPackage().deploymentSpec().majorVersion().ifPresent(explicitMajor -> {
            if (explicitMajor < 8)
                controller.notificationsDb().setNotification(NotificationSource.from(id),
                                                             Type.applicationPackage,
                                                             Notification.Level.warning,
                                                             "Vespa 7 will soon be end of life, upgrade to Vespa 8 now:" +
                                                             "https:
            else
                controller.notificationsDb().removeNotification(NotificationSource.from(id), Type.applicationPackage);
        });
    }
Code review comment: Now we need to check for null here too.

Code under review:
private void ensureClusterTableIsUpdated() {
        try {
            if (0 == engine.get().getStatus(newContext().getCairoSecurityContext(), new Path(), clusterTable.name)) {
                
            }
        } catch (Exception e) {
            clusterTable.repair(e);
        }
    }

Line commented on: if (0 == engine.get().getStatus(newContext().getCairoSecurityContext(), new Path(), clusterTable.name)) {

Revised code:
private void ensureClusterTableIsUpdated() {
        try {
            if (0 == engine().getStatus(newContext().getCairoSecurityContext(), new Path(), clusterTable.name)) {
                
            }
        } catch (Exception e) {
            clusterTable.repair(e);
        }
    }
Code review comment: Do you mean I added a log message before throw statement. Done.

Code under review:
public URL getQueueUrl() {
        try {
            return new URL(client.url());
        } catch (MalformedURLException ex) {
            throw new RuntimeException("Queue URL is malformed");
        }
    }

Line commented on: throw new RuntimeException("Queue URL is malformed");

Revised code:
public URL getQueueUrl() {
        try {
            return new URL(client.url());
        } catch (MalformedURLException ex) {
            LOGGER.asError().log("Queue URL is malformed");
            throw new RuntimeException("Queue URL is malformed");
        }
    }
Code review comment: <!--thread_id:cc_182613813_t; commit:a16a978c74d440d81ca78b3c44be72eae312ef74; resolved:1--> <!--section:context-quote--> > **tgroh** wrote: > Why is this uninterruptible?  <!--section:body--> To ensure that we sleep fully for the amount of time requested. Given that we don't use interrupts anywhere in Beam code, we don't expect this to happen anyway. Alternatively we could just crash on interrupts (i.e., throw a RuntimeException wrapping the interruption).

Code under review:
public State waitUntilFinish(Duration duration) {
    if (duration.compareTo(Duration.millis(1)) < 1) {
      
      return waitUntilFinish();
    } else {
      CompletableFuture<State> result = CompletableFuture.supplyAsync(this::waitUntilFinish);
      try {
        return Uninterruptibles.getUninterruptibly(
            result, duration.getMillis(), TimeUnit.MILLISECONDS);
      } catch (TimeoutException e) {
        
        return null;
      } catch (ExecutionException e) {
        throw new RuntimeException(e);
      }
    }
  }

Line commented on: return Uninterruptibles.getUninterruptibly(

Revised code:
public State waitUntilFinish(Duration duration) {
    if (duration.compareTo(Duration.millis(1)) < 1) {
      
      return waitUntilFinish();
    } else {
      CompletableFuture<State> result = CompletableFuture.supplyAsync(this::waitUntilFinish);
      try {
        return result.get(duration.getMillis(), TimeUnit.MILLISECONDS);
      } catch (TimeoutException e) {
        
        return null;
      } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
        throw new RuntimeException(e);
      } catch (ExecutionException e) {
        throw new RuntimeException(e);
      }
    }
  }
Code review comment: Hehe. You don't have a bad point.

Code under review:
public Optional<String> oldestIncompleteResultId() {
        synchronized (monitor) {
            return Optional.of(docSendInfoByOperationId.keySet().iterator())
                           .filter(Iterator::hasNext)
                           .map(Iterator::next);
        }
    }

Line commented on: return Optional.of(docSendInfoByOperationId.keySet().iterator())

Revised code:
public Optional<String> oldestIncompleteResultId() {
        synchronized (monitor) {
            return docSendInfoByOperationId.isEmpty()
                    ? Optional.empty()
                    : Optional.of(docSendInfoByOperationId.keySet().iterator().next());
        }
    }
Code review comment: ```suggestion         List<PrivEntry> userPrivEntryList = map.get(userIdentity); ```

Code under review:
public void dropEntry(PrivEntry entry) {
        UserIdentity userIdentity = entry.getUserIdent();
        List<PrivEntry> userPrivEntryList = map.get(entry.getUserIdent());
        if (userPrivEntryList == null) {
            return;
        }
        Iterator<PrivEntry> iter = userPrivEntryList.iterator();
        while (iter.hasNext()) {
            PrivEntry privEntry = iter.next();
            if (privEntry.keyMatch(entry)) {
                iter.remove();
                LOG.info("drop priv entry: {}", privEntry);
                break;
            }
        }
        if (userPrivEntryList.isEmpty()) {
            map.remove(userIdentity);
        }
    }

Line commented on: List<PrivEntry> userPrivEntryList = map.get(entry.getUserIdent());

Revised code:
public void dropEntry(PrivEntry entry) {
        UserIdentity userIdentity = entry.getUserIdent();
        List<PrivEntry> userPrivEntryList = map.get(userIdentity);
        if (userPrivEntryList == null) {
            return;
        }
        Iterator<PrivEntry> iter = userPrivEntryList.iterator();
        while (iter.hasNext()) {
            PrivEntry privEntry = iter.next();
            if (privEntry.keyMatch(entry)) {
                iter.remove();
                LOG.info("drop priv entry: {}", privEntry);
                break;
            }
        }
        if (userPrivEntryList.isEmpty()) {
            map.remove(userIdentity);
        }
    }
Code review comment: Hello @gastaldi, in this specific testcase I was just interested in seeing if the `Multi-Release: true` attribtue made it into the jar file and for that test, using any variant of `JarFile` constructor and then calling the `isMultiRelease()` works fine.

Code under review:
private void verifyUberJar() throws IOException {
        final File targetDir = getTargetDir();
        List<File> jars = getFilesEndingWith(targetDir, ".jar");
        assertThat(jars).hasSize(1);
        assertThat(getNumberOfFilesEndingWith(targetDir, ".original")).isEqualTo(1);
        try (JarFile jarFile = new JarFile(jars.get(0))) {
            
            
            
            Assertions.assertTrue(jarFile.isMultiRelease(), "uber-jar " + jars.get(0)
                    + " was expected to be a multi-release jar but wasn't");
        }
        ensureManifestOfJarIsReadableByJarInputStream(jars.get(0));
    }

Line commented on: try (JarFile jarFile = new JarFile(jars.get(0))) {

Revised code:
private void verifyUberJar() throws IOException {
        final File targetDir = getTargetDir();
        List<File> jars = getFilesEndingWith(targetDir, ".jar");
        assertThat(jars).hasSize(1);
        assertThat(getNumberOfFilesEndingWith(targetDir, ".original")).isEqualTo(1);
        try (JarFile jarFile = new JarFile(jars.get(0))) {
            
            
            
            Assertions.assertTrue(jarFile.isMultiRelease(), "uber-jar " + jars.get(0)
                    + " was expected to be a multi-release jar but wasn't");
        }
        ensureManifestOfJarIsReadableByJarInputStream(jars.get(0));
    }
Code review comment: Yes `super.trySplit()` handles empty range. The special case here is to handle `range.getTo() == range.getFrom == Long.MAX_VALUE`.

Code under review:
public SplitResult<OffsetRange> trySplit(double fractionOfRemainder) {
    
    if (range.getTo() != Long.MAX_VALUE || range.getTo() == range.getFrom()) {
      return super.trySplit(fractionOfRemainder);
    }
    long cur = (lastAttemptedOffset == null) ? range.getFrom() - 1 : lastAttemptedOffset;

    
    if (cur == Long.MAX_VALUE) {
      return null;
    }
    
    
    long estimateLatestOffset = Long.max(poller.estimateRangeEnd(), cur + 1);
    long splitPos =
        cur
            + Math.max(
                1L,
                (Double.valueOf((estimateLatestOffset - cur) * fractionOfRemainder)).longValue());

    if (splitPos > estimateLatestOffset) {
      return null;
    }
    OffsetRange res = new OffsetRange(splitPos, range.getTo());
    this.range = new OffsetRange(range.getFrom(), splitPos);
    return SplitResult.of(range, res);
  }

Line commented on: 1L,

Revised code:
public SplitResult<OffsetRange> trySplit(double fractionOfRemainder) {
    
    if (range.getTo() != Long.MAX_VALUE || range.getTo() == range.getFrom()) {
      return super.trySplit(fractionOfRemainder);
    }
    
    if (lastAttemptedOffset != null && lastAttemptedOffset == Long.MAX_VALUE) {
      return null;
    }
    BigDecimal cur =
        (lastAttemptedOffset == null)
            ? BigDecimal.valueOf(range.getFrom()).subtract(BigDecimal.ONE, MathContext.DECIMAL128)
            : BigDecimal.valueOf(lastAttemptedOffset);

    
    
    BigDecimal estimateRangeEnd =
        BigDecimal.valueOf(rangeEndEstimator.estimate())
            .max(cur.add(BigDecimal.ONE, MathContext.DECIMAL128));

    
    
    
    BigDecimal splitPos =
        cur.add(
            estimateRangeEnd
                .subtract(cur, MathContext.DECIMAL128)
                .multiply(BigDecimal.valueOf(fractionOfRemainder), MathContext.DECIMAL128)
                .max(BigDecimal.ONE),
            MathContext.DECIMAL128);
    long split = splitPos.longValue();
    if (split > estimateRangeEnd.longValue()) {
      return null;
    }
    OffsetRange res = new OffsetRange(split, range.getTo());
    this.range = new OffsetRange(range.getFrom(), split);
    return SplitResult.of(range, res);
  }
Code review comment: Guilty as charged! Should be fixed now :)

Code under review:
protected void implementIfExistsGetReception(ClassCreator observerCreator) {
        MethodCreator getObservedType = observerCreator.getMethodCreator("getReception", Reception.class)
                .setModifiers(ACC_PUBLIC);
        getObservedType.returnValue(getObservedType.load(Reception.IF_EXISTS));
    }

Line commented on: getObservedType.returnValue(getObservedType.load(Reception.IF_EXISTS));

Revised code:
protected void implementIfExistsGetReception(ClassCreator observerCreator) {
        MethodCreator getReception = observerCreator.getMethodCreator("getReception", Reception.class)
                .setModifiers(ACC_PUBLIC);
        getReception.returnValue(getReception.load(Reception.IF_EXISTS));
    }
Code review comment: nit: you don't need to specify `this`. There is no other variable declared in this scope with the same name.

Code under review:
public int maxRetryCount() {
        return this.maxRetryCount;
    }

Line commented on: return this.maxRetryCount;

Revised code:
public int maxRetryCount() {
        return maxRetryCount;
    }
Code review comment: ```suggestion         return exprNode.isPresent()? exprNode : Optional.empty(); ```  Is this further simplification possible?

Code under review:
public Optional<ExpressionNode> findExpression(Node node) {
        if (node == null) {
            return Optional.empty();
        }

        Optional<ExpressionNode> exprNode = node.apply(this);
        
        if (exprNode == null) {
            return Optional.empty();
        }
        
        return exprNode;
    }

Line commented on: return exprNode;

Revised code:
public Optional<ExpressionNode> findExpression(Node node) {
        if (node == null) {
            return Optional.empty();
        }

        Optional<ExpressionNode> exprNode = node.apply(this);
        
        return exprNode == null ? Optional.empty() : exprNode;
    }
Code review comment: Please also fix same issue further down in `getShardIterator` (https://github.com/apache/flink/pull/7706/files#diff-ed02b5340df65de06c19eb93fe90a920L340)

Code under review:
public GetRecordsResult getRecords(String shardIterator, int maxRecordsToGet) throws InterruptedException {
		final GetRecordsRequest getRecordsRequest = new GetRecordsRequest();
		getRecordsRequest.setShardIterator(shardIterator);
		getRecordsRequest.setLimit(maxRecordsToGet);

		GetRecordsResult getRecordsResult = null;

		int retryCount = 0;
		while (retryCount <= getRecordsMaxRetries && getRecordsResult == null) {
			try {
				getRecordsResult = kinesisClient.getRecords(getRecordsRequest);
			} catch (SdkClientException ex) {
				if (isRecoverableSdkClientException(ex)) {
					long backoffMillis = fullJitterBackoff(
						getRecordsBaseBackoffMillis, getRecordsMaxBackoffMillis, getRecordsExpConstant, retryCount++);
					LOG.warn("Got recoverable SdkClientException. Backing off for "
						+ backoffMillis + " millis (" + ex.getClass().getName() + ": " + ex.getMessage() + ")");
					Thread.sleep(backoffMillis);
				} else {
					throw ex;
				}
			}
		}

		if (getRecordsResult == null) {
			throw new RuntimeException("Retries exceeded for getRecords operation - all " + getRecordsMaxRetries +
				" retry attempts failed.");
		}

		return getRecordsResult;
	}

Line commented on: throw new RuntimeException("Retries exceeded for getRecords operation - all " + getRecordsMaxRetries +

Revised code:
public GetRecordsResult getRecords(String shardIterator, int maxRecordsToGet) throws InterruptedException {
		final GetRecordsRequest getRecordsRequest = new GetRecordsRequest();
		getRecordsRequest.setShardIterator(shardIterator);
		getRecordsRequest.setLimit(maxRecordsToGet);

		GetRecordsResult getRecordsResult = null;

		int retryCount = 0;
		while (retryCount <= getRecordsMaxRetries && getRecordsResult == null) {
			try {
				getRecordsResult = kinesisClient.getRecords(getRecordsRequest);
			} catch (SdkClientException ex) {
				if (isRecoverableSdkClientException(ex)) {
					long backoffMillis = fullJitterBackoff(
						getRecordsBaseBackoffMillis, getRecordsMaxBackoffMillis, getRecordsExpConstant, retryCount++);
					LOG.warn("Got recoverable SdkClientException. Backing off for "
						+ backoffMillis + " millis (" + ex.getClass().getName() + ": " + ex.getMessage() + ")");
					Thread.sleep(backoffMillis);
				} else {
					throw ex;
				}
			}
		}

		if (getRecordsResult == null) {
			throw new RuntimeException("Retries exceeded for getRecords operation - all " + getRecordsMaxRetries +
				" retry attempts failed.");
		}

		return getRecordsResult;
	}
Code review comment: This check won't always work as expected and won't comply with the changes made in PR #4194.

Code under review:
public void logAndThrow(RuntimeException runtimeException) {
        if (runtimeException == null) {
            return;
        }

        
        if (canLogAtLevel(level)) {
            logger.error("", runtimeException);
        }
        throw runtimeException;
    }

Line commented on: if (canLogAtLevel(level)) {

Revised code:
public void logAndThrow(RuntimeException runtimeException) {
        if (runtimeException == null) {
            return;
        }

        
        if (canLogAtLevel(ERROR_LEVEL)) {
            logger.error(runtimeException.getMessage(), runtimeException);
        }
        throw runtimeException;
    }
Code review comment: is it better to set it as not materialized instead of remove it?

Code under review:
public void substitutePreRepeatExprs(ExprSubstitutionMap smap, Analyzer analyzer) {
        ArrayList<Expr> originalPreRepeatExprs = new ArrayList<>(preRepeatExprs);
        preRepeatExprs = Expr.substituteList(preRepeatExprs, smap, analyzer, true);

        
        ArrayList<Expr> materializedPreRepeatExprs = new ArrayList<>();
        ArrayList<Expr> unMaterializedSlotRefs = new ArrayList<>();
        for (int i = 0; i < preRepeatExprs.size(); ++i) {
            Expr expr = preRepeatExprs.get(i);
            if (expr instanceof SlotRef && !((SlotRef) expr).getDesc().isMaterialized()) {
                unMaterializedSlotRefs.add(originalPreRepeatExprs.get(i));
            } else {
                materializedPreRepeatExprs.add(expr);
            }
        }
        preRepeatExprs = materializedPreRepeatExprs;

        
        for (Expr expr : unMaterializedSlotRefs) {
            Expr rExpr = outputTupleSmap.get(expr);
            outputTupleSmap.removeByRhsExpr(rExpr);
            if (rExpr instanceof SlotRef) {
                outputTupleDesc.getSlots().remove(((SlotRef) rExpr).getDesc());
            }
        }
    }

Line commented on: outputTupleDesc.getSlots().remove(((SlotRef) rExpr).getDesc());

Revised code:
public void substitutePreRepeatExprs(ExprSubstitutionMap smap, Analyzer analyzer) {
        ArrayList<Expr> originalPreRepeatExprs = new ArrayList<>(preRepeatExprs);
        preRepeatExprs = Expr.substituteList(preRepeatExprs, smap, analyzer, true);

        
        ArrayList<Expr> materializedPreRepeatExprs = new ArrayList<>();
        ArrayList<Expr> unMaterializedSlotRefs = new ArrayList<>();
        for (int i = 0; i < preRepeatExprs.size(); ++i) {
            Expr expr = preRepeatExprs.get(i);
            if (expr instanceof SlotRef && !((SlotRef) expr).getDesc().isMaterialized()) {
                unMaterializedSlotRefs.add(originalPreRepeatExprs.get(i));
            } else {
                materializedPreRepeatExprs.add(expr);
            }
        }
        preRepeatExprs = materializedPreRepeatExprs;

        
        for (Expr expr : unMaterializedSlotRefs) {
            Expr rExpr = outputTupleSmap.get(expr);
            if (rExpr instanceof SlotRef) {
                ((SlotRef) rExpr).getDesc().setIsMaterialized(false);
            }
        }
    }
Code review comment: Oh, oh, I get the idea

Code under review:
private String getShardingColumn(final ShardingStrategyConfiguration shardingStrategyConfig) {
        if (shardingStrategyConfig instanceof ComplexShardingStrategyConfiguration) {
            return ((ComplexShardingStrategyConfiguration) shardingStrategyConfig).getShardingColumns();
        }
        if (shardingStrategyConfig instanceof StandardShardingStrategyConfiguration) {
            String shardingColumn = ((StandardShardingStrategyConfiguration) shardingStrategyConfig).getShardingColumn();
            if (StringUtils.isNotEmpty(shardingColumn)) {
                return shardingColumn;
            }
        }
        return StringUtils.defaultString(defaultShardingColumn, "");
    }

Line commented on: return ((ComplexShardingStrategyConfiguration) shardingStrategyConfig).getShardingColumns();

Revised code:
private String getShardingColumn(final ShardingStrategyConfiguration shardingStrategyConfig) {
        String shardingColumn = defaultShardingColumn;
        if (shardingStrategyConfig instanceof ComplexShardingStrategyConfiguration) {
            shardingColumn = ((ComplexShardingStrategyConfiguration) shardingStrategyConfig).getShardingColumns();
        }
        if (shardingStrategyConfig instanceof StandardShardingStrategyConfiguration) {
            shardingColumn = ((StandardShardingStrategyConfiguration) shardingStrategyConfig).getShardingColumn();
        }
        return StringUtils.defaultString(shardingColumn, "");
    }
Code review comment: Consider creating a new method on tester that allows creating a tenant with a given access role or helper method to update access role so we dont test REST API here, plus it'll be much faster.

Code under review:
public void grantsRoleAccess() {
        var containerTester = new ContainerTester(container, "");
        ((InMemoryFlagSource) containerTester.controller().flagSource())
                .withBooleanFlag(PermanentFlags.ENABLE_PUBLIC_SIGNUP_FLOW.id(), true);
        var tester = new ControllerTester(containerTester);
        var tenantName = tester.createTenant("tenant1", Tenant.Type.cloud);
        containerTester.assertResponse(request("/application/v4/tenant/tenant1/archive-access", PUT)
                        .data("{\"role\":\"arn:aws:iam::123456789012:role/my-role\"}").roles(Role.administrator(tenantName)),
                "{\"message\":\"Archive access role set to 'arn:aws:iam::123456789012:role/my-role' for tenant tenant1.\"}", 200);

        var archiveBucketDb = (MockArchiveBucketDb) tester.controller().serviceRegistry().archiveBucketDb();
        var testBucket = new ArchiveBucket("foo", "bar", Set.of(tenantName));
        archiveBucketDb.addBucket(ZoneId.from("prod.us-east-3"), testBucket);

        MockArchiveService archiveService = (MockArchiveService) tester.controller().serviceRegistry().archiveService();
        assertNull(archiveService.authorizedIamRoles.get(testBucket));
        new ArchiveAccessMaintainer(containerTester.controller(), Duration.ofMinutes(10)).maintain();
        assertEquals("arn:aws:iam::123456789012:role/my-role", archiveService.authorizedIamRoles.get(testBucket).get(tenantName));
    }

Line commented on: containerTester.assertResponse(request("/application/v4/tenant/tenant1/archive-access", PUT)

Revised code:
public void grantsRoleAccess() {
        var containerTester = new ContainerTester(container, "");
        ((InMemoryFlagSource) containerTester.controller().flagSource())
                .withBooleanFlag(PermanentFlags.ENABLE_PUBLIC_SIGNUP_FLOW.id(), true)
                .withStringFlag(Flags.SYNC_HOST_LOGS_TO_S3_BUCKET.id(), "auto");
        var tester = new ControllerTester(containerTester);

        String tenant1role = "arn:aws:iam::123456789012:role/my-role";
        String tenant2role = "arn:aws:iam::210987654321:role/my-role";
        var tenant1 = createTenantWithAccessRole(tester, "tenant1", tenant1role);
        createTenantWithAccessRole(tester, "tenant2", tenant2role);

        tester.controller().archiveBucketDb().archiveUriFor(ZoneId.from("prod.us-east-3"), tenant1);
        var testBucket = new ArchiveBucket("bucketName", "keyArn").withTenant(tenant1);

        MockArchiveService archiveService = (MockArchiveService) tester.controller().serviceRegistry().archiveService();
        assertNull(archiveService.authorizedIamRoles.get(testBucket));
        new ArchiveAccessMaintainer(containerTester.controller(), Duration.ofMinutes(10)).maintain();
        assertEquals(Map.of(tenant1, tenant1role), archiveService.authorizedIamRoles.get(testBucket));
    }
Code review comment: Would like me to throw the exception after all @gsmet?

Code under 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 commented on: getLog().debug("Unable to create Maven Wrapper");

Revised code:
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: Keep in mind that when you inject the stage version of the session, it will be eagerly created. So the Mutiny version is not less efficient.  I had a look at the session implementation code. It seems that a connection is acquired as soon as the session is created. Perhaps this should be delayed until a connection is actually needed. But I don't know if this is possible in practice.

Code under review:
public void disposeMutinySession(@Disposes Uni<Mutiny.Session> reactiveSession) {
        reactiveSession.subscribe().with(Mutiny.Session::close);
    }

Line commented on: reactiveSession.subscribe().with(Mutiny.Session::close);

Revised code:
public void disposeMutinySession(@Disposes Uni<Mutiny.Session> reactiveSession) {
        reactiveSession.subscribe().with(Mutiny.Session::close);
    }
Code review comment: Please check whether there is simiar issue here. Thx.

Code under review:
public ASTNode visitShowColumns(final ShowColumnsContext ctx) {
        ShowColumnsStatement result = new ShowColumnsStatement();
        FromTableContext fromTableContext = ctx.fromTable();
        FromSchemaContext fromSchemaContext = ctx.fromSchema();
        ShowLikeContext showLikeContext = ctx.showLike();
        if (null != fromTableContext) {
            FromTableSegment fromTableSegment = (FromTableSegment) visit(fromTableContext);
            result.setTable(fromTableSegment.getPattern());
            result.getAllSQLSegments().add(fromTableSegment);
        }
        if (null != fromSchemaContext) {
            FromSchemaSegment fromSchemaSegment = (FromSchemaSegment) visit(ctx.fromSchema());
            result.getAllSQLSegments().add(fromSchemaSegment);
        }
        if (null != showLikeContext) {
            ShowLikeSegment showLikeSegment = (ShowLikeSegment) visit(ctx.showLike());
            result.getAllSQLSegments().add(showLikeSegment);
        }
        return result;
    }

Line commented on: FromTableSegment fromTableSegment = (FromTableSegment) visit(fromTableContext);

Revised code:
public ASTNode visitShowColumns(final ShowColumnsContext ctx) {
        ShowColumnsStatement result = new ShowColumnsStatement();
        FromTableContext fromTableContext = ctx.fromTable();
        FromSchemaContext fromSchemaContext = ctx.fromSchema();
        ShowLikeContext showLikeContext = ctx.showLike();
        if (null != fromTableContext) {
            FromTableSegment fromTableSegment = (FromTableSegment) visit(fromTableContext);
            result.setTable(fromTableSegment.getPattern());
            result.getAllSQLSegments().add(fromTableSegment);
        }
        if (null != fromSchemaContext) {
            FromSchemaSegment fromSchemaSegment = (FromSchemaSegment) visit(ctx.fromSchema());
            result.getAllSQLSegments().add(fromSchemaSegment);
        }
        if (null != showLikeContext) {
            ShowLikeSegment showLikeSegment = (ShowLikeSegment) visit(ctx.showLike());
            result.getAllSQLSegments().add(showLikeSegment);
        }
        return result;
    }
Code review comment: Different variables has different upper limits

Code under review:
private void checkRangeLongVariable(String field, Long min, Long max) {
        String value = getResolvedExpression().getStringValue();
        try {
            long num = Long.parseLong(value);
            if (min != null && num < min) {
                throw new SemanticException(String.format("%s must be equal or greater than %d.", field, min));
            }
            if (max != null && num > max) {
                throw new SemanticException(String.format("%s must be equal or smaller than %d.", field, max));
            }
        } catch (NumberFormatException ex) {
            throw new SemanticException(field + " is not a number");
        }
    }

Line commented on: if (max != null && num > max) {

Revised code:
private void checkRangeLongVariable(String field, Long min, Long max) {
        String value = getResolvedExpression().getStringValue();
        try {
            long num = Long.parseLong(value);
            if (min != null && num < min) {
                throw new SemanticException(String.format("%s must be equal or greater than %d.", field, min));
            }
            if (max != null && num > max) {
                throw new SemanticException(String.format("%s must be equal or smaller than %d.", field, max));
            }
        } catch (NumberFormatException ex) {
            throw new SemanticException(field + " is not a number");
        }
    }
Code review comment: It wouldn't reduce actual number of lines, but it would reduce the amount of duplicated code a bit (one line can have more embedded logic then the another one). For example after changing from `int[] selectChannels(...)` to `int selectChannel(...)` you would have 6 fewer places to fix.  But as I wrote before, I'm not sure if it's worth. As you prefer :)

Code under review:
public void testSelectChannelsInterval() {
		sd.setInstance(streamRecord);

		assertEquals(0, streamPartitioner.selectChannels(sd, 1)[0]);
		assertEquals(0, streamPartitioner.selectChannels(sd, 2)[0]);
		assertEquals(0, streamPartitioner.selectChannels(sd, 1024)[0]);
	}

Line commented on: assertEquals(0, streamPartitioner.selectChannels(sd, 1)[0]);

Revised code:
public void testSelectChannelsInterval() {
		assertSelectedChannel(0, 1);
		assertSelectedChannel(0, 2);
		assertSelectedChannel(0, 1024);
	}
Code review comment: The returned value is only the instance name, since it returns the last path segment

Code under review:
public static Optional<String> getInstanceName(List<SubjectAlternativeName> sans) {
        return getLastSegmentFromSanUri(sans, "athenz:
    }

Line commented on: return getLastSegmentFromSanUri(sans, "athenz:

Revised code:
public static Optional<String> getInstanceName(List<SubjectAlternativeName> sans) {
        return getLastSegmentFromSanUri(sans, "athenz:
    }
Code review comment: ```suggestion         Objects.requireNonNull(decryptParameters, "'decryptParameters' cannot be null"); ```

Code under review:
public Mono<DecryptResult> decrypt(DecryptParameters decryptParameters) {
        Objects.requireNonNull(decryptParameters, "'decryptOptions' cannot be null");

        try {
            return withContext(context -> decrypt(decryptParameters, context));
        } catch (RuntimeException ex) {
            return monoError(logger, ex);
        }
    }

Line commented on: Objects.requireNonNull(decryptParameters, "'decryptOptions' cannot be null");

Revised code:
public Mono<DecryptResult> decrypt(DecryptParameters decryptParameters) {
        Objects.requireNonNull(decryptParameters, "'decryptParameters' cannot be null");

        try {
            return withContext(context -> decrypt(decryptParameters, context));
        } catch (RuntimeException ex) {
            return monoError(logger, ex);
        }
    }
Code review comment: @cescoffier: I switched to using the string version as you suggested. When adding the deployment dependencies, the build didn't work anymore anyways. The current version worked for me.

Code under review:
UnremovableBeanBuildItem ensureJsonParserAvailable() {
        return UnremovableBeanBuildItem.beanTypes(ObjectMapper.class, Jsonb.class);
    }

Line commented on: return UnremovableBeanBuildItem.beanTypes(ObjectMapper.class, Jsonb.class);

Revised code:
UnremovableBeanBuildItem ensureJsonParserAvailable() {
        return UnremovableBeanBuildItem.beanClassNames(
                "io.quarkus.jackson.ObjectMapperProducer",
                "com.fasterxml.jackson.databind.ObjectMapper",
                "io.quarkus.jsonb.JsonbProducer",
                "javax.json.bind.Jsonb");
    }
Code review comment: Yes, these `checkState`s should be in `finally`. Thanks!

Code under review:
public void testBufferRecycledOnFailure() throws IOException {
		FailingChannelStateSerializer serializer = new FailingChannelStateSerializer();
		TestRecoveredChannelStateHandler handler = new TestRecoveredChannelStateHandler();

		try (FSDataInputStream stream = geStream(serializer, 10)) {
			new ChannelStateChunkReader(serializer).readChunk(stream, serializer.getHeaderLength(), handler, "channelInfo");
			checkState(serializer.failed);
			checkState(!handler.requestedBuffers.isEmpty());
		} finally {
			assertTrue(handler.requestedBuffers.stream().allMatch(TestChannelStateByteBuffer::isRecycled));
		}
	}

Line commented on: checkState(serializer.failed);

Revised code:
public void testBufferRecycledOnFailure() throws IOException, InterruptedException {
		FailingChannelStateSerializer serializer = new FailingChannelStateSerializer();
		TestRecoveredChannelStateHandler handler = new TestRecoveredChannelStateHandler();

		try (FSDataInputStream stream = getStream(serializer, 10)) {
			new ChannelStateChunkReader(serializer).readChunk(stream, serializer.getHeaderLength(), handler, "channelInfo");
		} finally {
			checkState(serializer.failed);
			checkState(!handler.requestedBuffers.isEmpty());
			assertTrue(handler.requestedBuffers.stream().allMatch(TestChannelStateByteBuffer::isRecycled));
		}
	}
Code review comment: I don't think you can actually get here. The parser rejects non-SQL UDFs that don't specify a return type.  I changed it to IllegalArgumentException.

Code under review:
void validateJavaUdf(ResolvedNodes.ResolvedCreateFunctionStmt createFunctionStmt) {
    for (FunctionArgumentType argumentType :
        createFunctionStmt.getSignature().getFunctionArgumentList()) {
      Type type = argumentType.getType();
      if (type == null) {
        throw new UnsupportedOperationException("UDF templated argument types are not supported.");
      }
      validateJavaUdfZetaSqlType(type);
    }
    if (createFunctionStmt.getReturnType() == null) {
      throw new NullPointerException("UDF return type must not be null.");
    }
    validateJavaUdfZetaSqlType(createFunctionStmt.getReturnType());
  }

Line commented on: throw new NullPointerException("UDF return type must not be null.");

Revised code:
void validateJavaUdf(ResolvedNodes.ResolvedCreateFunctionStmt createFunctionStmt) {
    for (FunctionArgumentType argumentType :
        createFunctionStmt.getSignature().getFunctionArgumentList()) {
      Type type = argumentType.getType();
      if (type == null) {
        throw new UnsupportedOperationException("UDF templated argument types are not supported.");
      }
      validateJavaUdfZetaSqlType(type);
    }
    if (createFunctionStmt.getReturnType() == null) {
      throw new IllegalArgumentException("UDF return type must not be null.");
    }
    validateJavaUdfZetaSqlType(createFunctionStmt.getReturnType());
  }
Code review comment: `null instanceof X` is always false so checking for null is redundant.

Code under review:
public boolean equals(@Nullable Object o) {
    if (this == o) {
      return true;
    }
    if (!(o instanceof WeightedValue)) {
      return false;
    }
    WeightedValue<?> that = (WeightedValue<?>) o;
    return weight == that.weight && Objects.equals(value, that.value);
  }

Line commented on: if (!(o instanceof WeightedValue)) {

Revised code:
public boolean equals(@Nullable Object o) {
    if (this == o) {
      return true;
    }
    if (!(o instanceof WeightedValue)) {
      return false;
    }
    WeightedValue<?> that = (WeightedValue<?>) o;
    return weight == that.weight && Objects.equals(value, that.value);
  }
Code review comment: move this after `configByConfiguration.addConfiguration(configuration);`

Code under review:
public void testGetInvalidLocalTimeZone() {
        expectedException.expectMessage(
                "The supported Zone ID is either an abbreviation such as 'PST',"
                        + " a full name such as 'America/Los_Angeles', or a custom timezone id such as 'GMT-8:00',"
                        + " but configured Zone ID is 'UTC+8'.");
        configuration.setString("table.local-time-zone", "UTC+8");
        configByConfiguration.addConfiguration(configuration);
        configByConfiguration.getLocalTimeZone();
    }

Line commented on: "The supported Zone ID is either an abbreviation such as 'PST',"

Revised code:
public void testGetInvalidLocalTimeZone() {
        configuration.setString("table.local-time-zone", "UTC+8");
        configByConfiguration.addConfiguration(configuration);
        expectedException.expectMessage(
                "The supported Zone ID is either a full name such as 'America/Los_Angeles',"
                        + " or a custom timezone id such as 'GMT-8:00', but configured Zone ID is 'UTC+8'.");
        configByConfiguration.getLocalTimeZone();
    }
Code review comment: Yes, by platform I meant JRE + OS + hardware (and when I briefly checked open-j9 this method was native and linux had suitable syscalls). But anyways I've already changed the code to 1ms.

Code under review:
private void buildGraph(StreamExecutionEnvironment env) {
        
        
        env.fromSource(
                        new NumberSequenceSource(0, Long.MAX_VALUE),
                        WatermarkStrategy.noWatermarks(),
                        "num-source")
                
                .keyBy(value -> value)
                
                .map(
                        value -> {
                            Thread.sleep(0, 100);
                            return value;
                        })
                .addSink(new DiscardingSink<>());
    }

Line commented on: Thread.sleep(0, 100);

Revised code:
private void buildGraph(StreamExecutionEnvironment env) {
        
        
        env.fromSource(
                        new NumberSequenceSource(0, Long.MAX_VALUE),
                        WatermarkStrategy.noWatermarks(),
                        "num-source")
                
                .keyBy(value -> value)
                
                .map(
                        value -> {
                            Thread.sleep(1);
                            return value;
                        })
                .addSink(new DiscardingSink<>());
    }
Code review comment: Can you add sql parser test case for this change?

Code under review:
public ASTNode visitTableStatement(final TableStatementContext ctx) {
        MySQLSelectStatement result = new MySQLSelectStatement();
        if (null != ctx.TABLE()) {
            result.setFrom(new SimpleTableSegment(new TableNameSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
                    new IdentifierValue(ctx.tableName().getText()))));
        } else {
            result.setTable((SimpleTableSegment) visit(ctx.tableName()));
        }
        return result;
    }

Line commented on: if (null != ctx.TABLE()) {

Revised code:
public ASTNode visitTableStatement(final TableStatementContext ctx) {
        MySQLSelectStatement result = new MySQLSelectStatement();
        if (null != ctx.TABLE()) {
            result.setFrom(new SimpleTableSegment(new TableNameSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
                    new IdentifierValue(ctx.tableName().getText()))));
        } else {
            result.setTable((SimpleTableSegment) visit(ctx.tableName()));
        }
        return result;
    }
Code review comment: Could we avoid 1 `& allSelectedMask` here? It feels like it should only be relevant for `ALL`. We could then eagerly apply `allSelectedMask` instead of setting ALL (`new InputSelection(-1 & allSelectedMask)`).

Code under review:
boolean shouldSetAvailableForAnotherInput() {
		return (inputSelection.getInputMask() & allSelectedMask & ~availableInputsMask) != 0;
	}

Line commented on: return (inputSelection.getInputMask() & allSelectedMask & ~availableInputsMask) != 0;

Revised code:
boolean shouldSetAvailableForAnotherInput() {
		return (inputSelection.getInputMask() & allSelectedMask & ~availableInputsMask) != 0;
	}
Code review comment: @shehan360 , Could you check this code block ?

Code under review:
private static Path getAbsoluteModulePath(String sourceRoot, Path modulePath) {
        Path sourcePath = Paths.get(sourceRoot);
        if (sourcePath.endsWith(modulePath)) {
            return Paths.get(sourceRoot);
        }
        return sourcePath.resolve(ProjectDirConstants.MODULES_ROOT).resolve(modulePath);
    }

Line commented on: return sourcePath.resolve(ProjectDirConstants.MODULES_ROOT).resolve(modulePath);

Revised code:
private static Path getAbsoluteModulePath(String sourceRoot, Path modulePath) {
        Path sourcePath = Paths.get(sourceRoot);
        if (sourcePath.endsWith(modulePath)) {
            return Paths.get(sourceRoot);
        }
        return sourcePath.resolve(ProjectDirConstants.MODULES_ROOT).resolve(modulePath);
    }
Code review comment: I'm kinda sure that `volatile` doesn't matter here as `VarHandle`'s `getAcquire` + `setRelease` are used.

Code under review:
public T get() {
            T current = currentClient();
            if (current == null) {
                synchronized (this) {
                    current = currentClient();
                    if (current == null) {
                        MongoClients mongoClients = Arc.container().instance(MongoClients.class).get();
                        current = producer.apply(mongoClients);
                        CLIENT.setRelease(this, current);
                    }
                }
            }
            return current;
        }

Line commented on: CLIENT.setRelease(this, current);

Revised code:
public T get() {
            
            
            
            MongoClients mongoClients = Arc.container().instance(MongoClients.class).get();
            return producer.apply(mongoClients);
        }
Code review comment: Please rewrite the error message too

Code under review:
public Savepoint setSavepoint(final String savepointName) throws SQLException {
        if (!connectionTransaction.isInTransaction()) {
            throw new SQLException("Now, not in transaction");
        }
        ShardingSphereSavepoint result = new ShardingSphereSavepoint(savepointName);
        for (Connection each : cachedConnections.values()) {
            ConnectionSavepointManager.getInstance().setSavepoint(each, savepointName);
        }
        methodInvocationRecorder.record("setSavepoint", target -> ConnectionSavepointManager.getInstance().setSavepoint(target, savepointName));
        return result;
    }

Line commented on: throw new SQLException("Now, not in transaction");

Revised code:
public Savepoint setSavepoint(final String savepointName) throws SQLException {
        if (!connectionTransaction.isInTransaction()) {
            throw new SQLException("Savepoint can only be used in transaction blocks.");
        }
        ShardingSphereSavepoint result = new ShardingSphereSavepoint(savepointName);
        for (Connection each : cachedConnections.values()) {
            ConnectionSavepointManager.getInstance().setSavepoint(each, savepointName);
        }
        methodInvocationRecorder.record("setSavepoint", target -> ConnectionSavepointManager.getInstance().setSavepoint(target, savepointName));
        return result;
    }
Code review comment: Yeah, exactly! It's meant to be used by Quarkus developers (as it's part of the runtime package, so not meant to be part of the public API)

Code under review:
public QuarkusBindException(List<Integer> ports) {
        if (ports.isEmpty()) {
            throw new IllegalStateException("ports must not be empty");
        }
        this.ports = ports;
    }

Line commented on: throw new IllegalStateException("ports must not be empty");

Revised code:
public QuarkusBindException(List<Integer> ports) {
        if (ports.isEmpty()) {
            throw new IllegalStateException("ports must not be empty");
        }
        this.ports = ports;
    }
Code review comment: Maybe we could always `pin` as before, but migrate the checking logic from `ResultPartitionManger` to `ResultPartition` as I mentioned before. I mean `ResultPartitionManager` is not aware of the external issue, the tag in `ResultPartitionManager#isReleaseExternallyManagedPartitionsOnConsumption` could be merged with `ResultPartition#isManagedExternally` to generate a final tag in `ResultPartition`.  Then while `ResultPartition#onConsumedSubpartition`, it could check the final tag to decide whether to call `ResultPartitionManager#onConsumedPartition`. And the reference counter only works when the final tag is false.

Code under review:
void onConsumedSubpartition(int subpartitionIndex) {

		if (isReleased.get()) {
			return;
		}

		if (isManagedExternally) {
			partitionManager.onConsumedPartition(this);
		} else {
			int refCnt = pendingReferences.decrementAndGet();

			if (refCnt == 0) {
				partitionManager.onConsumedPartition(this);
			} else if (refCnt < 0) {
				throw new IllegalStateException("All references released.");
			}

			LOG.debug("{}: Received release notification for subpartition {} (reference count now at: {}).",
				this, subpartitionIndex, pendingReferences);
		}
	}

Line commented on: partitionManager.onConsumedPartition(this);

Revised code:
void onConsumedSubpartition(int subpartitionIndex) {

		if (isReleased.get()) {
			return;
		}

		LOG.debug("{}: Received release notification for subpartition {}.",
				this, subpartitionIndex);
	}