[GitHub] metron pull request #652: METRON-1039: Add ZIP function to Stellar

2017-07-25 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/metron/pull/652


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] metron pull request #652: METRON-1039: Add ZIP function to Stellar

2017-07-13 Thread cestella
Github user cestella commented on a diff in the pull request:

https://github.com/apache/metron/pull/652#discussion_r127247191
  
--- Diff: 
metron-stellar/stellar-common/src/test/java/org/apache/metron/stellar/dsl/functions/FunctionalFunctionsTest.java
 ---
@@ -24,13 +24,124 @@
 import org.junit.Assert;
 import org.junit.Test;
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import static 
org.apache.metron.stellar.common.utils.StellarProcessorUtils.run;
 
 public class FunctionalFunctionsTest {
 
   @Test
+  public void testZipLongest_boundary() {
+for (String expr : ImmutableList.of( "ZIP_LONGEST()"
+, "ZIP_LONGEST( null, null )"
+, "ZIP_LONGEST( [], null )"
+, "ZIP_LONGEST( [], [] )"
+, "ZIP_LONGEST( null, [] )"
+)
+)
+{
+  List> o = (List>) run(expr, new 
HashMap<>());
+  Assert.assertEquals(0, o.size());
+}
+  }
+
+  @Test
+  public void testZip_longest() {
+Map variables = ImmutableMap.of(
+"list1" , ImmutableList.of(1, 2, 3)
+,"list2", ImmutableList.of(4, 5, 6, 7)
+);
+for (String expr : ImmutableList.of( "ZIP_LONGEST(list1, list2)"
+, "ZIP_LONGEST( [1, 2, 3], [4, 5, 6, 7] )"
+)
+)
+{
+  List> o = (List>) run(expr, variables);
+  Assert.assertEquals(4, o.size());
+  for (int i = 0; i < 3; ++i) {
+List l = o.get(i);
+Assert.assertEquals(2, l.size());
+Assert.assertEquals(i+1, l.get(0));
+Assert.assertEquals(i+4, l.get(1));
+  }
+  {
+int i = 3;
+List l = o.get(i);
+Assert.assertEquals(2, l.size());
+Assert.assertNull(l.get(0));
+Assert.assertEquals(i+4, l.get(1));
+  }
+}
+
+
+for (String expr : ImmutableList.of(
+ "REDUCE(ZIP_LONGEST(list2, list1), (s, x) -> s + GET_FIRST(x) 
* GET_LAST(x), 0)"
+, "REDUCE(ZIP_LONGEST( [1, 2, 3], [4, 5, 6, 7] ), (s, x) -> s 
+ GET_FIRST(x) * GET_LAST(x), 0)"
+, "REDUCE(ZIP_LONGEST(list1, list2), (s, x) -> s + 
GET_FIRST(x) * GET_LAST(x), 0)" //this works because stellar treats nulls as 0 
in arithmetic operations.
+, "REDUCE(ZIP_LONGEST(list1, list2), (s, x) -> s + 
(GET_FIRST(x) == null?0:GET_FIRST(x)) * (GET_LAST(x) == null?0:GET_LAST(x)), 
0)" //with proper guarding NOT assuming stellar peculiarities
+)
+)
+{
+  int o = (int) run(expr, variables);
+  Assert.assertEquals(1*4 + 2*5 + 3*6, o, 1e-7);
--- End diff --

Entirely reasonable conclusion, though @simonellistonball Good to think it 
through.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] metron pull request #652: METRON-1039: Add ZIP function to Stellar

2017-07-13 Thread ottobackwards
Github user ottobackwards commented on a diff in the pull request:

https://github.com/apache/metron/pull/652#discussion_r127245708
  
--- Diff: 
metron-stellar/stellar-common/src/test/java/org/apache/metron/stellar/dsl/functions/FunctionalFunctionsTest.java
 ---
