[tinkerpop] branch tp4 updated: I have a working implementation of recurssive-based repeat() in RxJava. This was an intense slog. Learned alot. I have written some pretty nasty nested branching test c

2019-04-18 Thread okram
This is an automated email from the ASF dual-hosted git repository.

okram pushed a commit to branch tp4
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git


The following commit(s) were added to refs/heads/tp4 by this push:
 new 6b39526  I have a working implementation of recurssive-based repeat() 
in RxJava. This was an intense slog. Learned alot. I have written some pretty 
nasty nested branching test cases and the model is holding up.
6b39526 is described below

commit 6b39526f4bd0109d6789af5c1d300bc18463c6d3
Author: Marko A. Rodriguez 
AuthorDate: Thu Apr 18 11:12:23 2019 -0600

I have a working implementation of recurssive-based repeat() in RxJava. 
This was an intense slog. Learned alot. I have written some pretty nasty nested 
branching test cases and the model is holding up.
---
 .../apache/tinkerpop/machine/SimpleTestSuite.java  |  14 +++
 .../machine/processor/rxjava/RepeatHead.java   | 135 +
 .../machine/processor/rxjava/RepeatTail.java   | 119 ++
 .../machine/processor/rxjava/SerialRxJava.java |  41 ---
 4 files changed, 290 insertions(+), 19 deletions(-)

diff --git 
a/java/machine/machine-test/src/main/java/org/apache/tinkerpop/machine/SimpleTestSuite.java
 
b/java/machine/machine-test/src/main/java/org/apache/tinkerpop/machine/SimpleTestSuite.java
index 862ff71..7b1b6e8 100644
--- 
a/java/machine/machine-test/src/main/java/org/apache/tinkerpop/machine/SimpleTestSuite.java
+++ 
b/java/machine/machine-test/src/main/java/org/apache/tinkerpop/machine/SimpleTestSuite.java
@@ -24,6 +24,8 @@ import org.apache.tinkerpop.machine.bytecode.compiler.Order;
 import org.junit.jupiter.api.Test;
 
 import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 import static org.apache.tinkerpop.language.gremlin.P.gt;
 import static org.apache.tinkerpop.language.gremlin.P.lt;
@@ -225,6 +227,18 @@ public class SimpleTestSuite extends 
AbstractTestSuite {
 g.inject(1L).repeat(union(incr(), 
__.incr().incr())).times(2));
 }
 
+// @Test (Parallel RxJava finds this too compute intensive)
+void g_injectX1X_repeatXunionXincr__incrX_unionXincr__incrXX_timesX3X() {
+verify(Stream.generate(() -> 
7L).limit(64).collect(Collectors.toList()),
+g.inject(1L).repeat(__.union(incr(), 
incr()).union(incr(),incr())).times(3));
+}
+
+// @Test (Parallel RxJava finds this too compute intensive)
+void 
g_injectX1X_repeatXunionXincr__unionXincr__incrXX_unionXincr__incrXX_timesX3X() 
{
+verify(Stream.generate(() -> 
7L).limit(216).collect(Collectors.toList()),
+g.inject(1L).repeat(__.union(incr(), 
__.union(incr(),incr())).union(incr(),incr())).times(3));
+}
+
 @Test
 void g_injectX1X_repeatXunionXincr__incr_incrXX_timesX3X() {
 verify(List.of(4L, 5L, 5L, 6L, 5L, 6L, 6L, 7L),
diff --git 
a/java/machine/processor/rxjava/src/main/java/org/apache/tinkerpop/machine/processor/rxjava/RepeatHead.java
 
b/java/machine/processor/rxjava/src/main/java/org/apache/tinkerpop/machine/processor/rxjava/RepeatHead.java
new file mode 100644
index 000..ef94b8b
--- /dev/null
+++ 
b/java/machine/processor/rxjava/src/main/java/org/apache/tinkerpop/machine/processor/rxjava/RepeatHead.java
@@ -0,0 +1,135 @@
+/*
+ * 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.tinkerpop.machine.processor.rxjava;
+
+import io.reactivex.Flowable;
+import io.reactivex.FlowableTransformer;
+import org.apache.tinkerpop.machine.function.branch.RepeatBranch;
+import org.apache.tinkerpop.machine.traverser.Traverser;
+import org.apache.tinkerpop.machine.traverser.TraverserSet;
+import org.reactivestreams.Processor;
+import org.reactivestreams.Publisher;
+import org.reactivestreams.Subscriber;
+import org.reactivestreams.Subscription;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+final class RepeatHead implements Processor, 
Traverser>, FlowableTransformer, Traverser> {
+
+private final TraverserSet starts = new TraverserSet<>();
+private final RepeatBranch repeatBranch;
+private Publisher> source;
+private Subscription upstream;
+private 

[GitHub] [tinkerpop] spmallette commented on issue #1098: Allow to configure processor in Gremlin-JavaScript

2019-04-18 Thread GitBox
spmallette commented on issue #1098: Allow to configure processor in 
Gremlin-JavaScript
URL: https://github.com/apache/tinkerpop/pull/1098#issuecomment-484470268
 
 
   Thanks for submitting this PR. In principle, allowing the setting of the 
`opProcessor` is fine by me 
   
   VOTE +1
   
   I'd like to wait for @jorgebay or @jbmusso to provide a more full review of 
the change itself before we merge. I assume that this change should target the 
`tp33` branch and it will need a CHANGELOG entry, but other than that it looks 
pretty straightforward.
   
   As a side note (not really related to the merge-ability of this PR), I think 
this represents more reason for bytecode to replace scripts. This sort of 
advanced configuration for both client and server is more than a user should 
have to do to get Cypher going with a TinkerPop implementation. It will be nice 
when we can push past scripts and into pure bytecode, but until then I guess 
this is what needs to be done. 


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services