You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by Alexander Pivovarov <ap...@gmail.com> on 2015/02/06 08:06:40 UTC

GenericUDFXPath.getDisplayString

Is GenericUDFXPath.getDisplayString() implementation correct?
1. it says "array"
2. it wraps children with single qutes

  @Override
  public String getDisplayString(String[] children) {
    StringBuilder builder = new StringBuilder();
    builder.append("array (");
    if (children.length > 0) {
      builder.append("'");
      builder.append(StringUtils.join(children, "','"));
      builder.append("'");
    }
    builder.append(")");
    return builder.toString();
  }


https://github.com/apache/hive/blob/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/xml/GenericUDFXPath.java

Re: GenericUDFXPath.getDisplayString

Posted by Jason Dere <jd...@hortonworks.com>.
Looks like it was copied directly from GenericUDFArray, though I can't account for the single quotes which look inconsistent with other UDFs


On Feb 5, 2015, at 11:06 PM, Alexander Pivovarov <ap...@gmail.com> wrote:

> Is GenericUDFXPath.getDisplayString() implementation correct?
> 1. it says "array"
> 2. it wraps children with single qutes
> 
>  @Override
>  public String getDisplayString(String[] children) {
>    StringBuilder builder = new StringBuilder();
>    builder.append("array (");
>    if (children.length > 0) {
>      builder.append("'");
>      builder.append(StringUtils.join(children, "','"));
>      builder.append("'");
>    }
>    builder.append(")");
>    return builder.toString();
>  }
> 
> 
> https://github.com/apache/hive/blob/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/xml/GenericUDFXPath.java