Uploaded image for project: 'Pig'
  1. Pig
  2. PIG-771

PigDump does not properly output Chinese UTF8 characters - they are displayed as question marks ??

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 0.7.0
    • None
    • None

    Description

      PigDump does not properly output Chinese UTF8 characters.

      The reason for this is that the function Tuple.toString() is called.

      DefaultTuple implements Tuple.toString() and it calls Object.toString() on the opaque object d.

      Instead, I think that the code should be changed instead to call the new DataType.toString() function.

          @Override
          public String toString() {
              StringBuilder sb = new StringBuilder();
              sb.append('(');
              for (Iterator<Object> it = mFields.iterator(); it.hasNext();) {
                  Object d = it.next();
                  if(d != null) {
                      if(d instanceof Map) {
                          sb.append(DataType.mapToString((Map<Object, Object>)d));
                      } else {
                          sb.append(DataType.toString(d));  // <<< Change this one line
                          if(d instanceof Long) {
                              sb.append("L");
                          } else if(d instanceof Float) {
                              sb.append("F");
                          }
                      }
                  } else {
                      sb.append("");
                  }
                  if (it.hasNext())
                      sb.append(",");
              }
              sb.append(')');
              return sb.toString();
          }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            ciemo David Ciemiewicz
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: