Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-12595

fold should pass arguments to op in the correct order

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Trivial
    • Resolution: Duplicate
    • 1.0.0, 1.1.0, 1.2.0, 1.3.0, 1.4.0, 1.5.0, 1.6.0
    • None
    • PySpark
    • None

    Description

      At this moment fold method reverses an order of arguments and places accumulator on the RHS.

              def func(iterator):
                  acc = zeroValue
                  for obj in iterator:
                      acc = op(obj, acc)
                  yield acc
      

      It is confusing (see linked SO question), clearly conflicts with documentation:

      The function op(t1, t2) is allowed to modify t1 and return it as its result value to avoid object allocation; however, it should not modify t2

      and may become a bug if implementation changes.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              zero323 Maciej Szymkiewicz
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: