我需要从文件中提取数据,请参见下面的代码。
@rows =
EXTRACT booking_date string,
route string,
channel string,
pos string,
venta string,
flight_date string,
ancillary string,
paxs int?
FROM "/ventas/ventas1.csv"
USING Extractors.Text(delimiter:';', silent:true);
@output =
SELECT booking_date,
channel,
Convert.ToDouble(venta.Replace(",", ".")) AS venta,
paxs
FROM @rows;
我的问题是数字是西班牙语格式,意思是“ 100,234”而不是“ 100.234”。 有谁知道如何更改Extractors.Text中的格式,或者如何在U-SQL中将字符串转换为整数?
答案 0 :(得分:0)
将列作为字符串导入并替换句号,例如:
@input =
EXTRACT venta string,
paxs int
FROM @inputFile
USING Extractors.Text(delimiter : ';');
@output =
SELECT Convert.ToInt32(venta.Replace(".", "")) AS venta
FROM @input;