This is an automated email from the ASF dual-hosted git repository.
leerho pushed a commit to branch master
in repository
https://gitbox.apache.org/repos/asf/datasketches-characterization.git
The following commit(s) were added to refs/heads/master by this push:
new 3a5171e Fixed some compatibility issues so that the java code in this
repo stays in sync with the latest release of java.
3a5171e is described below
commit 3a5171e58b2e3a83d45ed206133c469f692a1543
Author: Lee Rhodes <[email protected]>
AuthorDate: Fri Nov 17 18:09:10 2023 -0800
Fixed some compatibility issues so that the java code in this repo stays
in sync with the latest release of java.
---
pom.xml | 14 +++++++++---
src/main/java/org/apache/datasketches/Job.java | 25 ++++++++++++++++------
.../characterization/AccuracyStats.java | 6 +++---
.../req/ReqSketchAccuracyProfile.java | 8 +++----
.../req/ReqSketchAccuracyProfile2.java | 8 +++----
.../uniquecount/BaseAccuracyProfile.java | 2 +-
6 files changed, 41 insertions(+), 22 deletions(-)
diff --git a/pom.xml b/pom.xml
index 2e9982a..46f98f8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -84,11 +84,12 @@ under the License.
<properties>
<!-- UNIQUE FOR THIS JAVA COMPONENT -->
<datasketches-memory.version>2.2.0</datasketches-memory.version>
- <datasketches-java.version>4.1.0</datasketches-java.version>
+ <datasketches-java.version>4.2.0</datasketches-java.version>
<!-- END:UNIQUE FOR THIS JAVA COMPONENT -->
<!-- Test -->
<testng.version>7.5.1</testng.version>
+ <datasketches-java-common.version>1.0.0</datasketches-java-common.version>
<!-- System-wide properties -->
<maven.version>3.5.0</maven.version>
@@ -146,14 +147,21 @@ under the License.
<version>${datasketches-java.version}</version>
</dependency>
- <!-- Dependency on Test code -->
+ <!-- Test Scope -->
+ <dependency>
+ <groupId>org.apache.datasketches</groupId>
+ <artifactId>datasketches-java-common</artifactId>
+ <version>${datasketches-java-common.version}</version>
+ <scope>test</scope>
+ </dependency>
+
<dependency>
<groupId>org.apache.datasketches</groupId>
<artifactId>datasketches-java</artifactId>
<version>${datasketches-java.version}</version>
<type>test-jar</type>
</dependency>
-
+
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
diff --git a/src/main/java/org/apache/datasketches/Job.java
b/src/main/java/org/apache/datasketches/Job.java
index 2167dc8..0f28ef2 100644
--- a/src/main/java/org/apache/datasketches/Job.java
+++ b/src/main/java/org/apache/datasketches/Job.java
@@ -19,17 +19,20 @@
package org.apache.datasketches;
-import static org.apache.datasketches.Files.isFileValid;
import static org.apache.datasketches.Files.openPrintWriter;
-import static org.apache.datasketches.common.Util.getResourcePath;
import static org.apache.datasketches.common.Util.milliSecToString;
+import java.io.File;
+import java.io.IOException;
import java.io.PrintWriter;
+import java.nio.charset.Charset;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.SimpleTimeZone;
+import org.apache.datasketches.common.test.ResourceFiles;
+
/**
* This class parses an input string job file, which contains properties for a
specific
* JobProfile, and then loads and runs the JobProfile.
@@ -59,11 +62,13 @@ public class Job {
*/
public Job(final String jobConfigureFileName) {
final String jobConfStr;
- if (isFileValid(jobConfigureFileName)) { //assumes fully qualified
- jobConfStr = Files.fileToString(jobConfigureFileName); //includes line
feeds
- } else {
- final String path = getResourcePath(jobConfigureFileName); //try
resources
- jobConfStr = Files.fileToString(path); //includes line feeds
+ File file = new File(jobConfigureFileName);
+ if (file.exists() && file.isFile()) { //assumes fully qualified
+ jobConfStr = readFile(file); //includes line feeds
+ }
+ else {
+ file = ResourceFiles.getResourceFile(jobConfigureFileName); //try
resources
+ jobConfStr = readFile(file); //includes line feeds
}
prop = parseJobProperties(jobConfStr);
@@ -100,6 +105,12 @@ public class Job {
pwData.close();
}
+ public String readFile(final File file) {
+ try {
+ return new String(java.nio.file.Files.readAllBytes(file.toPath()),
Charset.defaultCharset());
+ } catch (final IOException e) { throw new RuntimeException(e); }
+ }
+
/**
* Gets a human-readable date string given the time in milliseconds.
* @param timeMillisec the given time generated from
System.currentTimeMillis().
diff --git
a/src/main/java/org/apache/datasketches/characterization/AccuracyStats.java
b/src/main/java/org/apache/datasketches/characterization/AccuracyStats.java
index 4380cb7..331d545 100644
--- a/src/main/java/org/apache/datasketches/characterization/AccuracyStats.java
+++ b/src/main/java/org/apache/datasketches/characterization/AccuracyStats.java
@@ -80,7 +80,7 @@ public class AccuracyStats {
}
/**
- * Build the AccuracyStats Array
+ * Build the AccuracyStats Array based on fractional powers of 2
* @param lgMin log_base2 of the minimum number of uniques used
* @param lgMax log_base2 of the maximum number of uniques used
* @param ppo the number of points per octave
@@ -100,7 +100,7 @@ public class AccuracyStats {
}
/**
- * Build the AccuracyStats Array for Intersection.
+ * Build the AccuracyStats Array for Intersection based on fractional powers
of 2.
* All elements of the AccuracyStats array have 2^lgMin values as the
trueValue.
* @param lgMin log_base2 of the minimum number of uniques used
* @param lgMax log_base2 of the maximum number of uniques used
@@ -122,7 +122,7 @@ public class AccuracyStats {
}
/**
- * Build the AccuracyStats Array
+ * Build the AccuracyStats Array based on fractional powers of 10
* @param log10Min log_base2 of the minimum number of uniques used
* @param log10Max log_base2 of the maximum number of uniques used
* @param ppb the number of points per base (10)
diff --git
a/src/main/java/org/apache/datasketches/characterization/req/ReqSketchAccuracyProfile.java
b/src/main/java/org/apache/datasketches/characterization/req/ReqSketchAccuracyProfile.java
index 3cb7daf..5e1bba4 100644
---
a/src/main/java/org/apache/datasketches/characterization/req/ReqSketchAccuracyProfile.java
+++
b/src/main/java/org/apache/datasketches/characterization/req/ReqSketchAccuracyProfile.java
@@ -35,7 +35,7 @@ import org.apache.datasketches.hll.HllSketch;
import org.apache.datasketches.quantiles.DoublesSketch;
import org.apache.datasketches.quantiles.DoublesSketchBuilder;
import org.apache.datasketches.quantiles.UpdateDoublesSketch;
-import org.apache.datasketches.req.ReqDebugImpl;
+import org.apache.datasketches.req.ReqDebugImplTest;
import org.apache.datasketches.req.ReqSketch;
import org.apache.datasketches.req.ReqSketchBuilder;
@@ -75,7 +75,7 @@ public class ReqSketchAccuracyProfile implements JobProfile {
private int K;
private boolean hra; //high rank accuracy
private boolean ltEq;
- private org.apache.datasketches.req.ReqDebugImpl reqDebugImpl = null;
+ private org.apache.datasketches.req.ReqDebugImplTest reqDebugImplTest = null;
// TEMPORARY
@@ -172,7 +172,7 @@ public class ReqSketchAccuracyProfile implements JobProfile
{
final String reqDebugFmt = prop.get("ReqDebugFmt");
if (reqDebugLevel != null) {
final int level = Integer.parseInt(reqDebugLevel);
- reqDebugImpl = new ReqDebugImpl(level, reqDebugFmt);
+ reqDebugImplTest = new ReqDebugImplTest(level, reqDebugFmt);
}
}
@@ -195,7 +195,7 @@ public class ReqSketchAccuracyProfile implements JobProfile
{
void configureSketch() {
final ReqSketchBuilder bldr = ReqSketch.builder();
bldr.setK(K).setHighRankAccuracy(hra);
- if (reqDebugImpl != null) { bldr.setReqDebug(reqDebugImpl); }
+ if (reqDebugImplTest != null) { bldr.setReqDebug(reqDebugImplTest); }
sk = bldr.build();
}
diff --git
a/src/main/java/org/apache/datasketches/characterization/req/ReqSketchAccuracyProfile2.java
b/src/main/java/org/apache/datasketches/characterization/req/ReqSketchAccuracyProfile2.java
index dd36711..bb9e982 100644
---
a/src/main/java/org/apache/datasketches/characterization/req/ReqSketchAccuracyProfile2.java
+++
b/src/main/java/org/apache/datasketches/characterization/req/ReqSketchAccuracyProfile2.java
@@ -29,7 +29,7 @@ import
org.apache.datasketches.characterization.req.StreamMaker.Pattern;
import org.apache.datasketches.quantiles.DoublesSketch;
import org.apache.datasketches.quantiles.DoublesSketchBuilder;
import org.apache.datasketches.quantiles.UpdateDoublesSketch;
-import org.apache.datasketches.req.ReqDebugImpl;
+import org.apache.datasketches.req.ReqDebugImplTest;
import org.apache.datasketches.req.ReqSketch;
import org.apache.datasketches.req.ReqSketchBuilder;
@@ -59,7 +59,7 @@ public class ReqSketchAccuracyProfile2 implements JobProfile {
private int K;
private boolean hra;
private boolean ltEq;
- private org.apache.datasketches.req.ReqDebugImpl reqDebugImpl = null;
+ private org.apache.datasketches.req.ReqDebugImplTest reqDebugImplTest = null;
//DERIVED INTERNAL globals
private ReqSketch sk;
@@ -135,14 +135,14 @@ public class ReqSketchAccuracyProfile2 implements
JobProfile {
final String reqDebugFmt = prop.get("ReqDebugFmt");
if (reqDebugLevel != null) {
final int level = Integer.parseInt(reqDebugLevel);
- reqDebugImpl = new ReqDebugImpl(level, reqDebugFmt);
+ reqDebugImplTest = new ReqDebugImplTest(level, reqDebugFmt);
}
}
private void configureSketch() {
final ReqSketchBuilder bldr = ReqSketch.builder();
bldr.setK(K).setHighRankAccuracy(hra);
- if (reqDebugImpl != null) { bldr.setReqDebug(reqDebugImpl); }
+ if (reqDebugImplTest != null) { bldr.setReqDebug(reqDebugImplTest); }
sk = bldr.build();
}
diff --git
a/src/main/java/org/apache/datasketches/characterization/uniquecount/BaseAccuracyProfile.java
b/src/main/java/org/apache/datasketches/characterization/uniquecount/BaseAccuracyProfile.java
index 24db995..ed9cca5 100644
---
a/src/main/java/org/apache/datasketches/characterization/uniquecount/BaseAccuracyProfile.java
+++
b/src/main/java/org/apache/datasketches/characterization/uniquecount/BaseAccuracyProfile.java
@@ -184,7 +184,7 @@ public abstract class BaseAccuracyProfile implements
JobProfile {
final double meanRelErr = q.sumRelErr / cumTrials;
final double meanSqErr = q.sumSqErr / cumTrials; //intermediate value
final double normMeanSqErr = meanSqErr / (trueUniques * trueUniques);
//intermediate value
- final double rmsRelErr = Math.sqrt(normMeanSqErr); //a.k.a. Normalied
RMS Error or NRMSE
+ final double rmsRelErr = Math.sqrt(normMeanSqErr); //a.k.a. Normalized
RMS Error or NRMSE
q.rmsre = rmsRelErr;
final int bytes = q.bytes;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]