如果 ExecuteSQL 具有日期时间偏移值,它不会 select table?
ExecuteSQL doesn't select table if it having dateTime Offset value?
我创建了 table,单列的数据类型为 -dateTimeOffset 值并插入了一些值。
create table dto (dto datetimeoffset(7))
insert into dto values (GETDATE()) -- inserts date and time with 0 offset
insert into dto values (SYSDATETIMEOFFSET()) -- current date time and offset
insert into dto values ('20131114 08:54:00 +10:00') -- manual way
在 Nifi 中,我在执行 SQL 中指定了 "Select * from dto" 查询。
显示如下错误..,
java.lang.IllegalArgumentException: createSchema: Unknown SQL type -155 cannot be converted to Avro type
如果我将该列更改为 dateTime,则 ExecuteSQL 会正确运行,但它在 DateTimeOffset 列中不起作用。
感谢任何帮助。
非常感谢
datetimeoffset 是 MSSQL-specific JDBC type and is not supported by ExecuteSQL (which supports the standard JDBC types). You could try to cast the datetimeoffset field into some other standard type such as datetime, as described here.
我创建了一个自定义处理器并调整了 JdbcCommon.java class 以包含 SQL 服务器的 DATETIMEOFFSET。这只是一行代码。我会尝试看看是否可以让他们将其合并到官方仓库中。
这是我的JdbcCommon.java:
case TIMESTAMP:
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 <---- added this line
addNullableField(builder, columnName,
u -> options.useLogicalTypes
? u.type(LogicalTypes.timestampMillis().addToSchema(SchemaBuilder.builder().longType()))
: u.stringType());
break;
我创建了 table,单列的数据类型为 -dateTimeOffset 值并插入了一些值。
create table dto (dto datetimeoffset(7))
insert into dto values (GETDATE()) -- inserts date and time with 0 offset
insert into dto values (SYSDATETIMEOFFSET()) -- current date time and offset
insert into dto values ('20131114 08:54:00 +10:00') -- manual way
在 Nifi 中,我在执行 SQL 中指定了 "Select * from dto" 查询。
显示如下错误..,
java.lang.IllegalArgumentException: createSchema: Unknown SQL type -155 cannot be converted to Avro type
如果我将该列更改为 dateTime,则 ExecuteSQL 会正确运行,但它在 DateTimeOffset 列中不起作用。
感谢任何帮助。
非常感谢
datetimeoffset 是 MSSQL-specific JDBC type and is not supported by ExecuteSQL (which supports the standard JDBC types). You could try to cast the datetimeoffset field into some other standard type such as datetime, as described here.
我创建了一个自定义处理器并调整了 JdbcCommon.java class 以包含 SQL 服务器的 DATETIMEOFFSET。这只是一行代码。我会尝试看看是否可以让他们将其合并到官方仓库中。
这是我的JdbcCommon.java:
case TIMESTAMP:
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 <---- added this line
addNullableField(builder, columnName,
u -> options.useLogicalTypes
? u.type(LogicalTypes.timestampMillis().addToSchema(SchemaBuilder.builder().longType()))
: u.stringType());
break;