【发布时间】:2015-09-23 11:13:06
【问题描述】:
我有一个非常简单的 Pentaho Kettle 转换,它会导致一个奇怪的错误。它包括从 CSV 读取字段 X,添加字段 Y,设置 Y=X,最后将其写回另一个 CSV。
在这里您可以看到它们的步骤和配置:
您也可以从here 下载ktr 文件。输入数据就是这样的:
1
2
3
当我运行此转换时,我收到以下错误消息:
ERROR (version 5.4.0.1-130, build 1 from 2015-06-14_12-34-55 by buildguy) : Unexpected error
ERROR (version 5.4.0.1-130, build 1 from 2015-06-14_12-34-55 by buildguy) : org.pentaho.di.core.exception.KettleStepException:
Error writing line
Error writing field content to file
Y Number : There was a data type error: the data type of [B object [[B©b4136a] does not correspond to value meta [Number]
at org.pentaho.di.trans.steps.textfiIeoutput.TextFiIeOutput.writeRowToFile(TextFiIeOutput.java:273)
at org.pentaho.di.trans.steps.textfiIeoutput.TextFileOutput.processRow(TextFiIeOutput.java:195)
at org.pentaho.di.trans.step.RunThread.run(RunThread.java:62)
atjava.Iang.Thread.run(Unknown Source)
Caused by: org.pentaho.di.core.exception.KettleStepException:
Error writing field content to file
Y Number : There was a data type error: the data type of [B object [[B©b4136a] does not correspond to value meta [Number]
at org.pentaho.di.trans.steps.textfiIeoutput.TextFiIeOutput.writeField(TextFileOutput.java:435)
at org.pentaho.di.trans.steps.textfiIeoutput.TextFiIeOutput.writeRowToFile(TextFiIeOutput.java:249)
3 more
Caused by: org.pentaho.di.core.exception.KettleVaIueException:
Y Number : There was a data type error: the data type of [B object [[B©b4136a] does not correspond to value meta [Number]
at org.pentaho.di.core.row.vaIue.VaIueMetaBase.getBinaryString(VaIueMetaBase.java:2185)
at org.pentaho.di.trans.steps.textfiIeoutput.TextFiIeOutput.formatField(TextFiIeOutput.java:290)
at org.pentaho.di.trans.steps.textfiIeoutput.TextFiIeOutput.writeField(TextFileOutput.java:392)
4 more
以上所有行都以2015/09/23 12:51:18 - Text file output.0 - 开头,但为简洁起见,我将其删除。我认为错误消息中相关且令人困惑的部分是:
Y Number : There was a data type error: the data type of [B object [[B©b4136a] does not correspond to value meta [Number]
一些进一步的说明:
- 如果我使用较低的跃点绕过设置字段值步骤,则转换完成且不会出错。这让我相信这是导致问题的设置字段值步骤。
- 如果我将 CSV 文件输入替换为具有相同数据 (
1,2,3) 的数据框,一切正常。 - 如果我将文件输出步骤替换为虚拟对象,则转换完成时不会出现错误。但是,如果我预览虚拟对象,它会导致类似的错误,并且字段
Y在所有三行上都有值<null>。 - 在我创建这个 MCVE 之前,我在各种看似随机的步骤上都遇到了错误,即使没有文件输出存在。所以我认为这与文件输出无关。
-
如果我将格式从数字更改为整数,则没有任何变化。但是,如果我将其更改为字符串,则转换完成时不会出现错误,我会得到以下输出:
X;Y 1;[B@49e96951 2;[B@7b016abf 3;[B@1a0760b0
这是一个错误吗?难道我做错了什么?我怎样才能做到这一点?
【问题讨论】:
-
我刚刚发现的一种解决方法是删除添加常量和设置字段值步骤,而是使用公式步骤,将新字段设置为
Y,将公式设置为[x]。跨度> -
很高兴知道是什么导致了这个问题。
-
你试过关闭惰性转换吗?这通常是导致文本文件出现奇怪错误的原因。