metron-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nickwallen <...@git.apache.org>
Subject [GitHub] incubator-metron pull request #231: METRON-394 Create Stellar Date Functions...
Date Tue, 30 Aug 2016 01:00:49 GMT
Github user nickwallen commented on a diff in the pull request:

    https://github.com/apache/incubator-metron/pull/231#discussion_r76715633
  
    --- Diff: metron-platform/metron-common/src/main/java/org/apache/metron/common/dsl/functions/DateFunctions.java
---
    @@ -114,17 +122,176 @@ public Object apply(List<Object> objects) {
           }
           if(dateObj != null && formatObj != null) {
             try {
    -          return getEpochTime(dateObj.toString()
    -                             , formatObj.toString()
    -                             , tzObj == null?Optional.empty():Optional.of(tzObj.toString())
    -                             );
    -        } catch (ExecutionException e) {
    -          return null;
    -        } catch (ParseException e) {
    +          Optional<String> tz = (tzObj == null) ? Optional.empty() : Optional.of(tzObj.toString());
    +          return getEpochTime(dateObj.toString(), formatObj.toString(), tz);
    +
    +        } catch (ExecutionException | ParseException e) {
               return null;
             }
           }
           return null;
         }
       }
    +
    +  /**
    +   * Stellar Function: DAY_OF_WEEK
    +   *
    +   * The numbered day within the week.  The first day of the week, Sunday, has a value
of 1.
    +   */
    +  public static class DayOfWeek extends BaseStellarFunction {
    +    @Override
    +    public Object apply(List<Object> args) {
    +
    +      // expect epoch milliseconds
    +      Long epochMillis = ConversionUtils.convert(args.get(0), Long.class);
    --- End diff --
    
    No worries.  Thanks for the review.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message