Re: [PR] HBASE-29301: Fix AggregrateImplementation pagination logic [hbase]

2025-05-21 Thread via GitHub


ndimiduk merged PR #6978:
URL: https://github.com/apache/hbase/pull/6978


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] HBASE-29301: Fix AggregrateImplementation pagination logic [hbase]

2025-05-21 Thread via GitHub


ndimiduk commented on PR #6978:
URL: https://github.com/apache/hbase/pull/6978#issuecomment-2897766014

   > Spotless failed for
   > 
   > ```
   > [ERROR] An internal error occurred during: "Periodic workspace save.".
   > java.lang.IllegalStateException: Job manager has been shut down.
   > ...
   > ```
   > 
   > There are not actually any code formatting problems
   
   Yep, that failure is https://issues.apache.org/jira/browse/HBASE-29269


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] HBASE-29301: Fix AggregrateImplementation pagination logic [hbase]

2025-05-20 Thread via GitHub


Apache-HBase commented on PR #6978:
URL: https://github.com/apache/hbase/pull/6978#issuecomment-2895406972

   :confetti_ball: **+1 overall**
   
   
   
   
   
   
   | Vote | Subsystem | Runtime |  Logfile | Comment |
   |::|--:|:|::|:---:|
   | +0 :ok: |  reexec  |   0m 50s |  |  Docker mode activated.  |
   | -0 :warning: |  yetus  |   0m  3s |  |  Unprocessed flag(s): 
--brief-report-file --spotbugs-strict-precheck --author-ignore-list 
--blanks-eol-ignore-file --blanks-tabs-ignore-file --quick-hadoopcheck  |
    _ Prechecks _ |
    _ master Compile Tests _ |
   | +0 :ok: |  mvndep  |   0m 13s |  |  Maven dependency ordering for branch  |
   | +1 :green_heart: |  mvninstall  |   4m 57s |  |  master passed  |
   | +1 :green_heart: |  compile  |   1m 49s |  |  master passed  |
   | +1 :green_heart: |  javadoc  |   1m  0s |  |  master passed  |
   | +1 :green_heart: |  shadedjars  |   9m  1s |  |  branch has no errors when 
building our shaded downstream artifacts.  |
    _ Patch Compile Tests _ |
   | +0 :ok: |  mvndep  |   0m 17s |  |  Maven dependency ordering for patch  |
   | +1 :green_heart: |  mvninstall  |   4m 28s |  |  the patch passed  |
   | +1 :green_heart: |  compile  |   1m 43s |  |  the patch passed  |
   | +1 :green_heart: |  javac  |   1m 43s |  |  the patch passed  |
   | +1 :green_heart: |  javadoc  |   0m 53s |  |  the patch passed  |
   | +1 :green_heart: |  shadedjars  |   8m  7s |  |  patch has no errors when 
building our shaded downstream artifacts.  |
    _ Other Tests _ |
   | +1 :green_heart: |  unit  | 268m 57s |  |  hbase-server in the patch 
passed.  |
   | +1 :green_heart: |  unit  |   4m 33s |  |  hbase-endpoint in the patch 
passed.  |
   |  |   | 311m 59s |  |  |
   
   
   | Subsystem | Report/Notes |
   |--:|:-|
   | Docker | ClientAPI=1.43 ServerAPI=1.43 base: 
https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6978/3/artifact/yetus-jdk17-hadoop3-check/output/Dockerfile
 |
   | GITHUB PR | https://github.com/apache/hbase/pull/6978 |
   | JIRA Issue | HBASE-29301 |
   | Optional Tests | javac javadoc unit shadedjars compile |
   | uname | Linux ac6367e60c55 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 
23 20:04:10 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux |
   | Build tool | maven |
   | Personality | dev-support/hbase-personality.sh |
   | git revision | master / d4795bda1ad9127c9d28dc8003dcc3f52bfe7783 |
   | Default Java | Eclipse Adoptium-17.0.11+9 |
   |  Test Results | 
https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6978/3/testReport/
 |
   | Max. process+thread count | 4456 (vs. ulimit of 3) |
   | modules | C: hbase-server hbase-endpoint U: . |
   | Console output | 
https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6978/3/console 
|
   | versions | git=2.34.1 maven=3.9.8 |
   | Powered by | Apache Yetus 0.15.0 https://yetus.apache.org |
   
   
   This message was automatically generated.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] HBASE-29301: Fix AggregrateImplementation pagination logic [hbase]

