[
https://issues.apache.org/jira/browse/NIFI-7410?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17159900#comment-17159900
]
ASF subversion and git services commented on NIFI-7410:
-------------------------------------------------------
Commit e18b4f0c75849355d11519eab23815f894e5c365 in nifi's branch
refs/heads/main from zhangcheng
[ https://gitbox.apache.org/repos/asf?p=nifi.git;h=e18b4f0 ]
NIFI-7410 Update JdbcCommon.java when javaSqlType is CLOB or NCLOB in
convertToAvroStream method, use the DataTypeUtils.toString(clob/nClob,(String)
null, StandardCharsets.UTF_8)) method to get the String
NIFI-7410 Update JdbcCommon.java when javaSqlType is CLOB or NCLOB in
convertToAvroStream method, use the CharacterStream rto read the value of CLOB
NIFI-7410 Add a unit test. validate if it's unreadable when the clob value is
Chinese, Japanese, and Korean.
Signed-off-by: Pierre Villard <[email protected]>
This closes #4243.
> Clob unreadable code when convertToAvroStream in JdbcCommon.java
> -----------------------------------------------------------------
>
> Key: NIFI-7410
> URL: https://issues.apache.org/jira/browse/NIFI-7410
> Project: Apache NiFi
> Issue Type: Bug
> Affects Versions: 1.11.4
> Reporter: ZhangCheng
> Assignee: ZhangCheng
> Priority: Major
> Labels: pull-request-available
> Time Spent: 50m
> Remaining Estimate: 0h
>
> when ExecuteSql or QueryDataBaseTable processor trigger below code in
> JdbcCommon.java ,clob would be unreadable code(with Chinese character)
> {code:java}
> if (javaSqlType == CLOB) {
> Clob clob = rs.getClob(i);
> if (clob != null) {
> long numChars = clob.length();
> char[] buffer = new char[(int) numChars];
> InputStream is = clob.getAsciiStream();
> int index = 0;
> int c = is.read();
> while (c >= 0) {
> buffer[index++] = (char) c;
> c = is.read();
> }
> rec.put(i - 1, new String(buffer));
> clob.free();
> } else {
> rec.put(i - 1, null);
> }
> continue;
> }
> {code}
> I konw this can be resoveld by using ExecuteSqlRecord and
> QueryDatabaseTableRecord. Then have new avroWriter(by using controller
> cervice), so I think ,can we change the DefaultAvroSqlWriter to the new
> avroWriter?
--
This message was sent by Atlassian Jira
(v8.3.4#803005)