Skip to content

Commit

Permalink
Merge branch 'integration' into merged-dependabot-changes
Browse files Browse the repository at this point in the history
  • Loading branch information
alerman authored Dec 17, 2024
2 parents 887ef80 + 653b485 commit c6bb9c7
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 25 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
<version.spring>5.2.2.RELEASE</version.spring>
<version.springframework>${version.spring}</version.springframework>
<version.stream>2.9.6</version.stream>
<version.surefire.plugin>3.2.5</version.surefire.plugin>
<version.surefire.plugin>3.5.2</version.surefire.plugin>
<version.thrift>0.17.0</version.thrift>
<version.weld>3.1.1.Final</version.weld>
<version.weld-se>3.1.1.Final</version.weld-se>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ protected enum FieldExclusionType {
private static final Logger log = Logger.getLogger(FieldAgeOffFilter.class);

/**
* Determine whether or not the rules are applied
* Determine whether the rules are applied
*/
protected boolean ruleApplied = false;

Expand All @@ -104,9 +104,9 @@ protected enum FieldExclusionType {
protected Set<FieldExclusionType> fieldExcludeOptions = null;

/**
* Required by the {@code FilterRule} interface. This method returns a {@code boolean} value indicating whether or not to allow the {@code (Key, Value)}
* pair through the rule. A value of {@code true} indicates that he pair should be passed onward through the {@code Iterator} stack, and {@code false}
* indicates that the {@code (Key, Value)} pair should not be passed on.
* Required by the {@code FilterRule} interface. This method returns a {@code boolean} value indicating whether to allow the {@code (Key, Value)} pair
* through the rule. A value of {@code true} indicates that he pair should be passed onward through the {@code Iterator} stack, and {@code false} indicates
* that the {@code (Key, Value)} pair should not be passed on.
*
* <p>
* If the value provided in the parameter {@code k} does not match the REGEX pattern specified in this filter's configuration options, then a value of
Expand All @@ -116,27 +116,20 @@ protected enum FieldExclusionType {
* {@code Key} object containing the row, column family, and column qualifier.
* @param v
* {@code Value} object containing the value corresponding to the {@code Key: k}
* @return {@code boolean} value indicating whether or not to allow the {@code Key, Value} through the {@code Filter}.
* @return {@code boolean} value indicating whether to allow the {@code Key, Value} through the {@code Filter}.
*/
@Override
public boolean accept(AgeOffPeriod period, Key k, Value v) {

ruleApplied = false;
// if accepted by ColumnVisibilityOrFilter logic, pass the K/V up the iterator stack
// otherwise evaluate based on field
if (cvOrFilter.hasToken(k, v, this.cvOrFilter.getPatternBytes()) == false) {
return true;
}

// get the column qualifier, so that we can use it throughout
final byte[] cq = k.getColumnQualifierData().getBackingArray();

ByteSequence field = null;
FieldExclusionType candidateExclusionType = null;

/**
* Supports the shard and index table. There should not be a failure, however if either one is used on the incorrect table
*/
// Supports the shard and index table. There should not be a failure, however if either one is used on the incorrect table
if (isIndextable) {
field = k.getColumnFamilyData();

Expand Down Expand Up @@ -206,13 +199,15 @@ public boolean accept(AgeOffPeriod period, Key k, Value v) {
return true;
}

Long dataTypeCutoff = (fieldTimes.containsKey(field)) ? fieldTimes.get(field) : null;
if (dataTypeCutoff != null) {
ruleApplied = true;
return CompositeTimestamp.getAgeOffDate(k.getTimestamp()) > dataTypeCutoff;
Long dataTypeCutoff = fieldTimes.get(field);

// evaluating field first then the ColumnVisibilityOrFilter based on performance test results
if (dataTypeCutoff == null || !cvOrFilter.hasToken(k, v, this.cvOrFilter.getPatternBytes())) {
return true;
}

return true;
ruleApplied = true;
return CompositeTimestamp.getAgeOffDate(k.getTimestamp()) > dataTypeCutoff;
}

/**
Expand Down Expand Up @@ -275,7 +270,7 @@ protected void init(FilterOptions options, final long startScan, IteratorEnviron
isIndextable = Boolean.parseBoolean(iterEnv.getConfig().get("table.custom." + AgeOffConfigParams.IS_INDEX_TABLE));
}
} else { // legacy
isIndextable = Boolean.valueOf(options.getOption(AgeOffConfigParams.IS_INDEX_TABLE));
isIndextable = Boolean.parseBoolean(options.getOption(AgeOffConfigParams.IS_INDEX_TABLE));
}

fieldExcludeOptions = new HashSet<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,20 @@ public boolean containsKey(String key) {
@Override
public void read(Kryo kryo, Input input) {
counts.clear();
int size = input.readInt();
int size = input.readInt(true);
for (int i = 0; i < size; i++) {
String key = input.readString();
Long value = input.readLong();
Long value = input.readLong(true);
put(key, value);
}
}

@Override
public void write(Kryo kryo, Output output) {
output.writeInt(keySet().size());
output.writeInt(keySet().size(), true);
for (Entry<String,Long> entry : entrySet()) {
output.writeString(entry.getKey());
output.writeLong(entry.getValue());
output.writeLong(entry.getValue(), true);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ void testSerDeBytes() {
map.put("FIELD_B", 23L);

byte[] data = serDe.serialize(map);
assertEquals(18, data.length); // 35 without optimizing integers/longs
CountMap deserialized = serDe.deserialize(data);

assertMap(map, deserialized);
Expand All @@ -29,6 +30,7 @@ void testSerDeString() {
map.put("FIELD_B", 23L);

String s = serDe.serializeToString(map);
assertEquals(18, s.length()); // 35 without optimizing integers/longs
CountMap deserialized = serDe.deserializeFromString(s);

assertMap(map, deserialized);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ private static class MockAccumuloConnectionFactory implements AccumuloConnection

public MockAccumuloConnectionFactory() {
try {
inMemoryInstance.getConnector("root", "").securityOperations().changeUserAuthorizations("root", new Authorizations("PUB", "PVT"));
new InMemoryAccumuloClient("root", inMemoryInstance).securityOperations().changeUserAuthorizations("root", new Authorizations("PUB", "PVT"));
} catch (AccumuloException | AccumuloSecurityException e) {
throw new RuntimeException(e);
}
Expand Down

0 comments on commit c6bb9c7

Please sign in to comment.