stoty commented on code in PR #1690:
URL: https://github.com/apache/phoenix/pull/1690#discussion_r1336755118
##########
phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java:
##########
@@ -128,6 +131,30 @@ public ScanPlan(StatementContext context,
FilterableStatement statement, TableRe
this.rowOffset = rowOffset;
}
+ // TODO better place?
+ public static void serializeScanRegionObserverIntoScan(Scan scan, int
limit,
Review Comment:
Maybe add a comment that it is static because it's called from tests
##########
phoenix-core/src/main/java/org/apache/phoenix/coprocessor/BaseScannerRegionObserverConstants.java:
##########
@@ -0,0 +1,157 @@
+/*
+ * 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.phoenix.coprocessor;
Review Comment:
Having a .coprocessor. package in phoenix-core is iffy.
I'd prefer if we renamed this package to something else, like
org.apache.phoenix.scanattributes or similar.
##########
phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexBuilderStatic.java:
##########
@@ -0,0 +1,146 @@
+/*
+ * 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.phoenix.index;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.io.WritableUtils;
+import org.apache.phoenix.coprocessor.generated.PTableProtos;
+import org.apache.phoenix.expression.Expression;
+import org.apache.phoenix.expression.ExpressionType;
+import org.apache.phoenix.schema.PTable;
+import org.apache.phoenix.schema.PTableImpl;
+import org.apache.phoenix.util.TrustedByteArrayOutputStream;
+
+public final class PhoenixIndexBuilderStatic {
Review Comment:
Thee same goes for all ...Static classes.
##########
phoenix-core/src/main/java/org/apache/phoenix/schema/transform/TransformMaintainer.java:
##########
@@ -21,7 +21,6 @@
import org.apache.phoenix.thirdparty.com.google.common.collect.Maps;
import org.apache.phoenix.thirdparty.com.google.common.collect.Sets;
-import org.apache.hadoop.hbase.client.Delete;
Review Comment:
I can see a lot of files where you are just randomly removing unused imports.
This change is already huge, leaving these alone for now would make it
somewhat more managable.
We can handle unrelated cleanups in separate tickets.
This only applies when you only remove non-server unused imports.
When there are other changes, it's fine to clean up them.
##########
phoenix-core/src/main/java/org/apache/phoenix/execute/ClientAggregatePlan.java:
##########
@@ -18,6 +18,7 @@
package org.apache.phoenix.execute;
import static org.apache.phoenix.query.QueryConstants.UNGROUPED_AGG_ROW_KEY;
+import static
org.apache.phoenix.coprocessor.BaseScannerRegionObserverConstants.AGGREGATORS;
Review Comment:
It would be nice to be consistent with static imports, but there is no need
to clean that up in this patch.
##########
phoenix-core/src/main/java/org/apache/phoenix/schema/task/Task.java:
##########
@@ -62,67 +57,70 @@
justification="Not possible to avoid")
public class Task {
public static final Logger LOGGER = LoggerFactory.getLogger(Task.class);
- private static void mutateSystemTaskTable(PhoenixConnection conn,
PreparedStatement stmt, boolean accessCheckEnabled)
- throws IOException {
- // we need to mutate SYSTEM.TASK with HBase/login user if access is
enabled.
- if (accessCheckEnabled) {
- User.runAsLoginUser(new PrivilegedExceptionAction<Void>() {
- @Override
- public Void run() throws Exception {
- final RpcCall rpcContext = RpcUtil.getRpcContext();
- // setting RPC context as null so that user can be reset
- try {
- RpcUtil.setRpcContext(null);
- stmt.execute();
- conn.commit();
- } catch (SQLException e) {
- throw new IOException(e);
- } finally {
- // setting RPC context back to original context of the
RPC
- RpcUtil.setRpcContext(rpcContext);
- }
- return null;
- }
- });
- }
- else {
- try {
- stmt.execute();
- conn.commit();
- } catch (SQLException e) {
- throw new IOException(e);
- }
+
+// private static List<Mutation> getMutationsForSystemTaskTable(
Review Comment:
In the final version remove code instead of commenting it out.
##########
phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java:
##########
@@ -239,18 +243,50 @@ private ParallelIteratorFactory
wrapParallelIteratorFactory () {
// wrap any existing parallelIteratorFactory
return new WrappingResultIteratorFactory(innerFactory,
parallelIteratorFactory);
}
-
+
+ // TODO better place?
Review Comment:
As it is only called from this class place, having it here is fine.
It doesn't need to be static either.
The same goes for other static helpers that were moved out of the
coprocessors.
##########
phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexBuilderStatic.java:
##########
@@ -0,0 +1,146 @@
+/*
+ * 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.phoenix.index;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.io.WritableUtils;
+import org.apache.phoenix.coprocessor.generated.PTableProtos;
+import org.apache.phoenix.expression.Expression;
+import org.apache.phoenix.expression.ExpressionType;
+import org.apache.phoenix.schema.PTable;
+import org.apache.phoenix.schema.PTableImpl;
+import org.apache.phoenix.util.TrustedByteArrayOutputStream;
+
+public final class PhoenixIndexBuilderStatic {
Review Comment:
The name is probably from my POC , but it would better to call this
something like ...Client or ...Helper, or similary.
##########
phoenix-core/src/main/java/org/apache/phoenix/hbase/index/builder/BaseIndexCodec.java:
##########
@@ -17,7 +17,6 @@
*/
package org.apache.phoenix.hbase.index.builder;
Review Comment:
move to org.apache.phoenix.index ?
##########
phoenix-core/src/main/java/org/apache/phoenix/util/ClientUtil.java:
##########
@@ -0,0 +1,195 @@
+/*
+ * 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.phoenix.util;
+
+import java.io.IOException;
+import java.sql.SQLException;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.hadoop.hbase.DoNotRetryIOException;
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.NotServingRegionException;
+import org.apache.hadoop.hbase.client.Admin;
+import org.apache.hadoop.hbase.client.RetriesExhaustedWithDetailsException;
+import org.apache.phoenix.coprocessor.HashJoinCacheNotFoundException;
+import org.apache.phoenix.exception.PhoenixIOException;
+import org.apache.phoenix.exception.SQLExceptionCode;
+import org.apache.phoenix.exception.SQLExceptionInfo;
+import org.apache.phoenix.schema.StaleRegionBoundaryCacheException;
+
+public class ClientUtil {
Review Comment:
When splitting classes to client and server ones, check where it used more
often.
In some cases it may beneficial to keep the old name for the client class,
and in some cases it may be better to keep it for the server class, whichever
makes more sense, or makes the patch smaller.
--
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]