@@ -24,13 +24,124 @@
 import org.junit.Assert;
 import org.junit.Test;
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import static 
org.apache.metron.stellar.common.utils.StellarProcessorUtils.run;
 
 public class FunctionalFunctionsTest {
 
   @Test
+  public void testZipLongest_boundary() {
+for (String expr : ImmutableList.of( "ZIP_LONGEST()"
+, "ZIP_LONGEST( null, null )"
+, "ZIP_LONGEST( [], null )"
+, "ZIP_LONGEST( [], [] )"
+, "ZIP_LONGEST( null, [] )"
+)
+)
+{
+  List> o = (List>) run(expr, new 
HashMap<>());
+  Assert.assertEquals(0, o.size());
+}
+  }
+
+  @Test
+  public void testZip_longest() {
+Map variables = ImmutableMap.of(
+"list1" , ImmutableList.of(1, 2, 3)
+,"list2", ImmutableList.of(4, 5, 6, 7)
+);
+for (String expr : ImmutableList.of( "ZIP_LONGEST(list1, list2)"
+, "ZIP_LONGEST( [1, 2, 3], [4, 5, 6, 7] )"
+)
+)
+{
+  List> o = (List>) run(expr, variables);
+  Assert.assertEquals(4, o.size());
+  for (int i = 0; i < 3; ++i) {
+List l = o.get(i);
+Assert.assertEquals(2, l.size());
+Assert.assertEquals(i+1, l.get(0));
+Assert.assertEquals(i+4, l.get(1));
+  }
+  {
+int i = 3;
+List l = o.get(i);
+Assert.assertEquals(2, l.size());
+Assert.assertNull(l.get(0));
+Assert.assertEquals(i+4, l.get(1));
+  }
+}
+
+
+for (String expr : ImmutableList.of(
+ "REDUCE(ZIP_LONGEST(list2, list1), (s, x) -> s + GET_FIRST(x) 
* GET_LAST(x), 0)"
+, "REDUCE(ZIP_LONGEST( [1, 2, 3], [4, 5, 6, 7] ), (s, x) -> s 
+ GET_FIRST(x) * GET_LAST(x), 0)"
+, "REDUCE(ZIP_LONGEST(list1, list2), (s, x) -> s + 
GET_FIRST(x) * GET_LAST(x), 0)" //this works because stellar treats nulls as 0 
in arithmetic operations.
+, "REDUCE(ZIP_LONGEST(list1, list2), (s, x) -> s + 
(GET_FIRST(x) == null?0:GET_FIRST(x)) * (GET_LAST(x) == null?0:GET_LAST(x)), 
0)" //with proper guarding NOT assuming stellar peculiarities
+)
+)
+{
+  int o = (int) run(expr, variables);
+  Assert.assertEquals(1*4 + 2*5 + 3*6, o, 1e-7);
--- End diff --

and don't call him shirly


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] metron pull request #652: METRON-1039: Add ZIP function to Stellar

2017-07-13 Thread ottobackwards
Github user ottobackwards commented on a diff in the pull request:

https://github.com/apache/metron/pull/652#discussion_r127245624
  
--- Diff: 
metron-stellar/stellar-common/src/test/java/org/apache/metron/stellar/dsl/functions/FunctionalFunctionsTest.java
 ---
@@ -24,13 +24,124 @@
 import org.junit.Assert;
 import org.junit.Test;
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import static 
org.apache.metron.stellar.common.utils.StellarProcessorUtils.run;
 
 public class FunctionalFunctionsTest {
 
   @Test
+  public void testZipLongest_boundary() {
+for (String expr : ImmutableList.of( "ZIP_LONGEST()"
+, "ZIP_LONGEST( null, null )"
+, "ZIP_LONGEST( [], null )"
+, "ZIP_LONGEST( [], [] )"
+, "ZIP_LONGEST( null, [] )"
+)
+)
+{
+  List> o = (List>) run(expr, new 
HashMap<>());
+  Assert.assertEquals(0, o.size());
+}
+  }
+
+  @Test
+  public void testZip_longest() {
+Map variables = ImmutableMap.of(
+"list1" , ImmutableList.of(1, 2, 3)
+,"list2", ImmutableList.of(4, 5, 6, 7)
+);
+for (String expr : ImmutableList.of( "ZIP_LONGEST(list1, list2)"
+, "ZIP_LONGEST( [1, 2, 3], [4, 5, 6, 7] )"
+)
+)
+{
+  List> o = (List>) run(expr, variables);
+  Assert.assertEquals(4, o.size());
+  for (int i = 0; i < 3; ++i) {
+List l = o.get(i);
+Assert.assertEquals(2, l.size());
+Assert.assertEquals(i+1, l.get(0));
+Assert.assertEquals(i+4, l.get(1));
+  }
+  {
+int i = 3;
+List l = o.get(i);
+Assert.assertEquals(2, l.size());
+Assert.assertNull(l.get(0));
+Assert.assertEquals(i+4, l.get(1));
+  }
+}
+
+
+for (String expr : ImmutableList.of(
+ "REDUCE(ZIP_LONGEST(list2, list1), (s, x) -> s + GET_FIRST(x) 
* GET_LAST(x), 0)"
+, "REDUCE(ZIP_LONGEST( [1, 2, 3], [4, 5, 6, 7] ), (s, x) -> s 
+ GET_FIRST(x) * GET_LAST(x), 0)"
+, "REDUCE(ZIP_LONGEST(list1, list2), (s, x) -> s + 
GET_FIRST(x) * GET_LAST(x), 0)" //this works because stellar treats nulls as 0 
in arithmetic operations.
+, "REDUCE(ZIP_LONGEST(list1, list2), (s, x) -> s + 
(GET_FIRST(x) == null?0:GET_FIRST(x)) * (GET_LAST(x) == null?0:GET_LAST(x)), 
0)" //with proper guarding NOT assuming stellar peculiarities
+)
+)
+{
+  int o = (int) run(expr, variables);
+  Assert.assertEquals(1*4 + 2*5 + 3*6, o, 1e-7);
--- End diff --

math fight!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] metron pull request #652: METRON-1039: Add ZIP function to Stellar

