我正在尝试验证 U-SQL SELECT 中的字符串变量是否可以解释为整数,因此我正在尝试使用 int.TryParse 将“0”和“”替换为默认值 2,将 10 以上的所有内容替换为 10 . 这是代码:
DECLARE @maxAvgkWh double = 100.00;
DECLARE @defaultM2 int = 90;
DECLARE @defaultPersons int = 2;
// Extracting installations and their information
@forDecisionTree =
EXTRACT [InstallationId] string,
[PrimaryHeatingType] string,
[Persons] string,
[SquareMeters] string,
[LatestAvgDailykWh] double
FROM "adl://some text file in azure data lake"
USING Extractors.Tsv(skipFirstNRows : 1, silent : true);
// Making sure that NULLS and zeroes and abnormal values are replaced with default values
@forDecisionTreeHouseTypeReplNulls =
SELECT [InstallationId],
[PrimaryHeatingType],
(
! int.TryParse(Persons, out var _pers) || _pers <= 0 ?
@defaultPersons :
_pers > 10 ?
10 :
_pers
).ToString() AS [Persons],
(
! int.TryParse([SquareMeters], out var _m2) || _m2 <= 0 ?
@defaultM2 :
_m2 > 500 ?
500 :
_m2
).ToString() AS [SquareMeters],
[LatestAvgDailykWh]
FROM @forDecisionTreeHouseType
WHERE [LatestAvgDailykWh] < @maxAvgkWh;
我不断收到以下错误:
C# 错误 CS1003:语法错误,',' 预期
在标记“_pers”处,### 附近的第 108 行:
……!int.TryParse([Persons], out var ### _pers) || _pers <= 0 ? ...
繁华开满天机
ibeautiful
相关分类