[ 
https://issues.apache.org/jira/browse/NIFI-7410?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ZhangCheng updated NIFI-7410:
-----------------------------
    Description: 
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?




  was:
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.

But I think  this should be maintained  too.




> 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
>            Reporter: ZhangCheng
>            Priority: Major
>
> 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)

Reply via email to