2017-07-13 Thread simonellistonball
Github user simonellistonball commented on a diff in the pull request:

https://github.com/apache/metron/pull/652#discussion_r127244811
  
--- Diff: 
metron-stellar/stellar-common/src/test/java/org/apache/metron/stellar/dsl/functions/FunctionalFunctionsTest.java
 ---
@@ -24,13 +24,124 @@
 import org.junit.Assert;
 import org.junit.Test;
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import static 
org.apache.metron.stellar.common.utils.StellarProcessorUtils.run;
 
 public class FunctionalFunctionsTest {
 
   @Test
+  public void testZipLongest_boundary() {
+for (String expr : ImmutableList.of( "ZIP_LONGEST()"
+, "ZIP_LONGEST( null, null )"
+, "ZIP_LONGEST( [], null )"
+, "ZIP_LONGEST( [], [] )"
+, "ZIP_LONGEST( null, [] )"
+)
+)
+{
+  List> o = (List>) run(expr, new 
HashMap<>());
+  Assert.assertEquals(0, o.size());
+}
+  }
+
+  @Test
+  public void testZip_longest() {
+Map variables = ImmutableMap.of(
+"list1" , ImmutableList.of(1, 2, 3)
+,"list2", ImmutableList.of(4, 5, 6, 7)
+);
+for (String expr : ImmutableList.of( "ZIP_LONGEST(list1, list2)"
+, "ZIP_LONGEST( [1, 2, 3], [4, 5, 6, 7] )"
+)
+)
+{
+  List> o = (List>) run(expr, variables);
+  Assert.assertEquals(4, o.size());
+  for (int i = 0; i < 3; ++i) {
+List l = o.get(i);
+Assert.assertEquals(2, l.size());
+Assert.assertEquals(i+1, l.get(0));
+Assert.assertEquals(i+4, l.get(1));
+  }
+  {
+int i = 3;
+List l = o.get(i);
+Assert.assertEquals(2, l.size());
+Assert.assertNull(l.get(0));
+Assert.assertEquals(i+4, l.get(1));
+  }
+}
+
+
+for (String expr : ImmutableList.of(
+ "REDUCE(ZIP_LONGEST(list2, list1), (s, x) -> s + GET_FIRST(x) 
* GET_LAST(x), 0)"
+, "REDUCE(ZIP_LONGEST( [1, 2, 3], [4, 5, 6, 7] ), (s, x) -> s 
+ GET_FIRST(x) * GET_LAST(x), 0)"
+, "REDUCE(ZIP_LONGEST(list1, list2), (s, x) -> s + 
GET_FIRST(x) * GET_LAST(x), 0)" //this works because stellar treats nulls as 0 
in arithmetic operations.
+, "REDUCE(ZIP_LONGEST(list1, list2), (s, x) -> s + 
(GET_FIRST(x) == null?0:GET_FIRST(x)) * (GET_LAST(x) == null?0:GET_LAST(x)), 
0)" //with proper guarding NOT assuming stellar peculiarities
+)
+)
+{
+  int o = (int) run(expr, variables);
+  Assert.assertEquals(1*4 + 2*5 + 3*6, o, 1e-7);
--- End diff --

good point, i should probably have looked at the numbers.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] metron pull request #652: METRON-1039: Add ZIP function to Stellar

2017-07-13 Thread cestella
Github user cestella commented on a diff in the pull request:

https://github.com/apache/metron/pull/652#discussion_r127240904
  
