我试图在Nifi中使用ValidateCSV处理器,但我不知道如何定义模式。我的输出(流文件)如下:
> PassCountId,CameraId,EventDate,Counter
>
> 32340,4,2020-10-14 15:26:20.170,4
>
> 32341,3,2020-10-14 15:26:51.747,4
>
> 32342,3,2020-10-14 15:26:57.907,6我在架构下尝试过,但它没有工作。
{
"type": "record",
"name": "NifiRecord",
"fields" : [
{"name": "PassCountId", "type": "bigint"},
{"name": "CameraId", "type": "int"},
{"name": "EventDate", "type": "datetime"},
{"name": "Counter", "type": "int"}
]
}定义架构的正确方法是什么?
我已经查过文件了。不幸的是这没什么帮助。https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.6.0/org.apache.nifi.processors.standard.ValidateCsv/
谢谢。
发布于 2020-10-16 12:36:36
@Tyr这里是模式的一个示例
"type" : "record",
"namespace" : "nifi",
"name" : "nifi",
"fields" : [
{ "name" : "c1" , "type" : ["null", "string"] },
{ "name" : "c2" , "type" : ["null", "string"] },
{ "name" : "c3" , "type" : ["null", "string"] }
]
}根据文档,您可以为模式验证函数提供如下内容:
: [ParseBigDecimal, ParseBool, ParseChar, ParseDate, ParseDouble, ParseInt, ParseLong, Optional, DMinMax, Equals, ForbidSubStr, LMinMax, NotNull, Null, RequireHashCode, RequireSubStr, Strlen, StrMinMax, StrNotNullOrEmpty, StrRegEx, Unique, UniqueHashCode, IsIncludedIn] 我的建议是从字符串模式开始,然后为您的第一列尝试使用ParseBigDecimal。工作在小的可测试的迭代,直到你有一个完全构建的模式。
https://stackoverflow.com/questions/64368073
复制相似问题