2

Sample CSV data:

emp_name,id,street_name,datetime
abc,123,xyz,8/23/21 18:27

schema used:

{
  "type" : "record",
  "namespace" : "sample",
  "name" : "sample_test",
  "fields" : [
    { "name" : "emp_name", "type" : [ "null", "string"] , "default":null},
    { "name" : "id", "type" : [ "null", "string"] , "default":null},
    { "name" : "street_name", "type" : [ "null", "string"] , "default":null},
    { "name" : "datetime", "type":"long", "logicalType":"timestamp-millis"}
  ]
}
Valid Format : MM/DD/YYYY HH:mm:ss

NIFI to check (08/23/21 18:04:01) format for datetime column from CSV file
Expected: Invalid format

NIFI to check (08/23/2021 18:04:01) format for datetime column from CSV file
Expected: Valid format

Barbaros Özhan
  • 59,113
  • 10
  • 31
  • 55
itsmtech
  • 21
  • 1
  • 2

1 Answers1

2

Use a ValidateCsv processor:

  • Schema: Null, Null, Null, ParseDate("mm/DD/yyyy HH:mm:ss")
  • Header: true
tonykoval
  • 958
  • 7
  • 18