You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2017/06/22 23:26:40 UTC
[1/5] tinkerpop git commit: TINKERPOP-1688 Add annotations to
TraversalMetrics pretty print
Repository: tinkerpop
Updated Branches:
refs/heads/master 391c2f923 -> 099d184cd
TINKERPOP-1688 Add annotations to TraversalMetrics pretty print
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/a9f48dfe
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/a9f48dfe
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/a9f48dfe
Branch: refs/heads/master
Commit: a9f48dfe811039c357d12fac7bd7a93113750d05
Parents: b9a439a
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Jun 8 12:37:34 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Jun 19 13:44:27 2017 -0400
----------------------------------------------------------------------
.../traversal/util/DefaultTraversalMetrics.java | 47 +++++++++++++++++++-
1 file changed, 46 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a9f48dfe/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversalMetrics.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversalMetrics.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversalMetrics.java
index ecf28e0..c5f290a 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversalMetrics.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversalMetrics.java
@@ -121,7 +121,7 @@ public final class DefaultTraversalMetrics implements TraversalMetrics, Serializ
// Grab the values
final Long itemCount = m.getCount(ELEMENT_COUNT_ID);
final Long traverserCount = m.getCount(TRAVERSER_COUNT_ID);
- Double percentDur = (Double) m.getAnnotation(PERCENT_DURATION_KEY);
+ final Double percentDur = (Double) m.getAnnotation(PERCENT_DURATION_KEY);
// Build the row string
@@ -145,10 +145,55 @@ public final class DefaultTraversalMetrics implements TraversalMetrics, Serializ
sb.append(String.format(" %8.2f", percentDur));
}
+ // process any annotations
+ final Map<String,Object> annotations = m.getAnnotations();
+ if (!annotations.isEmpty()) {
+ // ignore the PERCENT_DURATION_KEY as that is a TinkerPop annotation that is displayed by default
+ annotations.entrySet().stream().filter(kv -> !kv.getKey().equals(PERCENT_DURATION_KEY)).forEach(kv -> {
+ final String prefix = " \\_";
+ final String separator = "=";
+ final String k = prefix + StringUtils.abbreviate(kv.getKey(), 30);
+ final int valueIndentLen = separator.length() + k.length() + indent;
+ final int leftover = 110 - valueIndentLen;
+
+ final String[] splitValues = splitOnSize(kv.getValue().toString(), leftover);
+ for (int ix = 0; ix < splitValues.length; ix++) {
+ // the first lines gets the annotation prefix. the rest are indented to the separator
+ if (ix == 0) {
+ sb.append(String.format("%n%s", k + separator + splitValues[ix]));
+ } else {
+ sb.append(String.format("%n%s", padLeft(splitValues[ix], valueIndentLen - 1)));
+ }
+ }
+ });
+ }
+
appendMetrics(m.getNested(), sb, indent + 1);
}
}
+ private static String[] splitOnSize(final String text, final int size) {
+ final String[] ret = new String[(text.length() + size - 1) / size];
+
+ int counter = 0;
+ for (int start = 0; start < text.length(); start += size) {
+ ret[counter] = text.substring(start, Math.min(text.length(), start + size));
+ counter++;
+ }
+
+ return ret;
+ }
+
+ private static String padLeft(final String text, final int amountToPad) {
+ // not sure why this method needed to exist. stupid string format stuff and commons utilities wouldn't
+ // work for some reason in the context this method was used above.
+ String newText = text;
+ for (int ix = 0; ix < amountToPad; ix++) {
+ newText = " " + newText;
+ }
+ return newText;
+ }
+
private void computeTotals() {
// Create temp list of ordered metrics
final List<MutableMetrics> tempMetrics = new ArrayList<>(this.metrics.size());
[3/5] tinkerpop git commit: Merge branch 'TINKERPOP-1688' into tp32
Posted by sp...@apache.org.
Merge branch 'TINKERPOP-1688' into tp32
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/c92d2c0a
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/c92d2c0a
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/c92d2c0a
Branch: refs/heads/master
Commit: c92d2c0a94ab20c5143c385118dc099ef6997d00
Parents: 116205e a9f48df
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Jun 22 19:25:21 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Jun 22 19:25:21 2017 -0400
----------------------------------------------------------------------
.../traversal/util/DefaultTraversalMetrics.java | 47 +++++++++++++++++++-
1 file changed, 46 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
[4/5] tinkerpop git commit: TINKERPOP-1688 updated changelog CTR
Posted by sp...@apache.org.
TINKERPOP-1688 updated changelog CTR
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/46cd072e
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/46cd072e
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/46cd072e
Branch: refs/heads/master
Commit: 46cd072edcd587fa298b92b579f4c956dd4d861b
Parents: c92d2c0
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Jun 22 19:26:10 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Jun 22 19:26:10 2017 -0400
----------------------------------------------------------------------
CHANGELOG.asciidoc | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/46cd072e/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 0bc2c6b..e08ec3e 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -28,6 +28,7 @@ TinkerPop 3.2.6 (Release Date: NOT OFFICIALLY RELEASED YET)
This release also includes changes from <<release-3-1-8, 3.1.8>>.
+* Added annotations to the traversal metrics pretty print.
* Fixed `HADOOP_GREMLIN_LIBS` parsing for Windows.
* Improved GraphSON serialization performance around `VertexProperty`.
[5/5] tinkerpop git commit: Merge branch 'tp32'
Posted by sp...@apache.org.
Merge branch 'tp32'
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/099d184c
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/099d184c
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/099d184c
Branch: refs/heads/master
Commit: 099d184cd24c7a4b73250b54f8a8b4a22ff23180
Parents: 391c2f9 46cd072
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Jun 22 19:26:30 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Jun 22 19:26:30 2017 -0400
----------------------------------------------------------------------
CHANGELOG.asciidoc | 1 +
.../traversal/util/DefaultTraversalMetrics.java | 47 +++++++++++++++++++-
2 files changed, 47 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/099d184c/CHANGELOG.asciidoc
----------------------------------------------------------------------
[2/5] tinkerpop git commit: TINKERPOP-920 Added more javadoc for
getCardinality()
Posted by sp...@apache.org.
TINKERPOP-920 Added more javadoc for getCardinality()
Basically, users shouldn't rely on this method for determining a key's cardinality in production applications. This method is generally for internal use by TinkerPop (mostly for the test suite and other generalized functions) CTR
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/116205eb
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/116205eb
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/116205eb
Branch: refs/heads/master
Commit: 116205ebc7342ae721cf76992653479a95ad2f0d
Parents: ee05582
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Jun 20 12:24:39 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Jun 20 12:31:17 2017 -0400
----------------------------------------------------------------------
.../main/java/org/apache/tinkerpop/gremlin/structure/Graph.java | 5 +++++
1 file changed, 5 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/116205eb/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
index 1f59719..81bbed7 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
@@ -525,6 +525,11 @@ public interface Graph extends AutoCloseable, Host {
* {@link VertexProperty.Cardinality#list}. Implementations that employ a schema can consult it to
* determine the {@link VertexProperty.Cardinality}. Those that do no have a schema can return their
* default {@link VertexProperty.Cardinality} for every key.
+ * <p/>
+ * Note that this method is primarily used by TinkerPop for internal usage and may not be suitable to
+ * reliably determine the cardinality of a key. For some implementation it may offer little more than a
+ * hint on the actual cardinality. Generally speaking it is likely best to drop down to the API of the
+ * {@link Graph} implementation for any schema related queries.
*/
public default VertexProperty.Cardinality getCardinality(final String key) {
return VertexProperty.Cardinality.list;