From f770f209a4a184c21430bf9f5dd20b3d5211eee2 Mon Sep 17 00:00:00 2001 From: Matthew Burgess Date: Wed, 25 May 2022 16:21:40 -0400 Subject: [PATCH] NIFI-10057: Add support for SQL Server's DATETIMEOFFSET type to ExecuteSQL processors --- .../org/apache/nifi/serialization/record/ResultSetRecordSet.java | 1 + .../src/main/java/org/apache/nifi/util/db/JdbcCommon.java | 1 + 2 files changed, 2 insertions(+) diff --git a/nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/ResultSetRecordSet.java b/nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/ResultSetRecordSet.java index 8ce2255ab226..d2c4f6cb093b 100644 --- a/nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/ResultSetRecordSet.java +++ b/nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/ResultSetRecordSet.java @@ -526,6 +526,7 @@ private static RecordFieldType getFieldType(final int sqlType, final String valu case Types.TIMESTAMP_WITH_TIMEZONE: case -101: // Oracle's TIMESTAMP WITH TIME ZONE case -102: // Oracle's TIMESTAMP WITH LOCAL TIME ZONE + case -155: // SQL Server's DATETIMEOFFSET return getRecordFieldType(TIMESTAMP, useLogicalTypes); } diff --git a/nifi-nar-bundles/nifi-extension-utils/nifi-database-utils/src/main/java/org/apache/nifi/util/db/JdbcCommon.java b/nifi-nar-bundles/nifi-extension-utils/nifi-database-utils/src/main/java/org/apache/nifi/util/db/JdbcCommon.java index 30e6c51c68fe..b78408c9129b 100644 --- a/nifi-nar-bundles/nifi-extension-utils/nifi-database-utils/src/main/java/org/apache/nifi/util/db/JdbcCommon.java +++ b/nifi-nar-bundles/nifi-extension-utils/nifi-database-utils/src/main/java/org/apache/nifi/util/db/JdbcCommon.java @@ -635,6 +635,7 @@ public static Schema createSchema(final ResultSet rs, AvroConversionOptions opti case TIMESTAMP_WITH_TIMEZONE: case -101: // Oracle's TIMESTAMP WITH TIME ZONE case -102: // Oracle's TIMESTAMP WITH LOCAL TIME ZONE + case -155: // SQL Server's DATETIMEOFFSET addNullableField(builder, columnName, u -> options.useLogicalTypes ? u.type(LogicalTypes.timestampMillis().addToSchema(SchemaBuilder.builder().longType()))