2025-05-20 Thread via GitHub


charlesconnell commented on PR #6978:
URL: https://github.com/apache/hbase/pull/6978#issuecomment-2894589179

   Spotless failed for
   ```
   [ERROR] An internal error occurred during: "Periodic workspace save.".
   java.lang.IllegalStateException: Job manager has been shut down.
   ...
   ```
   There are not actually any code formatting problems


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] HBASE-29301: Fix AggregrateImplementation pagination logic [hbase]

2025-05-20 Thread via GitHub


Apache-HBase commented on PR #6978:
URL: https://github.com/apache/hbase/pull/6978#issuecomment-2894553417

   :broken_heart: **-1 overall**
   
   
   
   
   
   
   | Vote | Subsystem | Runtime |  Logfile | Comment |
   |::|--:|:|::|:---:|
   | +0 :ok: |  reexec  |   0m 41s |  |  Docker mode activated.  |
    _ Prechecks _ |
   | +1 :green_heart: |  dupname  |   0m  0s |  |  No case conflicting files 
found.  |
   | +0 :ok: |  codespell  |   0m  0s |  |  codespell was not available.  |
   | +0 :ok: |  detsecrets  |   0m  0s |  |  detect-secrets was not available.  
|
   | +1 :green_heart: |  @author  |   0m  0s |  |  The patch does not contain 
any @author tags.  |
   | +1 :green_heart: |  hbaseanti  |   0m  0s |  |  Patch does not have any 
anti-patterns.  |
    _ master Compile Tests _ |
   | +0 :ok: |  mvndep  |   0m 40s |  |  Maven dependency ordering for branch  |
   | +1 :green_heart: |  mvninstall  |   4m 46s |  |  master passed  |
   | +1 :green_heart: |  compile  |   4m 25s |  |  master passed  |
   | +1 :green_heart: |  checkstyle  |   1m 11s |  |  master passed  |
   | +1 :green_heart: |  spotbugs  |   2m 53s |  |  master passed  |
   | -1 :x: |  spotless  |   1m  0s |  |  branch has 1 errors when running 
spotless:check, run spotless:apply to fix.  |
    _ Patch Compile Tests _ |
   | +0 :ok: |  mvndep  |   0m 11s |  |  Maven dependency ordering for patch  |
   | +1 :green_heart: |  mvninstall  |   3m 42s |  |  the patch passed  |
   | +1 :green_heart: |  compile  |   4m 14s |  |  the patch passed  |
   | +1 :green_heart: |  javac  |   4m 14s |  |  the patch passed  |
   | +1 :green_heart: |  blanks  |   0m  0s |  |  The patch has no blanks 
issues.  |
   | +1 :green_heart: |  checkstyle  |   1m  6s |  |  the patch passed  |
   | +1 :green_heart: |  xmllint  |   0m  0s |  |  No new issues.  |
   | +1 :green_heart: |  spotbugs  |   3m 19s |  |  the patch passed  |
   | +1 :green_heart: |  hadoopcheck  |  15m 46s |  |  Patch does not cause any 
errors with Hadoop 3.3.6 3.4.0.  |
   | +1 :green_heart: |  spotless  |   1m  9s |  |  patch has no errors when 
running spotless:check.  |
    _ Other Tests _ |
   | +1 :green_heart: |  asflicense  |   0m 27s |  |  The patch does not 
generate ASF License warnings.  |
   |  |   |  56m  1s |  |  |
   
   
   | Subsystem | Report/Notes |
   |--:|:-|
   | Docker | ClientAPI=1.43 ServerAPI=1.43 base: 
https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6978/3/artifact/yetus-general-check/output/Dockerfile
 |
   | GITHUB PR | https://github.com/apache/hbase/pull/6978 |
   | JIRA Issue | HBASE-29301 |
   | Optional Tests | dupname asflicense javac codespell detsecrets xmllint 
hadoopcheck spotless compile spotbugs checkstyle hbaseanti |
   | uname | Linux ac757dc1afab 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 
23 20:04:10 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux |
   | Build tool | maven |
   | Personality | dev-support/hbase-personality.sh |
   | git revision | master / d4795bda1ad9127c9d28dc8003dcc3f52bfe7783 |
   | Default Java | Eclipse Adoptium-17.0.11+9 |
   | spotless | 
https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6978/3/artifact/yetus-general-check/output/branch-spotless.txt
 |
   | Max. process+thread count | 84 (vs. ulimit of 3) |
   | modules | C: hbase-server hbase-endpoint U: . |
   | Console output | 
