Nifi ValideCSV 架构示例

Nifi ValideCSV Schema example

我正在尝试在 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/

谢谢。

@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 作为第一列的例子。在小的可测试迭代中工作,直到你有一个完全构建的模式。