Hive
  1. Hive
  2. HIVE-2891

TextConverter for UDF's is inefficient if the input object is already Text or Lazy

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 0.7.0, 0.7.1, 0.8.1
    • Fix Version/s: 0.9.0
    • Labels:
      None

      Description

      The TextConverter in PrimitiveObjectInspectorConverter.java is very inefficient if the input object is already Text or Lazy. Since it calls getPrimitiveJavaObject, each Text is decoded into a String and then re-encoded into Text. The solution is to check if preferWritable() is true, then call getPrimitiveWritable(input).

      To test performance, I ran the Grep query from https://issues.apache.org/jira/browse/HIVE-396 on a cluster of 3 ec2 large nodes (2 slaves 1 master) on 6GB of data. It took 21 map tasks. With the current 0.8.1 version, it took 81 seconds. After patching, it took 66 seconds.

      I will attach a patch and testcases.

      1. HIVE-2891.2.patch.txt
        2 kB
        Cliff Engle
      2. HIVE-2891.1.patch.txt
        2 kB
        Cliff Engle

        Activity

        Cliff Engle created issue -
        Cliff Engle made changes -
        Field Original Value New Value
        Attachment HIVE-2891.1.patch.txt [ 12519386 ]
        Ashutosh Chauhan made changes -
        Assignee Cliff Engle [ cengle ]
        Cliff Engle made changes -
        Attachment HIVE-2891.2.patch.txt [ 12519479 ]
        Cliff Engle made changes -
        Description The TextConverter in PrimitiveObjectInspectorConverter.java is very inefficient if the input object is already Text or Lazy. Since it calls getPrimitiveJavaObject, each Text is decoded into a String and then re-encoded into Text. The solution is to check if preferWritable() is true, then call getPrimitiveWritable(input).getBytes().

        To test performance, I ran the Grep query from https://issues.apache.org/jira/browse/HIVE-396 on a cluster of 3 ec2 large nodes (2 slaves 1 master). It took 21 map tasks. With the current 0.8.1 version, it took 81 seconds. After patching, it took 66 seconds.

        I will attach a patch and testcases.

        The TextConverter in PrimitiveObjectInspectorConverter.java is very inefficient if the input object is already Text or Lazy. Since it calls getPrimitiveJavaObject, each Text is decoded into a String and then re-encoded into Text. The solution is to check if preferWritable() is true, then call getPrimitiveWritable(input).

        To test performance, I ran the Grep query from https://issues.apache.org/jira/browse/HIVE-396 on a cluster of 3 ec2 large nodes (2 slaves 1 master) on 6GB of data. It took 21 map tasks. With the current 0.8.1 version, it took 81 seconds. After patching, it took 66 seconds.

        I will attach a patch and testcases.

        Ashutosh Chauhan made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 0.9.0 [ 12317742 ]
        Resolution Fixed [ 1 ]
        Ashutosh Chauhan made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Cliff Engle
            Reporter:
            Cliff Engle
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development