https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6978/3/console 
|
   | versions | git=2.34.1 maven=3.9.8 spotbugs=4.7.3 xmllint=20913 |
   | Powered by | Apache Yetus 0.15.0 https://yetus.apache.org |
   
   
   This message was automatically generated.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] HBASE-29301: Fix AggregrateImplementation pagination logic [hbase]

2025-05-20 Thread via GitHub


ndimiduk commented on PR #6978:
URL: https://github.com/apache/hbase/pull/6978#issuecomment-2894347335

   Not sure what happened to that last build. I triggered a new one.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] HBASE-29301: Fix AggregrateImplementation pagination logic [hbase]

2025-05-19 Thread via GitHub


Apache-HBase commented on PR #6978:
URL: https://github.com/apache/hbase/pull/6978#issuecomment-2892791550

   :confetti_ball: **+1 overall**
   
   
   
   
   
   
   | Vote | Subsystem | Runtime |  Logfile | Comment |
   |::|--:|:|::|:---:|
   | +0 :ok: |  reexec  |   0m 27s |  |  Docker mode activated.  |
    _ Prechecks _ |
   | +1 :green_heart: |  dupname  |   0m  0s |  |  No case conflicting files 
found.  |
   | +0 :ok: |  codespell  |   0m  0s |  |  codespell was not available.  |
   | +0 :ok: |  detsecrets  |   0m  0s |  |  detect-secrets was not available.  
|
   | +1 :green_heart: |  @author  |   0m  0s |  |  The patch does not contain 
any @author tags.  |
   | +1 :green_heart: |  hbaseanti  |   0m  0s |  |  Patch does not have any 
anti-patterns.  |
    _ master Compile Tests _ |
   | +0 :ok: |  mvndep  |   0m 11s |  |  Maven dependency ordering for branch  |
   | +1 :green_heart: |  mvninstall  |   3m 16s |  |  master passed  |
   | +1 :green_heart: |  compile  |   3m 31s |  |  master passed  |
   | +1 :green_heart: |  checkstyle  |   0m 46s |  |  master passed  |
   | +1 :green_heart: |  spotbugs  |   2m  0s |  |  master passed  |
   | +1 :green_heart: |  spotless  |   0m 50s |  |  branch has no errors when 
running spotless:check.  |
    _ Patch Compile Tests _ |
   | +0 :ok: |  mvndep  |   0m 11s |  |  Maven dependency ordering for patch  |
   | +1 :green_heart: |  mvninstall  |   3m  7s |  |  the patch passed  |
   | +1 :green_heart: |  compile  |   3m 34s |  |  the patch passed  |
   | +1 :green_heart: |  javac  |   3m 34s |  |  the patch passed  |
   | +1 :green_heart: |  blanks  |   0m  0s |  |  The patch has no blanks 
issues.  |
   | +1 :green_heart: |  checkstyle  |   0m 45s |  |  the patch passed  |
   | +1 :green_heart: |  xmllint  |   0m  0s |  |  No new issues.  |
   | +1 :green_heart: |  spotbugs  |   2m 11s |  |  the patch passed  |
   | +1 :green_heart: |  hadoopcheck  |  12m  7s |  |  Patch does not cause any 
errors with Hadoop 3.3.6 3.4.0.  |
   | +1 :green_heart: |  spotless  |   0m 48s |  |  patch has no errors when 
running spotless:check.  |
    _ Other Tests _ |
   | +1 :green_heart: |  asflicense  |   0m 20s |  |  The patch does not 
generate ASF License warnings.  |
   |  |   |  41m 51s |  |  |
   
   
   | Subsystem | Report/Notes |
   |--:|:-|
   | Docker | ClientAPI=1.43 ServerAPI=1.43 base: 
https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6978/2/artifact/yetus-general-check/output/Dockerfile
 |
   | GITHUB PR | https://github.com/apache/hbase/pull/6978 |
   | JIRA Issue | HBASE-29301 |
   | Optional Tests | dupname asflicense javac codespell detsecrets xmllint 
hadoopcheck spotless compile spotbugs checkstyle hbaseanti |
   | uname | Linux 20e723c7bb8e 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 
23 20:04:10 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux |
   | Build tool | maven |
   | Personality | dev-support/hbase-personality.sh |
   | git revision | master / d4795bda1ad9127c9d28dc8003dcc3f52bfe7783 |
   | Default Java | Eclipse Adoptium-17.0.11+9 |
   | Max. process+thread count | 84 (vs. ulimit of 3) |
   | modules | C: hbase-server hbase-endpoint U: . |
   | Console output | 
