Parse as Datetime directive

The PARSE-AS-DATETIME directive was introduced in CDAP 6.4.0.

The PARSE-AS-DATETIME directive parses strings with datetime values to the CDAP datetime type. The datetime data type format is as per ISO 8601, separating date and time with a T.All other CDAP data types are based on Avro types.

If you are adding a Wrangler transformation to a pipeline with BigQuery sources or sinks and you want to write to a BigQuery datetime column, use PARSE-AS-DATETIME and not PARSE-AS-SIMPLEDATE. PARSE-AS-SIMPLEDATE outputs the timestamp_micros data type.

Syntax

parse-as-datetime :column "format"

Usage Notes

Format is the format of the input strings. The format must exactly match the format of the input strings. The input values and pattern must have a date and time component.

PARSE-AS-DATETIME is more restrictive than PARSE-AS-SIMPLEDATE. The format strings for PARSE-AS-DATETIME must exactly match the input strings. If they do not match, an error occurs. For more information, see “Troubleshooting” in FORMAT-DATETIME.

If the column is null or is already a datetime field, applying this directive is a no-op. The column to be parsed as a datetime must be of type string.

Format String Examples

For an explanation and examples of these format strings, see FORMAT-DATETIME.

Created in 2020 by Google Inc.