metron-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cestella <...@git.apache.org>
Subject [GitHub] metron pull request #742: METRON-1168: Add SUBSTRING method to stellar
Date Sat, 09 Sep 2017 00:37:32 GMT
Github user cestella commented on a diff in the pull request:

    https://github.com/apache/metron/pull/742#discussion_r137913436
  
    --- Diff: metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/dsl/functions/StringFunctions.java
---
    @@ -321,6 +321,46 @@ public Object apply(List<Object> args) {
         }
       }
     
    +  @Stellar( name="SUBSTRING"
    +          , description = "Returns a substring of a string"
    +          , params = {
    +                "input - The string to take the substring of",
    +                "start - The starting position (0-based and inclusive)",
    +                "end? - The ending position (0-based and exclusive)"
    +                     }
    +          , returns = "The substring of the input"
    +  )
    +  public static class Substring extends BaseStellarFunction {
    +
    +    @Override
    +    public Object apply(List<Object> strings) {
    +
    +      if(strings == null || strings.size() < 2 ) {
    +        throw new IllegalArgumentException("[SUBSTRING] required 2 arguments: the input
and the start position (inclusive)");
    --- End diff --
    
    Yeah, I was following the leader with `CHOMP`, but I agree, I will correct this in a follow-on
JIRA with the rest of your issues covered.


---

Mime
View raw message