<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Apache Nifi ExecuteSQL processor error: org.apache.avro.unresolvedUnionException: not in union [&amp;quot;null&amp;quot;,&amp;quot;float&amp;quot;] in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Apache-Nifi-ExecuteSQL-processor-error-org-apache-avro/m-p/176187#M70414</link>
    <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/641/mburgess.html" nodeid="641"&gt;@Matt Burgess&lt;/A&gt; Thanks for the explanation and suggestions.&lt;/P&gt;</description>
    <pubDate>Tue, 31 Oct 2017 01:44:38 GMT</pubDate>
    <dc:creator>gurinderbeers</dc:creator>
    <dc:date>2017-10-31T01:44:38Z</dc:date>
    <item>
      <title>Apache Nifi ExecuteSQL processor error: org.apache.avro.unresolvedUnionException: not in union ["null","float"]</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Apache-Nifi-ExecuteSQL-processor-error-org-apache-avro/m-p/176183#M70410</link>
      <description>&lt;P&gt;Using the ExecuteSQL processor (nifi 1.3) to fetch table from Teradata Database. The processor gives error (org.apache.avro.unresolvedUnionException: not in union ["null","float"]) when the table in the Teradata database has the 'Float' datatype. &lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="41592-screen-shot-2017-10-26-at-50325-pm.png" style="width: 1032px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/19715i19DD033BAC00E720/image-size/medium?v=v2&amp;amp;px=400" role="button" title="41592-screen-shot-2017-10-26-at-50325-pm.png" alt="41592-screen-shot-2017-10-26-at-50325-pm.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.cloudera.com/legacyfs/online/attachments/41590-screen-shot-2017-10-26-at-50325-pm.png" target="_blank"&gt;&lt;/A&gt;The process is good when fetching the same table (float datatype) from Postgres database.&lt;/P&gt;&lt;P&gt;Please Advise..!&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 10:00:01 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Apache-Nifi-ExecuteSQL-processor-error-org-apache-avro/m-p/176183#M70410</guid>
      <dc:creator>gurinderbeers</dc:creator>
      <dc:date>2019-08-18T10:00:01Z</dc:date>
    </item>
    <item>
      <title>Re: Apache Nifi ExecuteSQL processor error: org.apache.avro.unresolvedUnionException: not in union ["null","float"]</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Apache-Nifi-ExecuteSQL-processor-error-org-apache-avro/m-p/176184#M70411</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/23216/gurinderbeers.html" nodeid="23216" target="_blank"&gt;@Gurinderbeer Singh&lt;/A&gt;&lt;P&gt;To resolve this error find out the column/columns which are causing issues&lt;/P&gt;&lt;P&gt;1. &lt;STRONG&gt;Cast those column/columns &lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;2. Use the&lt;STRONG&gt; whole cast &lt;/STRONG&gt;&lt;STRONG&gt;select query&lt;/STRONG&gt; in &lt;STRONG&gt;ExecuteSQL&lt;/STRONG&gt; processor.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;instead of&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;select * from &amp;lt;table-name&amp;gt;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;Use the Cast Select statement &lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;select col1,col2,cast(col3 as decimal((n,m))) from &amp;lt;table-name&amp;gt; //give values for n(is the total number of digits (precision)) and m(is the number of digits to the right of the decimal point (scale).&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;Ex:- &lt;/STRONG&gt;decimal(10,2) //total number of digit is 10, 2 digits to right of decimal point.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;(or)&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;select col1,col2,cast(col3 as varchar(n)) from &amp;lt;table-name&amp;gt; //if you are not sure with decimal values then cast as varchar specify value for n(varying-length column of length n).&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;Ex:-&lt;/STRONG&gt; varchar(30),varchar(20)...&lt;/P&gt;&lt;P&gt;&lt;B&gt;Executesql Configs:-&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="41608-executesql.png" style="width: 770px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/19714iA4D8BC15CE9C783B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="41608-executesql.png" alt="41608-executesql.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 09:59:53 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Apache-Nifi-ExecuteSQL-processor-error-org-apache-avro/m-p/176184#M70411</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2019-08-18T09:59:53Z</dc:date>
    </item>
    <item>
      <title>Re: Apache Nifi ExecuteSQL processor error: org.apache.avro.unresolvedUnionException: not in union ["null","float"]</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Apache-Nifi-ExecuteSQL-processor-error-org-apache-avro/m-p/176185#M70412</link>
      <description>&lt;P&gt;According to &lt;A target="_blank" href="https://developer.teradata.com/doc/connectivity/jdbc/reference/current/jdbcug_chapter_7.html"&gt;this&lt;/A&gt;, it looks like Teradata doesn't support the DOUBLE data type, and instead supports FLOAT as the JDBC type yet returns a Double object when getObject is called.  When the Double is inserted into an Avro record whose field type is "float", you get the above error.&lt;/P&gt;&lt;P&gt;This IMO is an issue with Teradata being out of spec with JDBC. Although NiFi could demote a Double into a float field, that is not prudent as there can be data/precision loss or other issues of which the user would never be made aware.&lt;/P&gt;&lt;P&gt;A workaround might be to use a DECIMAL column instead of DOUBLE, or to cast the column(s) as &lt;A rel="user" href="https://community.cloudera.com/users/18929/yaswanthmuppireddy.html" nodeid="18929"&gt;@Shu&lt;/A&gt; suggested.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2017 01:20:49 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Apache-Nifi-ExecuteSQL-processor-error-org-apache-avro/m-p/176185#M70412</guid>
      <dc:creator>mburgess</dc:creator>
      <dc:date>2017-10-31T01:20:49Z</dc:date>
    </item>
    <item>
      <title>Re: Apache Nifi ExecuteSQL processor error: org.apache.avro.unresolvedUnionException: not in union ["null","float"]</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Apache-Nifi-ExecuteSQL-processor-error-org-apache-avro/m-p/176186#M70413</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/18929/yaswanthmuppireddy.html" nodeid="18929"&gt;@Shu&lt;/A&gt; Thanks for the suggestions. The current process is using this Cast to varchar(), but I was wondering if we can get the data as float in AVRO. &lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2017 01:37:46 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Apache-Nifi-ExecuteSQL-processor-error-org-apache-avro/m-p/176186#M70413</guid>
      <dc:creator>gurinderbeers</dc:creator>
      <dc:date>2017-10-31T01:37:46Z</dc:date>
    </item>
    <item>
      <title>Re: Apache Nifi ExecuteSQL processor error: org.apache.avro.unresolvedUnionException: not in union ["null","float"]</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Apache-Nifi-ExecuteSQL-processor-error-org-apache-avro/m-p/176187#M70414</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/641/mburgess.html" nodeid="641"&gt;@Matt Burgess&lt;/A&gt; Thanks for the explanation and suggestions.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2017 01:44:38 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Apache-Nifi-ExecuteSQL-processor-error-org-apache-avro/m-p/176187#M70414</guid>
      <dc:creator>gurinderbeers</dc:creator>
      <dc:date>2017-10-31T01:44:38Z</dc:date>
    </item>
    <item>
      <title>Re: Apache Nifi ExecuteSQL processor error: org.apache.avro.unresolvedUnionException: not in union ["null","float"]</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Apache-Nifi-ExecuteSQL-processor-error-org-apache-avro/m-p/176188#M70415</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/23216/gurinderbeers.html" nodeid="23216"&gt;@Gurinderbeer Singh&lt;/A&gt;&lt;P&gt;As we are casting the &lt;STRONG&gt;datatype of the column&lt;/STRONG&gt; to &lt;STRONG&gt;varchar() or decimal()&lt;/STRONG&gt; after execute sql processor converts as &lt;STRONG&gt;string type&lt;/STRONG&gt;.  &lt;/P&gt;&lt;P&gt; But if you know the &lt;STRONG&gt;data of the column&lt;/STRONG&gt; and once you import the &lt;STRONG&gt;data into Directory&lt;/STRONG&gt; then you can &lt;STRONG&gt;create hive table column data type as float, double, decimal, string&lt;/STRONG&gt;  data type you need.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2017 02:10:30 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Apache-Nifi-ExecuteSQL-processor-error-org-apache-avro/m-p/176188#M70415</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2017-10-31T02:10:30Z</dc:date>
    </item>
    <item>
      <title>Re: Apache Nifi ExecuteSQL processor error: org.apache.avro.unresolvedUnionException: not in union ["null","float"]</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Apache-Nifi-ExecuteSQL-processor-error-org-apache-avro/m-p/176189#M70416</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/641/mburgess.html" nodeid="641"&gt;@Matt Burgess&lt;/A&gt; &lt;/P&gt;&lt;P&gt;JDBC spec does state that REAL maps to (single-precision) float; FLOAT maps to double precision, thus the mapping to in avro should be to double not float, reference table B-1 page 190: &lt;/P&gt;&lt;P&gt;&lt;A href="http://download.oracle.com/otn-pub/jcp/jdbc-4_3-mrel3-eval-spec/jdbc4.3-fr-spec.pdf" target="_blank"&gt;http://download.oracle.com/otn-pub/jcp/jdbc-4_3-mrel3-eval-spec/jdbc4.3-fr-spec.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;So the following code fix resolved the issue.&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/JdbcCommon.java#L527" target="_blank"&gt;https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/JdbcCommon.java#L527&lt;/A&gt;&lt;/P&gt;&lt;P&gt;original&lt;/P&gt;&lt;PRE&gt;case FLOAT:
case REAL:                  
builder.name(columnName).type().unionOf().nullBuilder().endNull().and().floatType().endUnion().noDefault();                    
break;
              
case DOUBLE:                   
builder.name(columnName).type().unionOf().nullBuilder().endNull().and().doubleType().endUnion().noDefault();                    
break;&lt;/PRE&gt;&lt;P&gt;Modified&lt;/P&gt;&lt;PRE&gt;case REAL:                  
builder.name(columnName).type().unionOf().nullBuilder().endNull().and().floatType().endUnion().noDefault();                    
break;

case FLOAT:        
case DOUBLE:                   
builder.name(columnName).type().unionOf().nullBuilder().endNull().and().doubleType().endUnion().noDefault();                    
break;&lt;/PRE&gt;&lt;P&gt;Thanks to &lt;A rel="user" href="https://community.cloudera.com/users/47163/ronaldmahoney.html" nodeid="47163"&gt;@Ron Mahoney&lt;/A&gt; for finding this issue.&lt;/P&gt;</description>
      <pubDate>Sat, 04 Nov 2017 07:18:49 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Apache-Nifi-ExecuteSQL-processor-error-org-apache-avro/m-p/176189#M70416</guid>
      <dc:creator>gurinderbeers</dc:creator>
      <dc:date>2017-11-04T07:18:49Z</dc:date>
    </item>
  </channel>
</rss>