https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6978/2/console 
|
   | versions | git=2.34.1 maven=3.9.8 spotbugs=4.7.3 xmllint=20913 |
   | Powered by | Apache Yetus 0.15.0 https://yetus.apache.org |
   
   
   This message was automatically generated.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] HBASE-29301: Fix AggregrateImplementation pagination logic [hbase]

2025-05-19 Thread via GitHub


ndimiduk commented on code in PR #6978:
URL: https://github.com/apache/hbase/pull/6978#discussion_r2095970051


##
hbase-endpoint/src/test/java/org/apache/hadoop/hbase/coprocessor/TestAggregateImplementation.java:
##
@@ -0,0 +1,958 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.coprocessor;
+
+import static 
org.apache.hadoop.hbase.client.coprocessor.AggregationHelper.getParsedGenericInstance;
+import static 
org.apache.hadoop.hbase.quotas.RpcThrottlingException.Type.ReadSizeExceeded;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyLong;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.HBaseClassTestRule;
+import org.apache.hadoop.hbase.client.RegionInfo;
+import org.apache.hadoop.hbase.client.Scan;
+import org.apache.hadoop.hbase.client.coprocessor.LongColumnInterpreter;
+import org.apache.hadoop.hbase.quotas.OperationQuota;
+import org.apache.hadoop.hbase.quotas.RpcThrottlingException;
+import org.apache.hadoop.hbase.regionserver.HRegion;
+import org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost;
+import org.apache.hadoop.hbase.regionserver.RegionScannerImpl;
+import org.apache.hadoop.hbase.testclassification.CoprocessorTests;
+import org.apache.hadoop.hbase.testclassification.SmallTests;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
+import org.mockito.ArgumentCaptor;
+import org.mockito.stubbing.Answer;
+
+import org.apache.hbase.thirdparty.com.google.protobuf.ByteString;
+import org.apache.hbase.thirdparty.com.google.protobuf.RpcCallback;
+import org.apache.hbase.thirdparty.com.google.protobuf.RpcController;
+
+import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
+import 
org.apache.hadoop.hbase.shaded.protobuf.generated.AggregateProtos.AggregateRequest;
+import 
org.apache.hadoop.hbase.shaded.protobuf.generated.AggregateProtos.AggregateResponse;
+import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos;
+
+/**
+ * Test AggregateImplementation with throttling and partial results
+ */
+@Category({ SmallTests.class, CoprocessorTests.class })
+public class TestAggregateImplementation {
+
+  @ClassRule
+  public static final HBaseClassTestRule CLASS_RULE =
+HBaseClassTestRule.forClass(TestAggregateImplementation.class);
+
+  @Rule
+  public TestName name = new TestName();
+
+  private static final byte[] CF = Bytes.toBytes("CF");
+  private static final byte[] CQ = Bytes.toBytes("CQ");
+  private static final int NUM_ROWS = 5;
+  private static final int THROTTLE_AT_ROW = 2;
+  private static final LongColumnInterpreter LONG_COLUMN_INTERPRETER = new 
LongColumnInterpreter();
+
+  private AggregateImplementation aggregate;
+  private RegionCoprocessorEnvironment env;
+  private HRegion region;
+  private RegionScannerImpl scanner;
+  private Scan scan;
+  private AggregateRequest request;
+  private RpcController controller;
+
+  @Before
+  public void setUp() throws Exception {
+env = mock(RegionCoprocessorEnvironment.class);
+region = mock(HRegion.class);
+RegionCoprocessorHost host = mock(RegionCoprocessorHost.class);
+when(env.getRegion()).thenReturn(region);
+when(region.getCoprocessorHost()).thenReturn(host);
+
+RegionInfo regionInfo = mock(RegionInfo.class);
+when(region.getRegionInfo()).thenReturn(regionInfo);
+when(regionInfo.getRegionNameAsString()).thenReturn("testRegion");
+
+scan = new Scan().addColumn(CF, CQ);
+
+scanner = mock(RegionScannerImpl.class);
+doAnswer(createMockScanner()).when(scanner).next(any

Re: [PR] HBASE-29301: Fix AggregrateImplementation pagination logic [hbase]

2025-05-19 Thread via GitHub


ndimiduk commented on code in PR #6978:
URL: https://github.com/apache/hbase/pull/6978#discussion_r2095387463


##
hbase-endpoint/src/test/java/org/apache/hadoop/hbase/coprocessor/TestAggregateImplementation.java:
##
@@ -0,0 +1,958 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.coprocessor;
+
+import static 
org.apache.hadoop.hbase.client.coprocessor.AggregationHelper.getParsedGenericInstance;
+import static 
org.apache.hadoop.hbase.quotas.RpcThrottlingException.Type.ReadSizeExceeded;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyLong;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.HBaseClassTestRule;
+import org.apache.hadoop.hbase.client.RegionInfo;
+import org.apache.hadoop.hbase.client.Scan;
+import org.apache.hadoop.hbase.client.coprocessor.LongColumnInterpreter;
+import org.apache.hadoop.hbase.quotas.OperationQuota;
+import org.apache.hadoop.hbase.quotas.RpcThrottlingException;
+import org.apache.hadoop.hbase.regionserver.HRegion;
+import org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost;
+import org.apache.hadoop.hbase.regionserver.RegionScannerImpl;
+import org.apache.hadoop.hbase.testclassification.CoprocessorTests;
+import org.apache.hadoop.hbase.testclassification.SmallTests;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
+import org.mockito.ArgumentCaptor;
+import org.mockito.stubbing.Answer;
+
+import org.apache.hbase.thirdparty.com.google.protobuf.ByteString;
+import org.apache.hbase.thirdparty.com.google.protobuf.RpcCallback;
+import org.apache.hbase.thirdparty.com.google.protobuf.RpcController;
+
+import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
+import 
org.apache.hadoop.hbase.shaded.protobuf.generated.AggregateProtos.AggregateRequest;
+import 
org.apache.hadoop.hbase.shaded.protobuf.generated.AggregateProtos.AggregateResponse;
+import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos;
+
+/**
+ * Test AggregateImplementation with throttling and partial results
+ */
+@Category({ SmallTests.class, CoprocessorTests.class })
+public class TestAggregateImplementation {
+
+  @ClassRule
+  public static final HBaseClassTestRule CLASS_RULE =
+HBaseClassTestRule.forClass(TestAggregateImplementation.class);
+
+  @Rule
+  public TestName name = new TestName();
+
+  private static final byte[] CF = Bytes.toBytes("CF");
+  private static final byte[] CQ = Bytes.toBytes("CQ");
+  private static final int NUM_ROWS = 5;
+  private static final int THROTTLE_AT_ROW = 2;
+  private static final LongColumnInterpreter LONG_COLUMN_INTERPRETER = new 
LongColumnInterpreter();
+
+  private AggregateImplementation aggregate;
+  private RegionCoprocessorEnvironment env;
+  private HRegion region;
+  private RegionScannerImpl scanner;
+  private Scan scan;
+  private AggregateRequest request;
+  private RpcController controller;
+
+  @Before
+  public void setUp() throws Exception {
+env = mock(RegionCoprocessorEnvironment.class);
+region = mock(HRegion.class);
+RegionCoprocessorHost host = mock(RegionCoprocessorHost.class);
+when(env.getRegion()).thenReturn(region);
+when(region.getCoprocessorHost()).thenReturn(host);
+
+RegionInfo regionInfo = mock(RegionInfo.class);
+when(region.getRegionInfo()).thenReturn(regionInfo);
+when(regionInfo.getRegionNameAsString()).thenReturn("testRegion");
+
+scan = new Scan().addColumn(CF, CQ);
+
+scanner = mock(RegionScannerImpl.class);
+doAnswer(createMockScanner()).when(scanner).next(any

Re: [PR] HBASE-29301: Fix AggregrateImplementation pagination logic [hbase]

2025-05-19 Thread via GitHub


charlesconnell commented on code in PR #6978:
URL: https://github.com/apache/hbase/pull/6978#discussion_r2096023852


##
hbase-endpoint/src/main/java/org/apache/hadoop/hbase/coprocessor/AggregateImplementation.java:
##
@@ -111,11 +111,16 @@ public void getMax(RpcController controller, 
AggregateRequest request,
 postScanPartialResultUpdate(results, partialResultContext);
 results.clear();
   } while (hasMoreRows);
-  if (max != null) {
-AggregateResponse.Builder builder = AggregateResponse.newBuilder();
-builder.addFirstPart(ci.getProtoForCellType(max).toByteString());
-setPartialResultResponse(builder, request, hasMoreRows, 
partialResultContext);
-response = builder.build();
+  if (max != null && !request.getClientSupportsPartialResult()) {
+ByteString first = ci.getProtoForCellType(max).toByteString();
+response = AggregateResponse.newBuilder().addFirstPart(first).build();
+  } else if (request.getClientSupportsPartialResult()) {
+AggregateResponse.Builder responseBuilder =
+  responseBuilder(request, hasMoreRows, partialResultContext);
+if (max != null) {
+  
responseBuilder.addFirstPart(ci.getProtoForCellType(max).toByteString());
+}
+response = responseBuilder.build();

Review Comment:
   I was able to consolidate some of the code in max, min, and sum



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] HBASE-29301: Fix AggregrateImplementation pagination logic [hbase]

2025-05-19 Thread via GitHub


charlesconnell commented on code in PR #6978:
URL: https://github.com/apache/hbase/pull/6978#discussion_r2095959938


##
hbase-endpoint/src/test/java/org/apache/hadoop/hbase/coprocessor/TestAggregateImplementation.java:
##
@@ -0,0 +1,958 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.coprocessor;
+
+import static 
org.apache.hadoop.hbase.client.coprocessor.AggregationHelper.getParsedGenericInstance;
+import static 
org.apache.hadoop.hbase.quotas.RpcThrottlingException.Type.ReadSizeExceeded;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyLong;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.HBaseClassTestRule;
+import org.apache.hadoop.hbase.client.RegionInfo;
+import org.apache.hadoop.hbase.client.Scan;
+import org.apache.hadoop.hbase.client.coprocessor.LongColumnInterpreter;
+import org.apache.hadoop.hbase.quotas.OperationQuota;
+import org.apache.hadoop.hbase.quotas.RpcThrottlingException;
+import org.apache.hadoop.hbase.regionserver.HRegion;
+import org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost;
+import org.apache.hadoop.hbase.regionserver.RegionScannerImpl;
+import org.apache.hadoop.hbase.testclassification.CoprocessorTests;
+import org.apache.hadoop.hbase.testclassification.SmallTests;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
+import org.mockito.ArgumentCaptor;
+import org.mockito.stubbing.Answer;
+
+import org.apache.hbase.thirdparty.com.google.protobuf.ByteString;
+import org.apache.hbase.thirdparty.com.google.protobuf.RpcCallback;
+import org.apache.hbase.thirdparty.com.google.protobuf.RpcController;
+
+import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
+import 
org.apache.hadoop.hbase.shaded.protobuf.generated.AggregateProtos.AggregateRequest;
+import 
org.apache.hadoop.hbase.shaded.protobuf.generated.AggregateProtos.AggregateResponse;
+import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos;
+
+/**
+ * Test AggregateImplementation with throttling and partial results
+ */
+@Category({ SmallTests.class, CoprocessorTests.class })
+public class TestAggregateImplementation {
+
+  @ClassRule
+  public static final HBaseClassTestRule CLASS_RULE =
+HBaseClassTestRule.forClass(TestAggregateImplementation.class);
+
+  @Rule
+  public TestName name = new TestName();
+
+  private static final byte[] CF = Bytes.toBytes("CF");
+  private static final byte[] CQ = Bytes.toBytes("CQ");
+  private static final int NUM_ROWS = 5;
+  private static final int THROTTLE_AT_ROW = 2;
+  private static final LongColumnInterpreter LONG_COLUMN_INTERPRETER = new 
LongColumnInterpreter();
+
+  private AggregateImplementation aggregate;
+  private RegionCoprocessorEnvironment env;
+  private HRegion region;
+  private RegionScannerImpl scanner;
+  private Scan scan;
+  private AggregateRequest request;
+  private RpcController controller;
+
+  @Before
+  public void setUp() throws Exception {
+env = mock(RegionCoprocessorEnvironment.class);
+region = mock(HRegion.class);
+RegionCoprocessorHost host = mock(RegionCoprocessorHost.class);
+when(env.getRegion()).thenReturn(region);
+when(region.getCoprocessorHost()).thenReturn(host);
+
+RegionInfo regionInfo = mock(RegionInfo.class);
+when(region.getRegionInfo()).thenReturn(regionInfo);
+when(regionInfo.getRegionNameAsString()).thenReturn("testRegion");
+
+scan = new Scan().addColumn(CF, CQ);
+
+scanner = mock(RegionScannerImpl.class);
+doAnswer(createMockScanner()).when(scanner).ne