zoukankan      html  css  js  c++  java
  • etl实现字段值相加

    数据库USERS表:

    etl步骤:

    (2)

    (3)

    其中java代码为:

        import test.Test;
         
        public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException
        {
            Object[] r = getRow();
            if (r == null) {
                setOutputDone();
                return false;
            }
            if (first)
            {
                first = false;
            } 
            // It is always safest to call createOutputRow() to ensure that your output row's Object[] is large
            // enough to handle any new fields you are creating in this step.
            //r = createOutputRow(r, outputRowSize);    
            /* TODO: Your code here. (See Sample)         
            / Get the value from an input field
            String foobar = get(Fields.In, "a_fieldname").getString(r);   
            foobar += "bar";       
            // Set a value in a new output field
            get(Fields.Out, "output_fieldname").setValue(r, foobar);   
            */
             //获取参数
            // String AGEField = getParameter("ID");        
            String ID = get(Fields.In, "ID").getString(r); //输入参数  
             get(Fields.Out, "ID").setValue(r, ID); //输出参数
            //调用jar
            String foobar = get(Fields.In, "NAME").getString(r); //输入参数
            foobar += Test.getMyName("我是谁的水");
            get(Fields.Out, "NAME").setValue(r, foobar);
    //获取参数
            // String AGEField = getParameter("ID");        
            //String ID = get(Fields.In, "ID").getString(r); //输入参数  
             get(Fields.Out, "aa").setValue(r, "xx"); //输出参数
            // Send the row on to the next step.
            putRow(data.outputRowMeta, r);
            return true;

    }

    打成jar包丢到kettle目录下:

    执行结果:

  • 相关阅读:
    测试某个方法的执行时间
    DataTable与DataGridView绑定
    《认知与设计——理解UI设计准则》笔记(7) 我们的注意力有限,记忆力也不完美
    常用软件收集
    通过反射得到某个实体的属性值
    获取某个字段的最大值
    C# ServerVariables参数说明
    C# 将网址转换为16进制可用网址,防盗链,%%
    不加修改权限的前提,要分辨出那些图片是删除不用的
    C# Winform 域名得到(查询)(服务器所在) IP  cs
  • 原文地址:https://www.cnblogs.com/kongxc/p/6247825.html
Copyright © 2011-2022 走看看