This is an automated email from the ASF dual-hosted git repository. kturner pushed a commit to branch 2.1 in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/2.1 by this push: new 767d28d99a avoids calling toString on Text for isEmpty (#3572) 767d28d99a is described below commit 767d28d99aee1d460d05f82065346c5451a68b0c Author: Keith Turner <ktur...@apache.org> AuthorDate: Mon Jul 10 11:28:36 2023 -0400 avoids calling toString on Text for isEmpty (#3572) In profiling of an Accumulo map reduce job it was noticed that a good bit of time was spent calling toString on a Text object to check if it was empty. This commit avoids the toString() call and instead checks the text length. --- .../org/apache/accumulo/core/client/mapred/AccumuloOutputFormat.java | 2 +- .../org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java | 2 +- .../org/apache/accumulo/hadoopImpl/mapred/AccumuloRecordWriter.java | 2 +- .../org/apache/accumulo/hadoopImpl/mapreduce/AccumuloRecordWriter.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormat.java b/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormat.java index 10d517c361..6dbecaee6b 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormat.java +++ b/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormat.java @@ -425,7 +425,7 @@ public class AccumuloOutputFormat implements OutputFormat<Text,Mutation> { */ @Override public void write(Text table, Mutation mutation) throws IOException { - if (table == null || table.toString().isEmpty()) { + if (table == null || table.getLength() == 0) { table = this.defaultTableName; } diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java index 3c2193b3d3..c39c1013c1 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java +++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java @@ -426,7 +426,7 @@ public class AccumuloOutputFormat extends OutputFormat<Text,Mutation> { */ @Override public void write(Text table, Mutation mutation) throws IOException { - if (table == null || table.toString().isEmpty()) { + if (table == null || table.getLength() == 0) { table = this.defaultTableName; } diff --git a/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapred/AccumuloRecordWriter.java b/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapred/AccumuloRecordWriter.java index ac012a1cf0..a29caf9c7f 100644 --- a/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapred/AccumuloRecordWriter.java +++ b/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapred/AccumuloRecordWriter.java @@ -89,7 +89,7 @@ public class AccumuloRecordWriter implements RecordWriter<Text,Mutation> { */ @Override public void write(Text table, Mutation mutation) throws IOException { - if (table == null || table.toString().isEmpty()) { + if (table == null || table.getLength() == 0) { table = this.defaultTableName; } diff --git a/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapreduce/AccumuloRecordWriter.java b/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapreduce/AccumuloRecordWriter.java index 1399d8d0b7..fb21102ff2 100644 --- a/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapreduce/AccumuloRecordWriter.java +++ b/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapreduce/AccumuloRecordWriter.java @@ -90,7 +90,7 @@ public class AccumuloRecordWriter extends RecordWriter<Text,Mutation> { */ @Override public void write(Text table, Mutation mutation) throws IOException { - if (table == null || table.toString().isEmpty()) { + if (table == null || table.getLength() == 0) { table = this.defaultTableName; }