<?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: when hive-metastore started to occur query syntax error in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/when-hive-metastore-started-to-occur-query-syntax-error/m-p/268470#M206209</link>
    <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/68680"&gt;@Jeongtaek&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Please ignore my previous comment.&amp;nbsp; &amp;nbsp;&lt;BR /&gt;I reread your query and looks like you are not running the query explicitly rather the hive process is executing such query on MariaDB and failing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was reading something similar for PostgreSQL where it provides a special property to avoid such issues&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;standard_conforming_strings = off&lt;/STRONG&gt; in &lt;STRONG&gt;postgresql.conf&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Similar discussion for PostgreSQL:&amp;nbsp;&lt;A href="https://grokbase.com/t/hive/user/131qf335q5/problem-with-using-postgres-as-hive-meta-store-db" target="_blank" rel="noopener"&gt;https://grokbase.com/t/hive/user/131qf335q5/problem-with-using-postgres-as-hive-meta-store-db&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So i think that in &lt;STRONG&gt;MariaDB&lt;/STRONG&gt; also there might be some setting to avoid similar failures with string literals&amp;nbsp;with escape chars.&lt;BR /&gt;I will do bit more research on MariaDB ...&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 21 Aug 2019 03:32:48 GMT</pubDate>
    <dc:creator>jsensharma</dc:creator>
    <dc:date>2019-08-21T03:32:48Z</dc:date>
    <item>
      <title>when hive-metastore started to occur query syntax error</title>
      <link>https://community.cloudera.com/t5/Support-Questions/when-hive-metastore-started-to-occur-query-syntax-error/m-p/268467#M206206</link>
      <description>&lt;P&gt;I used configuration hive-site.xml what I already setted. than I reinstalled hadoop, hive and started hive-metastore. But I could not connect MariaDB with hive-client. Metastore log showed me MariaDB syntax error. I know hive support only MySQL. But I'm always using MariaDB and I've never gotten any problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I guess it is wrong espace query. I searched what is query. I thought hive ran this query.&amp;nbsp;&lt;SPAN&gt;SELECT “THIS”.”NAME” AS NUCORDER0 FROM “DBS” “THIS” WHERE (LOWER(“THIS”.”NAME”) LIKE ? ESCAPE ‘\\' ) ORDER BY NUCORDER0&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;But I think this query using only one backslash character. so I though there is escape issue. Can I fix or avoid this problem?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is log of exception.&lt;/P&gt;
&lt;P&gt;NestedThrowablesStackTrace:&lt;BR /&gt;java.sql.SQLSyntaxErrorException: (conn=31) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''\' ORDER BY NUCORDER0' at line 1&lt;BR /&gt;at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:242)&lt;BR /&gt;at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getException(ExceptionMapper.java:171)&lt;BR /&gt;at org.mariadb.jdbc.MariaDbStatement.executeExceptionEpilogue(MariaDbStatement.java:238)&lt;BR /&gt;at org.mariadb.jdbc.ClientSidePreparedStatement.executeInternal(ClientSidePreparedStatement.java:230)&lt;BR /&gt;at org.mariadb.jdbc.ClientSidePreparedStatement.execute(ClientSidePreparedStatement.java:157)&lt;BR /&gt;at org.mariadb.jdbc.ClientSidePreparedStatement.executeQuery(ClientSidePreparedStatement.java:172)&lt;BR /&gt;at com.jolbox.bonecp.PreparedStatementHandle.executeQuery(PreparedStatementHandle.java:174)&lt;BR /&gt;at org.datanucleus.store.rdbms.ParamLoggingPreparedStatement.executeQuery(ParamLoggingPreparedStatement.java:381)&lt;BR /&gt;at org.datanucleus.store.rdbms.SQLController.executeStatementQuery(SQLController.java:504)&lt;BR /&gt;at org.datanucleus.store.rdbms.query.JDOQLQuery.performExecute(JDOQLQuery.java:651)&lt;BR /&gt;at org.datanucleus.store.query.Query.executeQuery(Query.java:1786)&lt;BR /&gt;at org.datanucleus.store.query.Query.executeWithArray(Query.java:1672)&lt;BR /&gt;at org.datanucleus.api.jdo.JDOQuery.executeWithArray(JDOQuery.java:312)&lt;BR /&gt;at org.apache.hadoop.hive.metastore.ObjectStore.getTables(ObjectStore.java:1054)&lt;BR /&gt;at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)&lt;BR /&gt;at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)&lt;BR /&gt;at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)&lt;BR /&gt;at java.lang.reflect.Method.invoke(Method.java:498)&lt;BR /&gt;at org.apache.hadoop.hive.metastore.RawStoreProxy.invoke(RawStoreProxy.java:103)&lt;BR /&gt;at com.sun.proxy.$Proxy5.getTables(Unknown Source)&lt;BR /&gt;at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.get_tables(HiveMetaStore.java:3895)&lt;BR /&gt;at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)&lt;BR /&gt;at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)&lt;BR /&gt;at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)&lt;BR /&gt;at java.lang.reflect.Method.invoke(Method.java:498)&lt;BR /&gt;at org.apache.hadoop.hive.metastore.RetryingHMSHandler.invokeInternal(RetryingHMSHandler.java:140)&lt;BR /&gt;at org.apache.hadoop.hive.metastore.RetryingHMSHandler.invoke(RetryingHMSHandler.java:99)&lt;BR /&gt;at com.sun.proxy.$Proxy7.get_tables(Unknown Source)&lt;BR /&gt;at org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$Processor$get_tables.getResult(ThriftHiveMetastore.java:10056)&lt;BR /&gt;at org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$Processor$get_tables.getResult(ThriftHiveMetastore.java:10040)&lt;BR /&gt;at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39)&lt;BR /&gt;at org.apache.hadoop.hive.metastore.TUGIBasedProcessor$1.run(TUGIBasedProcessor.java:110)&lt;BR /&gt;at org.apache.hadoop.hive.metastore.TUGIBasedProcessor$1.run(TUGIBasedProcessor.java:106)&lt;BR /&gt;at java.security.AccessController.doPrivileged(Native Method)&lt;BR /&gt;at javax.security.auth.Subject.doAs(Subject.java:422)&lt;BR /&gt;at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1924)&lt;BR /&gt;at org.apache.hadoop.hive.metastore.TUGIBasedProcessor.process(TUGIBasedProcessor.java:118)&lt;BR /&gt;at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:286)&lt;BR /&gt;at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)&lt;BR /&gt;at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)&lt;BR /&gt;at java.lang.Thread.run(Thread.java:748)&lt;BR /&gt;Caused by: java.sql.SQLException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''\' ORDER BY NUCORDER0' at line 1&lt;BR /&gt;at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.readErrorPacket(AbstractQueryProtocol.java:1594)&lt;BR /&gt;at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.readPacket(AbstractQueryProtocol.java:1453)&lt;BR /&gt;at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.getResult(AbstractQueryProtocol.java:1415)&lt;BR /&gt;at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.executeQuery(AbstractQueryProtocol.java:288)&lt;BR /&gt;at org.mariadb.jdbc.ClientSidePreparedStatement.executeInternal(ClientSidePreparedStatement.java:221)&lt;BR /&gt;... 37 more&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is hive version.&lt;/P&gt;
&lt;P&gt;hive-metastore-1.1.0+cdh5.16.2+1450-1.cdh5.16.2.p0.28.el7.noarch&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 10:25:58 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/when-hive-metastore-started-to-occur-query-syntax-error/m-p/268467#M206206</guid>
      <dc:creator>Jeongtaek</dc:creator>
      <dc:date>2019-08-21T10:25:58Z</dc:date>
    </item>
    <item>
      <title>Re: when hive-metastore started to occur query syntax error</title>
      <link>https://community.cloudera.com/t5/Support-Questions/when-hive-metastore-started-to-occur-query-syntax-error/m-p/268469#M206208</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/68680"&gt;@Jeongtaek&lt;/a&gt;&lt;/P&gt;&lt;P&gt;Your Query seems to be partially correct. Except the &lt;STRONG&gt;LIKE ? ESCAPE '\\''&lt;/STRONG&gt; part.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;MariaDB [hive]&amp;gt; SELECT this.name AS NUCORDER0 FROM DBS this WHERE ( LOWER(this.name) LIKE 'default' ) ORDER BY NUCORDER0 ;
