【发布时间】:2015-06-03 13:05:36
【问题描述】:
我对 Pentaho 数据集成(又名 Kettle)进行了转换,我首先使用“CSV 输入”来映射我的平面文件。
我在 Windows 上的这一步从来没有遇到过问题,但现在我将要运行 spoon 的服务器更改为 linux 服务器,现在我遇到了解析问题(将字符串转换为整数)。
简而言之,转换的作用是:
CSV 输入: 用于映射我的 CSV 中的所有字段。我使用 ISO-8859-1 编码。
过滤行:用于获取一些特定的行。
Script Values/Mod:用于更改某些字段的某些值。
现在,导致问题的步骤:
选择/重命名值: 用于将标题重命名为我的表格列,以便我可以在表格中插入数据。每个选项卡上有什么?
选择和更改(选项卡)*省略空字段
字段名 重命名为
Código codigo_cliente
元数据(选项卡)*省略空字段
字段名 重命名为 类型 二进制到正常 数据格式宽松? 宽大的号码转换?
Código codigo_cliente 整数 N N
我得到的错误是:
2015/06/03 09:49:10 - Select values.0 - ERROR (version 5.3.0.0-213, build 1 from 2015-02-02_12-17-08 by buildguy) : Unexpected error
2015/06/03 09:49:10 - Select values.0 - ERROR (version 5.3.0.0-213, build 1 from 2015-02-02_12-17-08 by buildguy) : org.pentaho.di.core.exception.KettleValueException:
2015/06/03 09:49:10 - Select values.0 - Unexpected conversion error while converting value [codigo_cliente String<binary-string>] to an Integer
2015/06/03 09:49:10 - Select values.0 -
2015/06/03 09:49:10 - Select values.0 - codigo_cliente String<binary-string> : couldn't convert String to Integer
2015/06/03 09:49:10 - Select values.0 -
2015/06/03 09:49:10 - Select values.0 - codigo_cliente String<binary-string> : couldn't convert String to number : non-numeric character found at position 7 for value [21.237,00]
2015/06/03 09:49:10 - Select values.0 -
2015/06/03 09:49:10 - Select values.0 -
2015/06/03 09:49:10 - Select values.0 -
2015/06/03 09:49:10 - Select values.0 - at org.pentaho.di.core.row.value.ValueMetaBase.getInteger(ValueMetaBase.java:1780)
2015/06/03 09:49:10 - Select values.0 - at org.pentaho.di.core.row.value.ValueMetaBase.convertData(ValueMetaBase.java:3537)
2015/06/03 09:49:10 - Select values.0 - at org.pentaho.di.trans.steps.selectvalues.SelectValues.metadataValues(SelectValues.java:326)
2015/06/03 09:49:10 - Select values.0 - at org.pentaho.di.trans.steps.selectvalues.SelectValues.processRow(SelectValues.java:375)
2015/06/03 09:49:10 - Select values.0 - at org.pentaho.di.trans.step.RunThread.run(RunThread.java:62)
2015/06/03 09:49:10 - Select values.0 - at java.lang.Thread.run(Thread.java:744)
2015/06/03 09:49:10 - Select values.0 - Caused by: org.pentaho.di.core.exception.KettleValueException:
2015/06/03 09:49:10 - Select values.0 - codigo_cliente String<binary-string> : couldn't convert String to Integer
2015/06/03 09:49:10 - Select values.0 -
2015/06/03 09:49:10 - Select values.0 - codigo_cliente String<binary-string> : couldn't convert String to number : non-numeric character found at position 7 for value [21.237,00]
2015/06/03 09:49:10 - Select values.0 -
2015/06/03 09:49:10 - Select values.0 -
2015/06/03 09:49:10 - Select values.0 - at org.pentaho.di.core.row.value.ValueMetaBase.convertStringToInteger(ValueMetaBase.java:1036)
2015/06/03 09:49:10 - Select values.0 - at org.pentaho.di.core.row.value.ValueMetaBase.getInteger(ValueMetaBase.java:1720)
2015/06/03 09:49:10 - Select values.0 - ... 5 more
2015/06/03 09:49:10 - Select values.0 - Caused by: org.pentaho.di.core.exception.KettleValueException:
2015/06/03 09:49:10 - Select values.0 - codigo_cliente String<binary-string> : couldn't convert String to number : non-numeric character found at position 7 for value [21.237,00]
2015/06/03 09:49:10 - Select values.0 -
2015/06/03 09:49:10 - Select values.0 - at org.pentaho.di.core.row.value.ValueMetaBase.convertStringToInteger(ValueMetaBase.java:1028)
2015/06/03 09:49:10 - Select values.0 - ... 6 more
出现问题的原因是,在此字段中,我在 CSV 文件中使用逗号作为小数点。
这就是我的 CSV 文件的样子:
我的 CSV 文件的标题:
Ano;Mês;Diretoria;Tipo;Tipo de macrorubrica;Macrorubrica;Conta contábil;Código;Cliente;OS;Descrição;Fornecedor;Documento;Tipo documento;Nota;Atividade;Tipo atividade;Descrição;UA;Valor;Orçado
其中一行:
2015;4;CERT;Custo Apropriado;CUSTO SERVIÇO PRESTADO;PESSOAL;14520 .201;87.979,00;SOF HAR;00077864;SQ 36525;FUNDACAO ABCD;1383;FP;;1048;.;.;2030;1.076,35;,00
如果更容易看到,我在该行中名为“Código”的列(稍后将在“选择值”步骤中变为“codigo_cliente”)的值为 87.979,00
在不更改我的 CSV 文件的情况下解决此问题的最佳方法是什么?
【问题讨论】:
标签: linux pentaho business-intelligence kettle pdi