[
https://issues.apache.org/jira/browse/DRILL-8552?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18101052#comment-18101052
]
ASF GitHub Bot commented on DRILL-8552:
---------------------------------------
github-advanced-security[bot] commented on code in PR #3067:
URL: https://github.com/apache/drill/pull/3067#discussion_r3699061322
##########
contrib/storage-accumulo/src/main/java/org/apache/drill/exec/store/accumulo/AccumuloGroupScan.java:
##########
@@ -0,0 +1,323 @@
+/*
+ * 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.drill.exec.store.accumulo;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.drill.common.PlanStringBuilder;
+import org.apache.drill.common.exceptions.ExecutionSetupException;
+import org.apache.drill.common.expression.SchemaPath;
+import org.apache.drill.exec.physical.EndpointAffinity;
+import org.apache.drill.exec.physical.base.AbstractGroupScan;
+import org.apache.drill.exec.physical.base.GroupScan;
+import org.apache.drill.exec.physical.base.PhysicalOperator;
+import org.apache.drill.exec.physical.base.ScanStats;
+import org.apache.drill.exec.physical.base.ScanStats.GroupScanProperty;
+import org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint;
+import org.apache.drill.exec.store.StoragePluginRegistry;
+
+import com.fasterxml.jackson.annotation.JacksonInject;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+
+/**
+ * Group scan for Accumulo tables.
+ *
+ * <p>This class handles scan planning and fragmentation across Accumulo
tablets.
+ * It can be modified by optimizer rules to apply filter, projection, limit,
and sort pushdowns.</p>
+ *
+ * <p>For user impersonation mode, this class carries a delegation token that
is
+ * serialized to JSON for distributed planning and passed to SubScans for
execution.</p>
+ */
+@JsonTypeName("accumulo-scan")
+public class AccumuloGroupScan extends AbstractGroupScan {
+
+ private AccumuloStoragePluginConfig storagePluginConfig;
+ private AccumuloStoragePlugin storagePlugin;
+ private AccumuloScanSpec scanSpec;
+ private List<SchemaPath> columns;
+ private int maxRecords;
+
+ /**
+ * Delegation token for user impersonation in distributed execution.
+ * When present, SubScans will use this token to create user-impersonated
clients.
+ */
+ private DelegationTokenInfo delegationTokenInfo;
+
+ private boolean filterPushedDown = false;
+ private boolean projectionPushedDown = false;
+ private boolean limitPushedDown = false;
+ private boolean sortPushedDown = false;
+
+ @JsonCreator
+ public AccumuloGroupScan(
+ @JsonProperty("userName") String userName,
+ @JsonProperty("scanSpec") AccumuloScanSpec scanSpec,
+ @JsonProperty("storage") AccumuloStoragePluginConfig storagePluginConfig,
+ @JsonProperty("columns") List<SchemaPath> columns,
+ @JsonProperty("maxRecords") int maxRecords,
+ @JsonProperty("delegationTokenInfo") DelegationTokenInfo
delegationTokenInfo,
+ @JacksonInject StoragePluginRegistry pluginRegistry) throws IOException,
ExecutionSetupException {
+ this(userName, pluginRegistry.resolve(storagePluginConfig,
AccumuloStoragePlugin.class),
+ scanSpec, columns, maxRecords, delegationTokenInfo);
+ }
+
+ public AccumuloGroupScan(
+ String userName,
+ AccumuloStoragePlugin storagePlugin,
+ AccumuloScanSpec scanSpec,
+ List<SchemaPath> columns,
+ int maxRecords) {
+ this(userName, storagePlugin, scanSpec, columns, maxRecords, null);
+ }
+
+ public AccumuloGroupScan(
+ String userName,
+ AccumuloStoragePlugin storagePlugin,
+ AccumuloScanSpec scanSpec,
+ List<SchemaPath> columns,
+ int maxRecords,
+ DelegationTokenInfo delegationTokenInfo) {
+ super(userName);
+ this.storagePlugin = storagePlugin;
+ this.storagePluginConfig = storagePlugin.getConfig();
+ this.scanSpec = scanSpec;
+ this.columns = columns == null ? ALL_COLUMNS : columns;
+ this.maxRecords = maxRecords;
+ this.delegationTokenInfo = delegationTokenInfo;
+ }
+
+ /**
+ * Copy constructor for cloning.
+ */
+ private AccumuloGroupScan(AccumuloGroupScan that) {
+ super(that);
+ this.storagePlugin = that.storagePlugin;
+ this.storagePluginConfig = that.storagePluginConfig;
+ this.scanSpec = that.scanSpec;
+ this.columns = that.columns == null ? ALL_COLUMNS : that.columns;
+ this.maxRecords = that.maxRecords;
+ this.delegationTokenInfo = that.delegationTokenInfo;
+ this.filterPushedDown = that.filterPushedDown;
+ this.projectionPushedDown = that.projectionPushedDown;
+ this.limitPushedDown = that.limitPushedDown;
+ this.sortPushedDown = that.sortPushedDown;
+ }
+
+ @Override
+ public GroupScan clone(List<SchemaPath> columns) {
+ AccumuloGroupScan cloned = new AccumuloGroupScan(this);
+ cloned.columns = columns;
+ // Mark projection as pushed down if we're projecting specific columns
+ if (columns != null && !columns.equals(ALL_COLUMNS)) {
+ cloned.projectionPushedDown = true;
+ }
+ return cloned;
+ }
+
+ @Override
+ public PhysicalOperator getNewWithChildren(List<PhysicalOperator> children) {
+ return new AccumuloGroupScan(this);
+ }
+
+ @Override
+ public void applyAssignments(List<DrillbitEndpoint> endpoints) {
+ // TODO: Implement tablet-to-endpoint assignment for data locality
+ }
+
+ @Override
+ public AccumuloSubScan getSpecificScan(int minorFragmentId) {
+ // Pass delegation token to SubScan for distributed execution
+ return new AccumuloSubScan(getUserName(), storagePlugin, scanSpec,
columns, maxRecords, delegationTokenInfo);
+ }
+
+ @Override
+ public int getMaxParallelizationWidth() {
+ // TODO: Return actual number of tablets; for now return 1
+ return 1;
+ }
+
+ @Override
+ public List<EndpointAffinity> getOperatorAffinity() {
+ // TODO: Return endpoint affinities based on tablet locations
+ return Collections.emptyList();
+ }
+
+ @Override
+ public ScanStats getScanStats() {
+ // TODO: Calculate actual scan statistics from Accumulo metadata
+ long rowCount = 100000; // Estimate
+ int columnCount = columns != null && !columns.equals(ALL_COLUMNS) ?
columns.size() : 10;
+ double cpuCost = rowCount * columnCount;
+
+ // Adjust cost for pushdowns
+ if (filterPushedDown) {
+ cpuCost *= 0.5;
+ rowCount *= 0.5;
Review Comment:
## CodeQL / Implicit narrowing conversion in compound assignment
Implicit cast of source type double to narrower destination type [long](1).
[Show more
details](https://github.com/apache/drill/security/code-scanning/87)
> Add Storage Plugin for Apache Accumulo
> --------------------------------------
>
> Key: DRILL-8552
> URL: https://issues.apache.org/jira/browse/DRILL-8552
> Project: Apache Drill
> Issue Type: New Feature
> Components: Storage - Accumulo
> Affects Versions: 1.22.0
> Reporter: Charles Givre
> Assignee: Charles Givre
> Priority: Major
> Fix For: 1.23.0
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)