--- Diff: 
metron-stellar/stellar-common/src/test/java/org/apache/metron/stellar/dsl/functions/FunctionalFunctionsTest.java
 ---
@@ -24,13 +24,124 @@
 import org.junit.Assert;
 import org.junit.Test;
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import static 
org.apache.metron.stellar.common.utils.StellarProcessorUtils.run;
 
 public class FunctionalFunctionsTest {
 
   @Test
+  public void testZipLongest_boundary() {
+for (String expr : ImmutableList.of( "ZIP_LONGEST()"
+, "ZIP_LONGEST( null, null )"
+, "ZIP_LONGEST( [], null )"
+, "ZIP_LONGEST( [], [] )"
+, "ZIP_LONGEST( null, [] )"
+)
+)
+{
+  List> o = (List>) run(expr, new 
HashMap<>());
+  Assert.assertEquals(0, o.size());
+}
+  }
+
+  @Test
+  public void testZip_longest() {
+Map variables = ImmutableMap.of(
+"list1" , ImmutableList.of(1, 2, 3)
+,"list2", ImmutableList.of(4, 5, 6, 7)
+);
+for (String expr : ImmutableList.of( "ZIP_LONGEST(list1, list2)"
+, "ZIP_LONGEST( [1, 2, 3], [4, 5, 6, 7] )"
+)
+)
+{
+  List> o = (List>) run(expr, variables);
+  Assert.assertEquals(4, o.size());
+  for (int i = 0; i < 3; ++i) {
+List l = o.get(i);
+Assert.assertEquals(2, l.size());
+Assert.assertEquals(i+1, l.get(0));
+Assert.assertEquals(i+4, l.get(1));
+  }
+  {
+int i = 3;
+List l = o.get(i);
+Assert.assertEquals(2, l.size());
+Assert.assertNull(l.get(0));
+Assert.assertEquals(i+4, l.get(1));
+  }
+}
+
+
+for (String expr : ImmutableList.of(
+ "REDUCE(ZIP_LONGEST(list2, list1), (s, x) -> s + GET_FIRST(x) 
* GET_LAST(x), 0)"
+, "REDUCE(ZIP_LONGEST( [1, 2, 3], [4, 5, 6, 7] ), (s, x) -> s 
+ GET_FIRST(x) * GET_LAST(x), 0)"
+, "REDUCE(ZIP_LONGEST(list1, list2), (s, x) -> s + 
GET_FIRST(x) * GET_LAST(x), 0)" //this works because stellar treats nulls as 0 
in arithmetic operations.
+, "REDUCE(ZIP_LONGEST(list1, list2), (s, x) -> s + 
(GET_FIRST(x) == null?0:GET_FIRST(x)) * (GET_LAST(x) == null?0:GET_LAST(x)), 
0)" //with proper guarding NOT assuming stellar peculiarities
+)
+)
+{
+  int o = (int) run(expr, variables);
+  Assert.assertEquals(1*4 + 2*5 + 3*6, o, 1e-7);
--- End diff --

`reduce(zip(a, reversed(b)), (s, x) -> s + x[0]*x[1], 0)` would yield `1*6 
+ 2*5 + 3*1 == 19` which is not `1*4 + 2*5 + 3*6 == 32`, so it is ensuring that 
the lists align.  The previous case involving evaluating jsut the output of 
`ZIP([1,2,3], [4, 5, 6])` takes care of the ordering per-element (`1` is in the 
first spot and `4` is in the second spot, etc)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] metron pull request #652: METRON-1039: Add ZIP function to Stellar

2017-07-13 Thread simonellistonball
Github user simonellistonball commented on a diff in the pull request:

https://github.com/apache/metron/pull/652#discussion_r127239254
  
--- Diff: 
metron-stellar/stellar-common/src/test/java/org/apache/metron/stellar/dsl/functions/FunctionalFunctionsTest.java
 ---
