Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: week vs isoweek

  1. #1
    Join Date
    Dec 2010
    Posts
    4

    Question week vs isoweek

    In spoon there are 2 calculation types for week: "week of year of date A" and "ISO8601 Week of year of date A".

    In Oracle when I select week number of date = Jan,1, 2005 I get 53 or 01 depending on whether I choose isoweek (to_char(date,'iw') ) or week (to_char(date,'ww') ).
    In Spoon when I create a dimension using both calculationtypes I get 53 in both cases.

    In Kettle: Is there a diffence between the two or are both week formats the same?

    Ben Slagmolen
    Last edited by benslag; 02-17-2011 at 06:13 AM.

  2. #2
    Join Date
    Mar 2008
    Posts
    140

    Default

    Ben,

    Can you please file a Jira on this?

    We are using logic similar to some referenced in this Microsoft article: http://blogs.msdn.com/b/shawnste/arc...osoft-net.aspx "almost like the ISO 8601 week when passed CalendarWeekRule.FirstFourDayWeek and DayOfWeek.Monday ...".


    Our code:
    calendar.setMinimalDaysInFirstWeek(4);
    calendar.setFirstDayOfWeek(Calendar.MONDAY);

    This is not entirely accurate as sources indicate that there are more specific rules for determining the correct ISO 8601 week of year.
    http://en.wikipedia.org/wiki/ISO_week_date

    We should update ValueDataUtil.weekOfYearISO8601(...) to use a standard library or enhance our own method of determining the ISO week of year.

    Thank you for finding this Ben,

    -Curtis

    -- Edit
    We also need to find out why the ValueDataUtil.weekOfYear(...) would not be returning week 1 for Jan 1st of any given year. I would assume it should, though there is no standard that we claim to follow here.
    Last edited by cboyden; 02-17-2011 at 11:58 AM. Reason: Adding information

  3. #3
    Join Date
    Dec 2010
    Posts
    4

    Default

    Jira filled in for this issue: PDI-5407
    Ben

  4. #4
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    We really shouldn't change anything Curtis. People that are happy with the current behavior should continue to enjoy it.

    More information on how the weeks are counted in Java with Calendar is found here: http://download.oracle.com/javase/6/.../Calendar.html

    The first week of a month or year is defined as the earliest seven day period beginning on getFirstDayOfWeek() and containing at least getMinimalDaysInFirstWeek() days of that month or year
    If that happens to correspond to the ISO8601 week number for a particular year, then so be it.
    By the way, PDI-5407 doesn't contain a reproduction path nor a problem description.

    "It is different from Oracle" is hardly a valid bug report if you know what I mean :-)

    HTH,

    Matt

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.