Skip to content

Commit

Permalink
Add useful toString().
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Hale committed Feb 10, 2025
1 parent 5befed8 commit d6ee3f8
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public List<InputSplit> getSplits(JobContext context) throws IOException, Interr

for (int i=0; i<repeatCount; i++) {
if (indexFilter == null || indexFilter.test(i)) {
splits.add(new QueryInputSplit(qName, query, i));
splits.add(new QueryInputSplit(qName, query, i, repeatCount));
}
}
}
Expand Down Expand Up @@ -216,15 +216,17 @@ public static QueryInputSplit read(DataInput in) throws IOException {

private String queryName, query;
private int repeatIndex;
private int repeatCount;
private float progress;

public QueryInputSplit() {
}

public QueryInputSplit(String queryName, String query, int repeatIndex) {
public QueryInputSplit(String queryName, String query, int repeatIndex, int repeatCount) {
this.queryName = queryName;
this.query = query;
this.repeatIndex = repeatIndex;
this.repeatCount = repeatCount;
}

public String getQueryName() {
Expand All @@ -239,6 +241,10 @@ public int getRepeatIndex() {
return repeatIndex;
}

public int getRepeatCount() {
return repeatCount;
}

public void setProgress(float p) {
this.progress = p;
}
Expand All @@ -258,13 +264,20 @@ public void write(DataOutput out) throws IOException {
out.writeUTF(queryName);
out.writeUTF(query);
out.writeInt(repeatIndex);
out.writeInt(repeatCount);
}

@Override
public void readFields(DataInput in) throws IOException {
queryName = in.readUTF();
query = in.readUTF();
repeatIndex = in.readInt();
repeatCount = in.readInt();
}

@Override
public String toString() {
return "Split index " + repeatIndex + " of " + repeatCount;
}
}

Expand Down

0 comments on commit d6ee3f8

Please sign in to comment.