@@ -24,13 +24,124 @@
 import org.junit.Assert;
 import org.junit.Test;
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import static 
org.apache.metron.stellar.common.utils.StellarProcessorUtils.run;
 
 public class FunctionalFunctionsTest {
 
   @Test
+  public void testZipLongest_boundary() {
+for (String expr : ImmutableList.of( "ZIP_LONGEST()"
+, "ZIP_LONGEST( null, null )"
+, "ZIP_LONGEST( [], null )"
+, "ZIP_LONGEST( [], [] )"
+, "ZIP_LONGEST( null, [] )"
+)
+)
+{
+  List> o = (List>) run(expr, new 
HashMap<>());
+  Assert.assertEquals(0, o.size());
+}
+  }
+
+  @Test
+  public void testZip_longest() {
+Map variables = ImmutableMap.of(
+"list1" , ImmutableList.of(1, 2, 3)
+,"list2", ImmutableList.of(4, 5, 6, 7)
+);
+for (String expr : ImmutableList.of( "ZIP_LONGEST(list1, list2)"
+, "ZIP_LONGEST( [1, 2, 3], [4, 5, 6, 7] )"
+)
+)
+{
+  List> o = (List>) run(expr, variables);
+  Assert.assertEquals(4, o.size());
+  for (int i = 0; i < 3; ++i) {
+List l = o.get(i);
+Assert.assertEquals(2, l.size());
+Assert.assertEquals(i+1, l.get(0));
+Assert.assertEquals(i+4, l.get(1));
+  }
+  {
+int i = 3;
+List l = o.get(i);
+Assert.assertEquals(2, l.size());
+Assert.assertNull(l.get(0));
+Assert.assertEquals(i+4, l.get(1));
+  }
+}
+
+
+for (String expr : ImmutableList.of(
+ "REDUCE(ZIP_LONGEST(list2, list1), (s, x) -> s + GET_FIRST(x) 
* GET_LAST(x), 0)"
+, "REDUCE(ZIP_LONGEST( [1, 2, 3], [4, 5, 6, 7] ), (s, x) -> s 
+ GET_FIRST(x) * GET_LAST(x), 0)"
+, "REDUCE(ZIP_LONGEST(list1, list2), (s, x) -> s + 
GET_FIRST(x) * GET_LAST(x), 0)" //this works because stellar treats nulls as 0 
in arithmetic operations.
+, "REDUCE(ZIP_LONGEST(list1, list2), (s, x) -> s + 
(GET_FIRST(x) == null?0:GET_FIRST(x)) * (GET_LAST(x) == null?0:GET_LAST(x)), 
0)" //with proper guarding NOT assuming stellar peculiarities
+)
+)
+{
+  int o = (int) run(expr, variables);
+  Assert.assertEquals(1*4 + 2*5 + 3*6, o, 1e-7);
--- End diff --

surely this does not actually test the structure is correct. I could get 
the same asserted result from zip(a, reversed(b)). I think we should have tests 
around defined ordering of pairs.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] metron pull request #652: METRON-1039: Add ZIP function to Stellar

2017-07-13 Thread cestella
Github user cestella commented on a diff in the pull request:

https://github.com/apache/metron/pull/652#discussion_r127232007
  
--- Diff: metron-stellar/stellar-common/README.md ---
@@ -711,6 +713,18 @@ In the core language functions, we support basic 
functional programming primitiv
 * dateTime - The datetime as a long representing the milliseconds 
since unix epoch
   * Returns: The current year
 
+### `ZIP`
+  * Description: Zips lists into a single list where the ith element is an 
list containing the ith items from the constituent lists.
--- End diff --

@simonellistonball Haskell example coming up! ;)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] metron pull request #652: METRON-1039: Add ZIP function to Stellar

2017-07-13 Thread simonellistonball
Github user simonellistonball commented on a diff in the pull request:

https://github.com/apache/metron/pull/652#discussion_r127231248
  
--- Diff: metron-stellar/stellar-common/README.md ---
@@ -711,6 +713,18 @@ In the core language functions, we support basic 
functional programming primitiv
 * dateTime - The datetime as a long representing the milliseconds 
since unix epoch
   * Returns: The current year
 
+### `ZIP`
+  * Description: Zips lists into a single list where the ith element is an 
list containing the ith items from the constituent lists.
--- End diff --

might be kinder to link to the python docs on zip, or at least an example 
that isn't in lisp :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] metron pull request #652: METRON-1039: Add ZIP function to Stellar

2017-07-13 Thread ottobackwards
Github user ottobackwards commented on a diff in the pull request:

https://github.com/apache/metron/pull/652#discussion_r127230597
  
--- Diff: metron-stellar/stellar-common/README.md ---
@@ -711,6 +713,18 @@ In the core language functions, we support basic 
functional programming primitiv
 * dateTime - The datetime as a long representing the milliseconds 
since unix epoch
   * Returns: The current year
 
+### `ZIP`
+  * Description: Zips lists into a single list where the ith element is an 
list containing the ith items from the constituent lists.
--- End diff --

That would great


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] metron pull request #652: METRON-1039: Add ZIP function to Stellar

