<?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: Impala Query Filter with trailing spaces - not following ANSI standard in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Impala-Query-Filter-with-trailing-spaces-not-following-ANSI/m-p/41346#M29599</link>
    <description>&lt;P&gt;You're welcome. Sorry for the inconvenience.&lt;/P&gt;</description>
    <pubDate>Thu, 26 May 2016 07:10:47 GMT</pubDate>
    <dc:creator>alex.behm</dc:creator>
    <dc:date>2016-05-26T07:10:47Z</dc:date>
    <item>
      <title>Impala Query Filter with trailing spaces - not following ANSI standard</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Impala-Query-Filter-with-trailing-spaces-not-following-ANSI/m-p/41303#M29594</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am porting an app from SQLServer to Impala. Microsoft say that when they compare strings they follow the ANSI/ISO SQL-92 specification (Section 8.2, &amp;lt;Comparison Predicate&amp;gt;, General rules #3). (see &lt;A href="https://support.microsoft.com/en-us/kb/316626)" target="_blank"&gt;https://support.microsoft.com/en-us/kb/316626)&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As far as I can tell Impala does not do this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This simple script illustrates this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CREATE TABLE test (C1 CHAR(10));&lt;BR /&gt;insert into test (C1) VALUES ('ABC&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '); --note the trailing spaces here&lt;BR /&gt;select * from test where c1 = 'ABC';&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; --note I am not specifying them here&lt;BR /&gt;drop table test;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When run on SQLServer, I get the row back. Impala does not return it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to fix this?&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 10:21:48 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Impala-Query-Filter-with-trailing-spaces-not-following-ANSI/m-p/41303#M29594</guid>
      <dc:creator>SHoffmann</dc:creator>
      <dc:date>2022-09-16T10:21:48Z</dc:date>
    </item>
    <item>
      <title>Re: Impala Query Filter with trailing spaces - not following ANSI standard</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Impala-Query-Filter-with-trailing-spaces-not-following-ANSI/m-p/41323#M29595</link>
      <description>&lt;P&gt;Thanks for your report. This is a known issue:&lt;/P&gt;&lt;P&gt;&lt;A href="https://issues.cloudera.org/browse/IMPALA-1652" target="_blank"&gt;https://issues.cloudera.org/browse/IMPALA-1652&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The simplest workaround is to use the STRING data type instead.&lt;/P&gt;</description>
      <pubDate>Wed, 25 May 2016 17:49:37 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Impala-Query-Filter-with-trailing-spaces-not-following-ANSI/m-p/41323#M29595</guid>
      <dc:creator>alex.behm</dc:creator>
      <dc:date>2016-05-25T17:49:37Z</dc:date>
    </item>
    <item>
      <title>Re: Impala Query Filter with trailing spaces - not following ANSI standard</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Impala-Query-Filter-with-trailing-spaces-not-following-ANSI/m-p/41343#M29596</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried following your suggestion. This is my script&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CREATE TABLE test (C1 STRING);&lt;BR /&gt;insert into test (C1) VALUES ('ABC&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '); --note the trailing spaces here&lt;BR /&gt;select * from test where c1 = 'ABC';&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; --note I am not specifying them here&lt;BR /&gt;drop table test;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This also doesnt work. What am I doing wrong?&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2016 06:27:10 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Impala-Query-Filter-with-trailing-spaces-not-following-ANSI/m-p/41343#M29596</guid>
      <dc:creator>SHoffmann</dc:creator>
      <dc:date>2016-05-26T06:27:10Z</dc:date>
    </item>
    <item>
      <title>Re: Impala Query Filter with trailing spaces - not following ANSI standard</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Impala-Query-Filter-with-trailing-spaces-not-following-ANSI/m-p/41344#M29597</link>
      <description>&lt;P&gt;You are not doing anything wrong. I should have been more clear in my description of the workaround, sorry.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It seems like what you want is CHAR comparison semantics, but Impala currently does not provide that directly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To avoid confusion, I'd recommend using the STRING type consistently. However, comparison of STRINGs are whitespace-sensitive, so you will have to work around that, e.g., by manually trimming the whitespace when doing comparisons.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So in your example, you'd have to change your query to:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;select * from test where trim(c1) = 'ABC';&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2016 06:40:51 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Impala-Query-Filter-with-trailing-spaces-not-following-ANSI/m-p/41344#M29597</guid>
      <dc:creator>alex.behm</dc:creator>
      <dc:date>2016-05-26T06:40:51Z</dc:date>
    </item>
    <item>
      <title>Re: Impala Query Filter with trailing spaces - not following ANSI standard</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Impala-Query-Filter-with-trailing-spaces-not-following-ANSI/m-p/41345#M29598</link>
      <description>&lt;P&gt;Ok, that makes sense now. This solution does also work with CHAR type guess. The other alternative is to pad out the literal, which in my particular case is easier.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the prompy reply.&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2016 07:02:41 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Impala-Query-Filter-with-trailing-spaces-not-following-ANSI/m-p/41345#M29598</guid>
      <dc:creator>SHoffmann</dc:creator>
      <dc:date>2016-05-26T07:02:41Z</dc:date>
    </item>
    <item>
      <title>Re: Impala Query Filter with trailing spaces - not following ANSI standard</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Impala-Query-Filter-with-trailing-spaces-not-following-ANSI/m-p/41346#M29599</link>
      <description>&lt;P&gt;You're welcome. Sorry for the inconvenience.&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2016 07:10:47 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Impala-Query-Filter-with-trailing-spaces-not-following-ANSI/m-p/41346#M29599</guid>
      <dc:creator>alex.behm</dc:creator>
      <dc:date>2016-05-26T07:10:47Z</dc:date>
    </item>
  </channel>
</rss>

