Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace usage of ScannerOptions #2550

Open
wants to merge 11 commits into
base: integration
Choose a base branch
from
12 changes: 10 additions & 2 deletions warehouse/core/src/main/java/datawave/util/TextUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,19 @@ public static String fromUtf8(byte[] bytes) {
}
}

/**
* Returns the bytes of the {@link Text}. This is guaranteed to return a byte array that is the full length of the text, and avoids that particular pitfall
* of {@link Text#getBytes()}. This method is more efficient than {@link Text#copyBytes()} in the case where the byte array returned by
* {@link Text#getBytes()} is already the length of the full data.
*
* @param text
* the text to return the bytes of
* @return the bytes
*/
public static byte[] getBytes(Text text) {
byte[] bytes = text.getBytes();
if (bytes.length != text.getLength()) {
bytes = new byte[text.getLength()];
System.arraycopy(text.getBytes(), 0, bytes, 0, bytes.length);
bytes = text.copyBytes();
}
return bytes;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ public AccumuloResource setOptions(SessionOptions options) {
if (log.isDebugEnabled()) {
log.debug("Setting Options");
}
if (null != options.getConfiguration() && null != options.getConfiguration().getAccumuloPassword()) {
if (null != options.getQueryConfiguration() && null != options.getQueryConfiguration().getAccumuloPassword()) {
if (log.isDebugEnabled()) {
log.debug("Setting and configuration");
}
AccumuloHelper.setPassword(conf, options.getConfiguration().getAccumuloPassword().getBytes());
BulkInputFormat.setMemoryInput(conf, getClient().whoami(), options.getConfiguration().getAccumuloPassword().getBytes(), tableName,
AccumuloHelper.setPassword(conf, options.getQueryConfiguration().getAccumuloPassword().getBytes());
BulkInputFormat.setMemoryInput(conf, getClient().whoami(), options.getQueryConfiguration().getAccumuloPassword().getBytes(), tableName,
auths.iterator().next());
((RfileScanner) baseScanner).setConfiguration(conf);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;

import org.apache.accumulo.core.client.AccumuloClient;
import org.apache.accumulo.core.client.AccumuloException;
Expand All @@ -33,7 +32,6 @@
import datawave.core.common.connection.AccumuloConnectionFactory;
import datawave.core.query.configuration.QueryData;
import datawave.query.config.ShardQueryConfiguration;
import datawave.query.iterator.QueryIterator;
import datawave.query.iterator.QueryOptions;
import datawave.query.jexl.visitors.JexlStringBuildingVisitor;
import datawave.query.planner.QueryPlan;
Expand Down Expand Up @@ -118,7 +116,7 @@ public List<ScannerChunk> apply(QueryData qd) {
options.fetchColumnFamily(new Text(cf));
}

options.setQueryConfig(this.config);
options.setQueryConfiguration(this.config);

String tableName = tableId.canonical();
options.applyExecutionHints(tableName, config.getTableHints());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public Thread newThread(Runnable r) {
}

public BatchScannerSession(ScannerSession other) {
this(other.tableName, other.auths, other.sessionDelegator, other.maxResults, other.settings, other.options, other.ranges);
this(other.tableName, other.auths, other.sessionDelegator, other.maxResults, other.settings, other.ranges);

}

Expand All @@ -188,13 +188,10 @@ public BatchScannerSession(ScannerSession other) {
* the max results
* @param settings
* the query settings
* @param options
* the scanner options
* @param ranges
* list of ranges
*/
public BatchScannerSession(String tableName, Set<Authorizations> auths, ResourceQueue delegator, int maxResults, Query settings, ScannerOptions options,
Collection<Range> ranges) {
public BatchScannerSession(String tableName, Set<Authorizations> auths, ResourceQueue delegator, int maxResults, Query settings, Collection<Range> ranges) {

super(tableName, auths, delegator, maxResults, settings);
Preconditions.checkNotNull(delegator);
Expand Down
Loading
Loading