Skip to content

Commit

Permalink
Removing unused reduced response from various Attribute methods (#2630)
Browse files Browse the repository at this point in the history
* Removing unused calls from Attribute-based classes
  • Loading branch information
mineralntl authored Jan 10, 2025
1 parent 99ae8d6 commit a6d488b
Show file tree
Hide file tree
Showing 31 changed files with 63 additions and 226 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ protected void clearMetadata() {
metadata = null;
}

protected void writeMetadata(DataOutput out, Boolean reducedResponse) throws IOException {
protected void writeMetadata(DataOutput out) throws IOException {
out.writeBoolean(isMetadataSet());
if (isMetadataSet()) {
byte[] cvBytes = getColumnVisibility().getExpression();
Expand All @@ -172,7 +172,7 @@ protected void writeMetadata(DataOutput out, Boolean reducedResponse) throws IOE
}
}

protected void writeMetadata(Kryo kryo, Output output, Boolean reducedResponse) {
protected void writeMetadata(Kryo kryo, Output output) {
output.writeBoolean(isMetadataSet());
if (isMetadataSet()) {
byte[] cvBytes = getColumnVisibility().getExpression();
Expand Down Expand Up @@ -324,9 +324,9 @@ public Attribute<?> reduceToKeep() {
}
}

public abstract void write(DataOutput output, boolean reducedResponse) throws IOException;
public abstract void write(DataOutput output) throws IOException;

public abstract void write(Kryo kryo, Output output, Boolean reducedResponse);
public abstract void write(Kryo kryo, Output output);

public abstract Object getData();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,6 @@ public Object getData() {

@Override
public void write(DataOutput out) throws IOException {
write(out, false);
}

@Override
public void write(DataOutput out, boolean reducedResponse) throws IOException {
WritableUtils.writeVInt(out, _count);
out.writeBoolean(trackSizes);
// Write out the number of Attributes we're going to store
Expand All @@ -126,7 +121,7 @@ public void write(DataOutput out, boolean reducedResponse) throws IOException {
WritableUtils.writeString(out, attr.getClass().getName());

// Defer to the concrete instance to write() itself
attr.write(out, reducedResponse);
attr.write(out);
}
}

Expand Down Expand Up @@ -284,11 +279,6 @@ public Attribute<?> reduceToKeep() {

@Override
public void write(Kryo kryo, Output output) {
write(kryo, output, false);
}

@Override
public void write(Kryo kryo, Output output, Boolean reducedResponse) {
output.writeInt(this._count, true);
output.writeBoolean(this.trackSizes);
// Write out the number of Attributes we're going to store
Expand All @@ -299,7 +289,7 @@ public void write(Kryo kryo, Output output, Boolean reducedResponse) {
output.writeString(attr.getClass().getName());

// Defer to the concrete instance to write() itself
attr.write(kryo, output, reducedResponse);
attr.write(kryo, output);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,7 @@ public Object getData() {

@Override
public void write(DataOutput out) throws IOException {
write(out, false);
}

@Override
public void write(DataOutput out, boolean reducedResponse) throws IOException {
writeMetadata(out, reducedResponse);
writeMetadata(out);
WritableUtils.writeString(out, content.fieldName);
WritableUtils.writeString(out, content.lower);
WritableUtils.writeString(out, content.upper);
Expand Down Expand Up @@ -151,12 +146,7 @@ public int hashCode() {

@Override
public void write(Kryo kryo, Output output) {
write(kryo, output, false);
}

@Override
public void write(Kryo kryo, Output output, Boolean reducedResponse) {
super.writeMetadata(kryo, output, reducedResponse);
super.writeMetadata(kryo, output);
output.writeString(this.content.fieldName);
output.writeString(this.content.lower);
output.writeString(this.content.upper);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,13 @@ public Object getData() {

@Override
public void write(DataOutput out) throws IOException {
write(out, false);
}

@Override
public void write(DataOutput out, boolean reducedResponse) throws IOException {
writeMetadata(out, reducedResponse);
writeMetadata(out);
WritableUtils.writeString(out, content);
WritableUtils.writeVInt(out, toKeep ? 1 : 0);
out.writeBoolean(source != null);
if (source != null) {
WritableUtils.writeString(out, source.getClass().getCanonicalName());
source.write(out, reducedResponse);
source.write(out);
}
}

Expand Down Expand Up @@ -137,18 +132,13 @@ public Collection<ValueTuple> visit(Collection<String> fieldNames, DatawaveJexlC

@Override
public void write(Kryo kryo, Output output) {
write(kryo, output, false);
}

@Override
public void write(Kryo kryo, Output output, Boolean reducedResponse) {
super.writeMetadata(kryo, output, reducedResponse);
super.writeMetadata(kryo, output);
output.writeString(this.content);
output.writeBoolean(this.toKeep);
output.writeBoolean(this.source != null);
if (source != null) {
output.writeString(this.source.getClass().getCanonicalName());
source.write(kryo, output, reducedResponse);
source.write(kryo, output);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,7 @@ public Object getData() {

@Override
public void write(DataOutput out) throws IOException {
write(out, false);
}

@Override
public void write(DataOutput out, boolean reducedResponse) throws IOException {
writeMetadata(out, reducedResponse);
writeMetadata(out);
WritableUtils.writeString(out, normalizer.parseToString(this.value.getTime()));
}

Expand Down Expand Up @@ -160,12 +155,7 @@ public Collection<ValueTuple> visit(Collection<String> fieldNames, DatawaveJexlC

@Override
public void write(Kryo kryo, Output output) {
write(kryo, output, false);
}

@Override
public void write(Kryo kryo, Output output, Boolean reducedResponse) {
writeMetadata(kryo, output, reducedResponse);
writeMetadata(kryo, output);
output.writeString(normalizer.parseToString(this.value.getTime()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,7 @@ public Object getData() {

@Override
public void write(DataOutput out) throws IOException {
write(out, false);
}

@Override
public void write(DataOutput out, boolean reducedResponse) throws IOException {
writeMetadata(out, reducedResponse);
writeMetadata(out);
WritableUtils.writeString(out, content);
WritableUtils.writeVInt(out, toKeep ? 1 : 0);
}
Expand Down Expand Up @@ -108,12 +103,7 @@ public Collection<ValueTuple> visit(Collection<String> fieldNames, DatawaveJexlC

@Override
public void write(Kryo kryo, Output output) {
write(kryo, output, false);
}

@Override
public void write(Kryo kryo, Output output, Boolean reducedResponse) {
writeMetadata(kryo, output, reducedResponse);
writeMetadata(kryo, output);
output.writeString(this.content);
output.writeBoolean(this.toKeep);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public Attribute<?> get(String key) {
}

public void put(String key, Attribute<?> value) {
put(key, value, false, false);
put(key, value, false);
}

/**
Expand All @@ -250,10 +250,8 @@ public void put(String key, Attribute<?> value) {
* a value
* @param includeGroupingContext
* flag to include grouping context
* @param reducedResponse
* flag for reducedResponse
*/
public void replace(String key, Attribute<?> value, Boolean includeGroupingContext, boolean reducedResponse) {
public void replace(String key, Attribute<?> value, Boolean includeGroupingContext) {
dict.put(key, value);
}

Expand All @@ -268,10 +266,8 @@ public void replace(String key, Attribute<?> value, Boolean includeGroupingConte
* the attribute value
* @param includeGroupingContext
* flag to include grouping context
* @param reducedResponse
* flag for reducedResponse
*/
public void put(String key, Attribute<?> value, Boolean includeGroupingContext, boolean reducedResponse) {
public void put(String key, Attribute<?> value, Boolean includeGroupingContext) {

if (0 == value.size()) {
if (log.isTraceEnabled()) {
Expand Down Expand Up @@ -383,25 +379,16 @@ public void put(String key, Attribute<?> value, Boolean includeGroupingContext,

public void put(Entry<String,Attribute<? extends Comparable<?>>> entry, Boolean includeGroupingContext) {
// No grouping context in the document.
this.put(entry.getKey(), entry.getValue(), includeGroupingContext, false);
}

public void put(Entry<String,Attribute<? extends Comparable<?>>> entry, Boolean includeGroupingContext, boolean reducedResponse) {
// No grouping context in the document.
this.put(entry.getKey(), entry.getValue(), includeGroupingContext, reducedResponse);
this.put(entry.getKey(), entry.getValue(), includeGroupingContext);
}

public void putAll(Iterator<Entry<String,Attribute<? extends Comparable<?>>>> iterator, Boolean includeGroupingContext) {
putAll(iterator, includeGroupingContext, false);
}

public void putAll(Iterator<Entry<String,Attribute<? extends Comparable<?>>>> iterator, Boolean includeGroupingContext, boolean reducedResponse) {
if (null == iterator) {
return;
}

while (iterator.hasNext()) {
put(iterator.next(), includeGroupingContext, reducedResponse);
put(iterator.next(), includeGroupingContext);
}
}

Expand Down Expand Up @@ -546,11 +533,6 @@ public Attribute<?> reduceToKeep() {

@Override
public void write(DataOutput out) throws IOException {
write(out, false);
}

@Override
public void write(DataOutput out, boolean reducedResponse) throws IOException {
WritableUtils.writeVInt(out, _count);
out.writeBoolean(trackSizes);
WritableUtils.writeVLong(out, _bytes);
Expand Down Expand Up @@ -782,11 +764,6 @@ public Collection<ValueTuple> visit(Collection<String> queryFieldNames, Datawave

@Override
public void write(Kryo kryo, Output output) {
write(kryo, output, false);
}

@Override
public void write(Kryo kryo, Output output, Boolean reducedResponse) {
output.writeInt(this._count, true);
output.writeBoolean(trackSizes);
output.writeLong(this._bytes, true);
Expand All @@ -801,7 +778,7 @@ public void write(Kryo kryo, Output output, Boolean reducedResponse) {

Attribute<?> attribute = entry.getValue();
output.writeString(attribute.getClass().getName());
attribute.write(kryo, output, reducedResponse);
attribute.write(kryo, output);
}

output.writeLong(this.shardTimestamp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,7 @@ public Object getData() {

@Override
public void write(DataOutput out) throws IOException {
write(out, false);
}

@Override
public void write(DataOutput out, boolean reducedResponse) throws IOException {
writeMetadata(out, reducedResponse);
writeMetadata(out);
WritableUtils.writeString(out, getShardId());
WritableUtils.writeString(out, getDataType());
WritableUtils.writeString(out, getUid());
Expand Down Expand Up @@ -133,12 +128,7 @@ public Collection<ValueTuple> visit(Collection<String> fieldNames, DatawaveJexlC

@Override
public void write(Kryo kryo, Output output) {
write(kryo, output, false);
}

@Override
public void write(Kryo kryo, Output output, Boolean reducedResponse) {
super.writeMetadata(kryo, output, reducedResponse);
super.writeMetadata(kryo, output);
output.writeString(this.getShardId());
output.writeString(this.getDataType());
output.writeString(this.getUid());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,7 @@ public Object getData() {

@Override
public void write(DataOutput out) throws IOException {
write(out, false);
}

@Override
public void write(DataOutput out, boolean reducedResponse) throws IOException {
writeMetadata(out, reducedResponse);
writeMetadata(out);
WritableUtils.writeString(out, this.point);
WritableUtils.writeVInt(out, toKeep ? 1 : 0);
}
Expand Down Expand Up @@ -134,12 +129,7 @@ public Collection<ValueTuple> visit(Collection<String> fieldNames, DatawaveJexlC

@Override
public void write(Kryo kryo, Output output) {
write(kryo, output, false);
}

@Override
public void write(Kryo kryo, Output output, Boolean reducedResponse) {
writeMetadata(kryo, output, reducedResponse);
writeMetadata(kryo, output);
output.writeString(this.point);
output.writeBoolean(this.toKeep);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,7 @@ public Object getData() {

@Override
public void write(DataOutput out) throws IOException {
write(out, false);
}

@Override
public void write(DataOutput out, boolean reducedResponse) throws IOException {
writeMetadata(out, reducedResponse);
writeMetadata(out);
WritableUtils.writeCompressedByteArray(out, write());
WritableUtils.writeVInt(out, toKeep ? 1 : 0);
}
Expand Down Expand Up @@ -154,12 +149,7 @@ public Collection<ValueTuple> visit(Collection<String> fieldNames, DatawaveJexlC

@Override
public void write(Kryo kryo, Output output) {
write(kryo, output, false);
}

@Override
public void write(Kryo kryo, Output output, Boolean reducedResponse) {
writeMetadata(kryo, output, reducedResponse);
writeMetadata(kryo, output);
output.writeBoolean(this.toKeep);
byte[] wellKnownBinary = write();
output.writeInt(wellKnownBinary.length);
Expand Down
Loading

0 comments on commit a6d488b

Please sign in to comment.