hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Edward Capriolo (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HIVE-5423) Speed up testing of scalar UDFS
Date Thu, 03 Oct 2013 02:46:43 GMT

    [ https://issues.apache.org/jira/browse/HIVE-5423?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13784759#comment-13784759
] 

Edward Capriolo commented on HIVE-5423:
---------------------------------------

Actually I was able to hide away the boiler plate of setting up the operators in a base class.
Users supply 
* sourceTable
* expectedResults
* Expression List

Any easier and it would be harder :)
{code}
public class ExtendedConcatTest extends BaseScalarUdfTest {

  @Override
  public InspectableObject[] getBaseTable() {
    DataBuilder db = new DataBuilder();
    db.setColumnNames("a", "b", "c");
    db.setColumnTypes(
        PrimitiveObjectInspectorFactory.javaStringObjectInspector,
        PrimitiveObjectInspectorFactory.javaStringObjectInspector,
        PrimitiveObjectInspectorFactory.javaStringObjectInspector);
    db.addRow("one", "two", "three");
    db.addRow("four","two", "three");
    db.addRow( null, "two", "three");
    return db.createRows();
  }

  @Override
  public InspectableObject[] getExpectedResult() {
    DataBuilder db = new DataBuilder();
    db.setColumnNames("_col1", "_col2");
    db.setColumnTypes(PrimitiveObjectInspectorFactory.javaStringObjectInspector,
        PrimitiveObjectInspectorFactory.javaStringObjectInspector);
    db.addRow("one", "onetwo");
    db.addRow("four", "fourtwo");
    db.addRow(null, null);
    return db.createRows();
  }

  @Override
  public List<ExprNodeDesc> getExpressionList() throws UDFArgumentException {
    ExprNodeDesc expr1 = OperatorTestUtils.getStringColumn("a");
    ExprNodeDesc expr2 = OperatorTestUtils.getStringColumn("b");
    ExprNodeDesc exprDesc2 = TypeCheckProcFactory.DefaultExprProcessor.getFuncExprNodeDesc("concat",
expr1, expr2);
    List<ExprNodeDesc> earr = new ArrayList<ExprNodeDesc>();
    earr.add(expr1);
    earr.add(exprDesc2);
    return earr;
  }

}
{code}

> Speed up testing of scalar UDFS
> -------------------------------
>
>                 Key: HIVE-5423
>                 URL: https://issues.apache.org/jira/browse/HIVE-5423
>             Project: Hive
>          Issue Type: Improvement
>            Reporter: Edward Capriolo
>            Assignee: Edward Capriolo
>         Attachments: HIVE-5423.1.patch.txt, HIVE-5423.patch.txt
>
>




--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message