+-----------+
| NUCORDER0 |
+-----------+
| default |
+-----------+&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Can you please let us know what do you want to match in the LIKE condition?&amp;nbsp;&lt;BR /&gt;- Can you please share some example of DBS names that you want to filter using LIKE clause?&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 03:06:50 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/when-hive-metastore-started-to-occur-query-syntax-error/m-p/268469#M206208</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2019-08-21T03:06:50Z</dc:date>
    </item>
    <item>
      <title>Re: when hive-metastore started to occur query syntax error</title>
      <link>https://community.cloudera.com/t5/Support-Questions/when-hive-metastore-started-to-occur-query-syntax-error/m-p/268470#M206209</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/68680"&gt;@Jeongtaek&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Please ignore my previous comment.&amp;nbsp; &amp;nbsp;&lt;BR /&gt;I reread your query and looks like you are not running the query explicitly rather the hive process is executing such query on MariaDB and failing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was reading something similar for PostgreSQL where it provides a special property to avoid such issues&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;standard_conforming_strings = off&lt;/STRONG&gt; in &lt;STRONG&gt;postgresql.conf&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Similar discussion for PostgreSQL:&amp;nbsp;&lt;A href="https://grokbase.com/t/hive/user/131qf335q5/problem-with-using-postgres-as-hive-meta-store-db" target="_blank" rel="noopener"&gt;https://grokbase.com/t/hive/user/131qf335q5/problem-with-using-postgres-as-hive-meta-store-db&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So i think that in &lt;STRONG&gt;MariaDB&lt;/STRONG&gt; also there might be some setting to avoid similar failures with string literals&amp;nbsp;with escape chars.&lt;BR /&gt;I will do bit more research on MariaDB ...&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 03:32:48 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/when-hive-metastore-started-to-occur-query-syntax-error/m-p/268470#M206209</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2019-08-21T03:32:48Z</dc:date>
    </item>
    <item>
      <title>Re: when hive-metastore started to occur query syntax error</title>
      <link>https://community.cloudera.com/t5/Support-Questions/when-hive-metastore-started-to-occur-query-syntax-error/m-p/268473#M206212</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/50614"&gt;@jsensharma&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is a option like postgresql on MariaDB what you said.&amp;nbsp;&lt;A href="https://mariadb.com/kb/en/library/sql-mode/#sql_mode-values" target="_blank" rel="noopener"&gt;https://mariadb.com/kb/en/library/sql-mode/#sql_mode-values&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, I setted sql_mode option in my.cnf like this and restarted MariaDB, hive-metastore and hive-server2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[mysqld]
