Uploaded image for project: 'StreamSets Data Collector'
  1. StreamSets Data Collector
  2. SDC-3429

Datetime functions give varying results in Jython processor

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P1 (Blocker)
    • Resolution: Not an Issue
    • Affects Version/s: 1.5.0.0
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Doc Impact:
      No

      Description

      Script does the following:

      from datetime import datetime
      for record in records:
        try:
          n = datetime.now()
          record.value['year'] = n.year
          record.value['month'] = n.month
          record.value['day'] = n.day
          record.value['dt'] = str(n)
          
          record.value['year_new'] = datetime.now().year
          record.value['month_new'] = datetime.now().month
          record.value['day_new'] = datetime.now().day
          record.value['dt_new'] = str(datetime.now())
          output.write(record)
        except Exception as e:
          error.write(record, str(e))
      

      One would expect that the year, month, and day results would be the same, but they are very obviously not. Wondering if this is an oddity of Jython, or perhaps a weird reference-passing issue?

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              natty Jon Natkins
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: