diff --git a/.github/workflows/javadoc.yml b/.github/workflows/javadoc.yml
index 22bde6d5e..a501686b5 100644
--- a/.github/workflows/javadoc.yml
+++ b/.github/workflows/javadoc.yml
@@ -8,17 +8,16 @@ on:
workflow_dispatch:
inputs:
tag_ref:
- description: 'Existing Git Tag to deploy (e.g., 1.0.0)'
+ description: 'Existing Git Tag to deploy (e.g., 1.0.0):'
required: true
- default: '1.0.0' # Default can be left blank or set to a placeholder
+ # Default can be left blank or set to a placeholder
+ default: '99.0.0' # unlikely to conflict if accidentally used.
jobs:
build-and-deploy-javadoc:
runs-on: ubuntu-latest
permissions:
contents: write
- pages: write
- id-token: write
steps:
- name: Checkout Code at Specified Tag
@@ -35,33 +34,45 @@ jobs:
cache: 'maven'
- name: Build and Generate Javadoc
+ # POM is configured to output to target/site/apidocs
run: mvn javadoc:javadoc
- - name: Deploy Javadoc to gh-pages/docs/${TAG}
+ - name: Deploy Javadoc via Worktree
env:
- GH_PAGES_EMAIL: noreply@github.com
- GH_PAGES_NAME: github-actions[bot]
- GIT_TAG_NAME: ${{ github.event.inputs.tag_ref }}
- TARGET_DIR: docs/${{ github.event.inputs.tag_ref }}
- run: |
- # 1. Configure Git user
- git config user.email "${GH_PAGES_EMAIL}"
- git config user.name "${GH_PAGES_NAME}"
+ TAG_NAME: ${{ github.event.inputs.tag_ref }}
- # 2. Fetch and checkout the existing gh-pages branch
- git fetch origin gh-pages:gh-pages
- git checkout gh-pages
+ run: |
+ # 1. Configure Git Identity
+ git config user.email "noreply@github.com"
+ git config user.name "github-actions[bot]"
- # 3. Clean up any previous documentation for this tag (optional, but safer)
- rm -rf $TARGET_DIR
+ # 2. Ensure gh-pages exists and is fetched
+ git fetch origin gh-pages --depth=1 || git branch gh-pages
+
+ # 3. Create a worktree for the gh-pages branch in a separate folder
+ # This prevents switching the main directory and losing the 'target' folder
+ git worktree add ./gh-pages-dir origin/gh-pages
+
+ # 4. Prepare the target directory inside the worktree
+ TARGET_PATH="gh-pages-dir/docs/$TAG_NAME"
+ mkdir -p $TARGET_PATH
+
+ # 5. Copy the generated docs (using . to copy contents, not the folder itself)
+ cp -a target/site/apidocs/. $TARGET_PATH/
+
+ # 6. Commit and Push from the worktree directory
+ cd gh-pages-dir
+ git add .
- # 4. Create the versioned directory structure
- mkdir -p $TARGET_DIR
+ # Only commit and push if there are actual changes
+ if git diff --staged --quiet; then
+ echo "No changes detected for Javadoc $TAG_NAME."
+ else
+ git commit -m "Manual Javadoc deployment for tag $TAG_NAME"
+ git push origin gh-pages
+ fi
- # 5. Copy the generated Javadoc files into the versioned directory
- cp -r target/reports/apidocs/* $TARGET_DIR/
+ # 7. Cleanup the worktree
+ cd ..
+ git worktree remove ./gh-pages-dir
- # 6. Add the new directory and files, commit, and push
- git add $TARGET_DIR
- git commit -m "Manual Javadoc deployment for tag ${GIT_TAG_NAME} into $TARGET_DIR"
- git push origin gh-pages
diff --git a/.gitignore b/.gitignore
index f03c5078f..f0a5c0998 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,6 +15,7 @@
# Additional tools
.clover/
+.mvn/
# OSX files
**/.DS_Store
diff --git a/.mvn/maven.config b/.mvn/maven.config
new file mode 100644
index 000000000..268ab97a0
--- /dev/null
+++ b/.mvn/maven.config
@@ -0,0 +1,6 @@
+# suppresses the warning:
+# Direct modification of testCompileSourceRoots through add() is deprecated and will not work in Maven 4.0.0. Please use the add/remove methods instead.
+# If you're using a plugin that causes this warning, please upgrade to the latest version and report an issue if the warning persists.
+# To disable these warnings, set -Dmaven.project.sourceRoots.warningsDisabled=true on the command line, in the .mvn/maven.config file,
+# or in project POM properties.
+-Dmaven.project.sourceRoots.warningsDisabled=true
diff --git a/pom.xml b/pom.xml
index ab514cef5..d0364662b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -129,7 +129,6 @@ under the License.
2.19.1
1.0.0
- 0.17
@@ -143,343 +142,263 @@ under the License.
-
-
- org.apache.maven.plugins
- maven-assembly-plugin
- ${maven-assembly-plugin.version}
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- ${maven-compiler-plugin.version}
-
- true
- ${java.version}
-
- -J${jvm.options}
-
-
-
-
-
- org.apache.maven.plugins
- maven-dependency-plugin
- ${maven-dependency-plugin.version}
-
-
-
-
-
- org.apache.maven.plugins
- maven-deploy-plugin
- ${maven-deploy-plugin.version}
-
-
-
- org.apache.maven.plugins
- maven-enforcer-plugin
- ${maven-enforcer-plugin.version}
-
-
- enforce-banned-dependencies
-
- enforce
-
-
-
-
- [25,)
-
-
- [${maven.version},)
-
-
-
-
-
- com.google.code.findbugs:annotations
-
-
-
- true
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-jar-plugin
- ${maven-jar-plugin.version}
-
-
- default-jar
- package
-
- jar
-
-
-
- default-test-jar
- package
-
- test-jar
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-javadoc-plugin
- ${maven-javadoc-plugin.version}
-
- true
- public
- all,-missing
- ${java.version}
-
- -J${jvm.options}
-
-
-
-
- attach-javadocs
-
- jar
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-release-plugin
- ${maven-release-plugin.version}
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- ${maven-source-plugin.version}
-
-
- attach-sources
- package
-
- jar-no-fork
-
-
-
- attach-test-sources
- package
-
- test-jar-no-fork
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire-failsafe-plugins.version}
-
- 1
- true
- ${argLine} ${jvm.options}
- false
- false
- true
- ${project.build.directory}/test-output/${maven.build.timestamp}
- ${testng.generate-java-files},${testng.check-cpp-files},${testng.check-go-files},${testng.check-cpp-historical-files}
-
-
-
-
- org.apache.maven.plugins
- maven-toolchains-plugin
- ${maven-toolchains-plugin.version}
-
-
-
- toolchain
-
-
-
-
-
-
- ${java.version}
-
-
-
-
-
-
- org.apache.rat
- apache-rat-plugin
- ${apache-rat-plugin.version}
-
-
- verify
-
- check
-
-
-
-
- ${project.basedir}/rat
- true
-
-
- StandardCollection
- **/*.yaml
- **/*.yml
- **/.*
- **/test/resources/**/*.txt
- **/git.properties
- **/doc/**
- **/*.sk
- LICENSE
- NOTICE
- **/*.code-workspace
-
-
-
-
-
- org.codehaus.mojo
- versions-maven-plugin
- ${versions-maven-plugin.version}
-
-
-
-
- org.eluder.coveralls
- coveralls-maven-plugin
- ${coveralls-maven-plugin.version}
-
- ${coveralls-repo-token}
-
-
-
-
-
- org.jacoco
- jacoco-maven-plugin
- ${jacoco-maven-plugin.version}
-
-
- default-prepare-agent
-
- prepare-agent
-
-
-
- default-report
- test
-
- report
-
-
-
-
-
-
- pl.project13.maven
- git-commit-id-plugin
- ${git-commit-id-plugin.version}
-
-
-
- io.github.zlika
- reproducible-build-maven-plugin
- ${reproducible-build-maven-plugin.version}
-
-
-
- strip-jar
-
-
-
-
-
-
-
-
org.apache.maven.plugins
maven-assembly-plugin
+ ${maven-assembly-plugin.version}
+
org.apache.maven.plugins
maven-compiler-plugin
+ ${maven-compiler-plugin.version}
+
+ true
+ ${java.version}
+
+ -J${jvm.options}
+
+
+
org.apache.maven.plugins
maven-dependency-plugin
+ ${maven-dependency-plugin.version}
+
+
+
org.apache.maven.plugins
maven-deploy-plugin
+ ${maven-deploy-plugin.version}
+
org.apache.maven.plugins
maven-enforcer-plugin
+ ${maven-enforcer-plugin.version}
+
+
+ enforce-banned-dependencies
+
+ enforce
+
+
+
+
+ [25,)
+
+
+ [${maven.version},)
+
+
+
+
+
+ com.google.code.findbugs:annotations
+
+
+
+ true
+
+
+
+
org.apache.maven.plugins
maven-jar-plugin
+ ${maven-jar-plugin.version}
+
+
+ default-jar
+ package
+
+ jar
+
+
+
+ default-test-jar
+ package
+
+ test-jar
+
+
+
+
org.apache.maven.plugins
maven-javadoc-plugin
+ ${maven-javadoc-plugin.version}
+
+ ${project.reporting.outputDirectory}
+ ${project.reporting.outputDirectory}
+ ${project.reporting.outputDirectory}
+ apidocs
+ true
+ public
+ all,-missing
+ ${java.version}
+
+ -J${jvm.options}
+
+
+
+
+ attach-javadocs
+
+ jar
+
+
+
+
org.apache.maven.plugins
maven-release-plugin
+ ${maven-release-plugin.version}
+
org.apache.maven.plugins
maven-source-plugin
+ ${maven-source-plugin.version}
+
+
+ attach-sources
+ package
+
+ jar-no-fork
+
+
+
+ attach-test-sources
+ package
+
+ test-jar-no-fork
+
+
+
+
org.apache.maven.plugins
maven-surefire-plugin
+ ${maven-surefire-failsafe-plugins.version}
+
+ 1
+ true
+ ${argLine} ${jvm.options}
+ false
+ false
+ true
+ ${project.build.directory}/test-output/${maven.build.timestamp}
+ ${testng.generate-java-files},${testng.check-cpp-files},${testng.check-go-files},
+${testng.check-cpp-historical-files}
+
+
org.apache.maven.plugins
maven-toolchains-plugin
+ ${maven-toolchains-plugin.version}
+
+
+
+ toolchain
+
+
+
+
+
+
+ ${java.version}
+
+
+
+
org.apache.rat
apache-rat-plugin
+ ${apache-rat-plugin.version}
+
+
+ verify
+
+ check
+
+
+
+
+ ${project.basedir}/rat
+ true
+
+
+ StandardCollection
+ **/*.yaml
+ **/*.yml
+ **/.*
+ **/test/resources/**/*.txt
+ **/git.properties
+ **/doc/**
+ **/*.sk
+ LICENSE
+ NOTICE
+ **/*.code-workspace
+
+
+
org.codehaus.mojo
versions-maven-plugin
+ ${versions-maven-plugin.version}
+
+
org.eluder.coveralls
coveralls-maven-plugin
+ ${coveralls-maven-plugin.version}
+
+ ${coveralls-repo-token}
+
+
+
org.jacoco
jacoco-maven-plugin
+ ${jacoco-maven-plugin.version}
+
+
+ default-prepare-agent
+
+ prepare-agent
+
+
+
+ default-report
+ test
+
+ report
+
+
+
+
pl.project13.maven
git-commit-id-plugin
+ ${git-commit-id-plugin.version}
-
- io.github.zlika
- reproducible-build-maven-plugin
-
+
diff --git a/src/main/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSummary.java b/src/main/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSummary.java
index 4197cd285..5008fecd5 100644
--- a/src/main/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSummary.java
+++ b/src/main/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSummary.java
@@ -36,19 +36,16 @@
*/
public final class ArrayOfStringsSummary implements UpdatableSummary {
- private String[] stringArr = null;
+ private String[] stringArr = new String[] {}; //empty string array;
/**
* No argument constructor.
*/
- ArrayOfStringsSummary() { //required for ArrayOfStringsSummaryFactory
- stringArr = null;
- }
+ ArrayOfStringsSummary() {} //required for ArrayOfStringsSummaryFactory
//Used by copy() and in test
ArrayOfStringsSummary(final String[] stringArr) {
- this.stringArr = stringArr.clone();
- checkNumNodes(stringArr.length);
+ update(stringArr);
}
//used by fromMemorySegment and in test
@@ -87,10 +84,20 @@ public final class ArrayOfStringsSummary implements UpdatableSummary {
this.stringArr = stringArr;
}
+ //From UpdatableSummary
+
+ @Override
+ public final ArrayOfStringsSummary update(final String[] value) {
+ if (value == null) { stringArr = new String[] {}; }
+ else { stringArr = value.clone(); }
+ return this;
+ }
+
+ //From Summary
+
@Override
public ArrayOfStringsSummary copy() {
- final ArrayOfStringsSummary nodes = new ArrayOfStringsSummary(stringArr);
- return nodes;
+ return new ArrayOfStringsSummary(stringArr);
}
@Override
@@ -112,16 +119,6 @@ public byte[] toByteArray() {
return out;
}
- //From UpdatableSummary
-
- @Override
- public ArrayOfStringsSummary update(final String[] value) {
- if (stringArr == null) {
- stringArr = value.clone();
- }
- return this;
- }
-
//From Object
@Override
@@ -139,6 +136,8 @@ public boolean equals(final Object summary) {
return thisStr.equals(thatStr);
}
+ //Local
+
/**
* Returns the nodes array for this summary.
* @return the nodes array for this summary.
diff --git a/src/test/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSketchTest.java b/src/test/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSketchTest.java
index ef39e6b90..b9aaf576e 100644
--- a/src/test/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSketchTest.java
+++ b/src/test/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSketchTest.java
@@ -47,24 +47,32 @@ public void checkSketch() {
String[][] strArrArr = {{"a","b"},{"c","d"},{"e","f"}};
int len = strArrArr.length;
for (int i = 0; i < len; i++) {
- sketch1.update(strArrArr[i], strArrArr[i]);
+ sketch1.update(i, strArrArr[i]);
}
- sketch1.update(strArrArr[0], strArrArr[0]); //insert duplicate
+ println("Sketch1");
printSummaries(sketch1.iterator());
- byte[] array = sketch1.toByteArray();
- MemorySegment wseg = MemorySegment.ofArray(array);
+
+ sketch1.update(0, strArrArr[0]); //insert duplicate
+ println("Sketch1 updated with a duplicate");
+ printSummaries(sketch1.iterator());
+
+ MemorySegment wseg = MemorySegment.ofArray(sketch1.toByteArray());
ArrayOfStringsTupleSketch sketch2 = new ArrayOfStringsTupleSketch(wseg);
+ println("Sketch2 = Sketch1 via SerDe");
printSummaries(sketch2.iterator());
- checkSummaries(sketch2, sketch2);
+ checkSummariesEqual(sketch1, sketch2);
String[] strArr3 = {"g", "h" };
- sketch2.update(strArr3, strArr3);
-
+ sketch2.update(3, strArr3);
+ println("Sketch2 with a new row");
+ printSummaries(sketch2.iterator());
+
TupleUnion union = new TupleUnion<>(new ArrayOfStringsSummarySetOperations());
union.union(sketch1);
union.union(sketch2);
CompactTupleSketch csk = union.getResult();
- //printSummaries(csk.iterator());
+ println("Result of union of Sketch1, Sketch2");
+ printSummaries(csk.iterator());
assertEquals(csk.getRetainedEntries(), 4);
TupleIntersection inter =
@@ -72,17 +80,21 @@ public void checkSketch() {
inter.intersect(sketch1);
inter.intersect(sketch2);
csk = inter.getResult();
+ println("Intersect Sketch1, Sketch2");
+ printSummaries(csk.iterator());
assertEquals(csk.getRetainedEntries(), 3);
TupleAnotB aNotB = new TupleAnotB<>();
aNotB.setA(sketch2);
aNotB.notB(sketch1);
csk = aNotB.getResult(true);
+ println("AnotB(Sketch2, Sketch1)");
+ printSummaries(csk.iterator());
assertEquals(csk.getRetainedEntries(), 1);
}
- private static void checkSummaries(ArrayOfStringsTupleSketch sk1, ArrayOfStringsTupleSketch sk2) {
+ private static void checkSummariesEqual(ArrayOfStringsTupleSketch sk1, ArrayOfStringsTupleSketch sk2) {
TupleSketchIterator it1 = sk1.iterator();
TupleSketchIterator it2 = sk2.iterator();
while(it1.next() && it2.next()) {
@@ -100,6 +112,7 @@ static void printSummaries(TupleSketchIterator it) {
}
println("");
}
+ println("");
}
@Test
@@ -108,7 +121,7 @@ public void checkCopyCtor() {
String[][] strArrArr = {{"a","b"},{"c","d"},{"e","f"}};
int len = strArrArr.length;
for (int i = 0; i < len; i++) {
- sk1.update(strArrArr[i], strArrArr[i]);
+ sk1.update(i, strArrArr[i]);
}
assertEquals(sk1.getRetainedEntries(), 3);
final ArrayOfStringsTupleSketch sk2 = sk1.copy();
diff --git a/src/test/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSummary_Issue699.java b/src/test/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSummary_Issue699.java
new file mode 100644
index 000000000..7e68fc1de
--- /dev/null
+++ b/src/test/java/org/apache/datasketches/tuple/strings/ArrayOfStringsSummary_Issue699.java
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.datasketches.tuple.strings;
+
+import static org.apache.datasketches.common.Util.LS;
+
+import org.apache.datasketches.theta.UpdatableThetaSketch;
+import org.apache.datasketches.tuple.TupleSketchIterator;
+import org.apache.datasketches.tuple.TupleUnion;
+import org.testng.annotations.Test;
+
+public class ArrayOfStringsSummary_Issue699 {
+ UpdatableThetaSketch thetaSk = UpdatableThetaSketch.builder().build();
+ ArrayOfStringsTupleSketch tupleSk = new ArrayOfStringsTupleSketch();
+ TupleUnion union = new TupleUnion<>(new ArrayOfStringsSummarySetOperations());
+
+ @Test
+ void go() {
+ thetaSk.update("a");
+ thetaSk.update("b");
+ thetaSk.update("c");
+
+ tupleSk.update("a", new String[] {"x", "y"});
+ tupleSk.update("b", new String[] {"z"});
+ tupleSk.update("e", new String[] {"x", "z"});
+
+ println("Print Tuple Summary before union");
+ printSummaries(tupleSk.iterator());
+
+ union.union(tupleSk);
+ union.union(thetaSk, new ArrayOfStringsSummary()); //enable this or the next
+ //union.union(thetaSk, new ArrayOfStringsSummary(new String[] {"u", "v"})); //optional association
+
+ println("Print Tuple Summary after union");
+ printSummaries(union.getResult().iterator());
+ }
+
+ @Test
+ void checkCopy() {
+ ArrayOfStringsSummary aoss = new ArrayOfStringsSummary();
+ aoss.copy(); //if null this will throw
+ }
+
+ @Test
+ void checkToByteArray() {
+ ArrayOfStringsSummary aoss = new ArrayOfStringsSummary();
+ byte[] bytes = aoss.toByteArray();
+ println("byte[].length = " + bytes.length);
+ }
+
+
+ static void printSummaries(TupleSketchIterator it) {
+ while (it.next()) {
+ String[] strArr = it.getSummary().getValue();
+ if (strArr.length == 0) { print("-"); } //illustrates an empty string array
+ for (String s : strArr) {
+ print(s + ", ");
+ }
+ println("");
+ }
+ println("");
+ }
+
+ private static void println(Object o) {
+ print(o + LS);
+ }
+
+ private static void print(Object o) {
+ //System.out.print(o.toString());
+ }
+}