Pig
  1. Pig
  2. PIG-2754

pig can't sum with inner mutiply

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: 0.10.0
    • Fix Version/s: None
    • Component/s: internal-udfs
    • Labels:
      None
    • Environment:

      GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu)

      Description

      sample code like that:

      txns = LOAD '/test' USING PigStorage() AS (domain:chararray,amount:double);

      txns_by_domain = GROUP txns BY domain;

      test_txns = FOREACH txns_by_domain

      { domain = group; test_out = SUM(txns.amount * txns.amount);}

      ...

      it looks built-in function SUM did not support inner multiply and sum up.

        Activity

        Mark Liu created issue -
        Hide
        Alan Gates added a comment -

        This is not a bug, it is the semantics of the language. When you do txns.amount, the result is not a double, but a bag of tuples with one column which is a double. This is an issue because by definition no order is guaranteed for records in a bag so in general there is no coherent way to resolve bag1.x * bag2.y.

        Show
        Alan Gates added a comment - This is not a bug, it is the semantics of the language. When you do txns.amount, the result is not a double, but a bag of tuples with one column which is a double. This is an issue because by definition no order is guaranteed for records in a bag so in general there is no coherent way to resolve bag1.x * bag2.y.
        Alan Gates made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Invalid [ 6 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Mark Liu
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development