2017-07-13 Thread cestella
Github user cestella commented on a diff in the pull request:

https://github.com/apache/metron/pull/652#discussion_r127227967
  
--- Diff: metron-stellar/stellar-common/README.md ---
@@ -711,6 +713,18 @@ In the core language functions, we support basic 
functional programming primitiv
 * dateTime - The datetime as a long representing the milliseconds 
since unix epoch
   * Returns: The current year
 
+### `ZIP`
+  * Description: Zips lists into a single list where the ith element is an 
list containing the ith items from the constituent lists.
--- End diff --

Well, there is 
https://en.wikipedia.org/wiki/Convolution_(computer_science), what do you think?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] metron pull request #652: METRON-1039: Add ZIP function to Stellar

2017-07-13 Thread ottobackwards
Github user ottobackwards commented on a diff in the pull request:

https://github.com/apache/metron/pull/652#discussion_r127221448
  
--- Diff: metron-stellar/stellar-common/README.md ---
@@ -711,6 +713,18 @@ In the core language functions, we support basic 
functional programming primitiv
 * dateTime - The datetime as a long representing the milliseconds 
since unix epoch
   * Returns: The current year
 
+### `ZIP`
+  * Description: Zips lists into a single list where the ith element is an 
list containing the ith items from the constituent lists.
--- End diff --

Is there a link to a page explaining "ZIP" in this context, formally?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] metron pull request #652: METRON-1039: Add ZIP function to Stellar

2017-07-13 Thread cestella
GitHub user cestella opened a pull request:

https://github.com/apache/metron/pull/652

METRON-1039: Add ZIP function to Stellar

## Contributor Comments
Stellar could use a ZIP function i.e.
* `ZIP( [ 1, 2, 3], [ 4, 5, 6] ) == [ [1, 4], [2, 5], [3, 6] ]`
* `ZIP( [ 1, 2 ], [4, 5, 6] ) == [ [1, 4], [2, 5] ]` 
* `ZIP_JAGGED( [ 1, 2 ], [4, 5, 6] ) == [ [1, 4], [2, 5], [null, 6] ]` 

You can manually validate this in the Stellar REPL.

## Pull Request Checklist

Thank you for submitting a contribution to Apache Metron.  
Please refer to our [Development 
Guidelines](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=61332235)
 for the complete guide to follow for contributions.  
Please refer also to our [Build Verification 
Guidelines](https://cwiki.apache.org/confluence/display/METRON/Verifying+Builds?show-miniview)
 for complete smoke testing guides.  


In order to streamline the review of the contribution we ask you follow 
these guidelines and ask you to double check the following:

### For all changes:
- [x] Is there a JIRA ticket associated with this PR? If not one needs to 
be created at [Metron 
Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel).
 
- [x] Does your PR title start with METRON- where  is the JIRA 
number you are trying to resolve? Pay particular attention to the hyphen "-" 
character.
- [x] Has your PR been rebased against the latest commit within the target 
branch (typically master)?


### For code changes:
- [x] Have you included steps to reproduce the behavior or problem that is 
being changed or addressed?
- [x] Have you included steps or a guide to how the change may be verified 
and tested manually?
- [x] Have you ensured that the full suite of tests and checks have been 
executed in the root metron folder via:
  ```
  mvn -q clean integration-test install && build_utils/verify_licenses.sh 
  ```

- [x] Have you written or updated unit tests and or integration tests to 
verify your changes?
- [x] If adding new dependencies to the code, are these dependencies 
licensed in a way that is compatible for inclusion under [ASF 
2.0](http://www.apache.org/legal/resolved.html#category-a)? 
- [x] Have you verified the basic functionality of the build by building 
and running locally with Vagrant full-dev environment or the equivalent?

### For documentation related changes:
- [x] Have you ensured that format looks appropriate for the output in 
which it is rendered by building and verifying the site-book? If not then run 
the following commands and the verify changes via 
`site-book/target/site/index.html`:

  ```
  cd site-book
  mvn site
  ```

 Note:
Please ensure that once the PR is submitted, you check travis-ci for build 
issues and submit an update to your PR as soon as possible.
It is also recommended that [travis-ci](https://travis-ci.org) is set up 
for your personal repository such that your branches are built there before 
submitting a pull request.



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/cestella/incubator-metron zip_stellar_function

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/metron/pull/652.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #652


commit c71e80d8886528b37dc5a7f37c9086742438bc70
Author: cstella 
Date:   2017-07-13T13:11:59Z

METRON-1039: Add ZIP function to Stellar




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---