Github user nickwallen commented on a diff in the pull request:
https://github.com/apache/incubator-metron/pull/293#discussion_r82217916
--- Diff:
metron-platform/metron-common/src/test/java/org/apache/metron/common/stellar/StellarTest.java
---
@@ -285,6 +285,18 @@ public void testHappyPath() {
}
@Test
+ public void testLength(){
+ String query = "LENGTH(foo)";
+ Assert.assertEquals(5, run(query,ImmutableMap.of("foo","abcde")));
+ }
+
+ @Test
--- End diff --
If I mistakenly call `LENGTH()` with no argument, then I get an
`IndexOutOfBoundsException`. And this is not unique to the `LENGTH` function.
There are a number of other Stellar functions that do the same.
This may be confusing to a user of Stellar who is not familiar with the
underlying implementation. "IndexOutOfBounds? What the heck does that mean?"
I wonder if it makes sense to handle this in a standard way within Stellar.
Ideally we would get something along the lines of "LENGTH: Missing first
argument 'input'. Expected 'String'".
I bring this up only as a discussion point for future work. This PR does
not necessarily have to address this situation.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---