...
sql_mode=NO_BACKSLASH_ESCAPES
...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Than it showed me different exception again. I was sure query what hive ran was fine when I watched run query. Because this query already conciderated backslash escape character. So I removed sql_mode option and restarted MariaDB, hive-metastore and hive-server2 again. Than it didn't show any exception anymore. I don't have any idea what is different. Anyway this problem was gone and my hive-client has connected my MariaDB well.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Caused by: java.sql.SQLException: Incorrect arguments to ESCAPE
Query is: SELECT A0.TBL_NAME AS NUCORDER0 FROM TBLS A0 LEFT OUTER JOIN DBS B0 ON A0.DB_ID = B0.DB_ID WHERE B0.`NAME` = ? AND LOWER(A0.TBL_NAME) LIKE '_%' ESCAPE '\\' ORDER BY NUCORDER0, parameters ['default']
java thread: pool-5-thread-2
at org.mariadb.jdbc.internal.util.LogQueryTool.exceptionWithQuery(LogQueryTool.java:163)
at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.executeQuery(AbstractQueryProtocol.java:280)
at org.mariadb.jdbc.MariaDbPreparedStatementClient.executeInternal(MariaDbPreparedStatementClient.java:223)
... 37 more&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 06:04:28 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/when-hive-metastore-started-to-occur-query-syntax-error/m-p/268473#M206212</guid>
      <dc:creator>Jeongtaek</dc:creator>
      <dc:date>2019-08-21T06:04:28Z</dc:date>
    </item>
  </channel>
</rss>

