Support Questions

Find answers, ask questions, and share your expertise

Hive query LIKE wildcard special character '$' check failed at Atlas in HDP 2.3.2 Sandbox

avatar
Expert Contributor

Not sure why ruby in Atlas gets involved to check '$' in RLIKE. I have to replace with \044 to make it work. 0: jdbc:hive2://localhost:10000> INSERT OVERWRITE TABLE bible_singles SELECT * FROM bible_raw WHERE idx RLIKE '^[A-Z][a-z]+ [0-9]+\:[0-9]+\044'; ... INFO : Loading data to table dsaphqa.bible_singles from hdfs://sandbox.hortonworks.com:8020/apps/hive/warehouse/dsaphqa.db/bible_singles/.hive-staging_hive_2016-03-14_21-01-59_996_2433046884623474776-9/-ext-10000 INFO : Table dsaphqa.bible_singles stats: [numFiles=1, numRows=24884, totalSize=4420495, rawDataSize=4395611] No rows affected (14.191 seconds)

: jdbc:hive2://localhost:10000> INSERT OVERWRITE TABLE bible_singles  SELECT * FROM  bible_raw WHERE idx RLIKE '^[A-Z][a-z]+ [0-9]+\:[0-9]+$';
...
INFO  : Loading data to table dsaphqa.bible_singles from hdfs://sandbox.hortonworks.com:8020/apps/hive/warehouse/dsaphqa.db/bible_singles/.hive-staging_hive_2016-03-14_20-20-26_325_2082707825684794131-9/-ext-10000
INFO  : Table dsaphqa.bible_singles stats: [numFiles=1, numRows=24884, totalSize=4420495, rawDataSize=4395611]
Error: Error while processing statement: FAILED: Hive Internal Error: org.apache.atlas.AtlasServiceException(Metadata service API SEARCH_GREMLIN failed with status 400(Bad Request) Response Body ({"error":"javax.script.ScriptException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:\\nScript52.groovy: 1: illegal string body character after dollar sign;\\n  solution: either escape a literal dollar sign \\\"\\\\$5\\\" or bracket the value expression \\\"${5}\\\" @ line 1, column 67.\\n  ).has('hive_process.queryText', \\\"insert \\n  ^\\n\\n1 error\\n","stackTrace":"org.apache.atlas.discovery.DiscoveryException: javax.script.ScriptException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:\nScript52.groovy: 1: illegal string body character after dollar sign;\n  solution: either escape a literal dollar sign \"\\$5\" or bracket the value expression \"${5}\" @ line 1, column 67.\n  ).has('hive_process.queryText', \"insert \n  ^\n\n1 error\n\n\tat org.apache.atlas.discovery.graph.GraphBackedDiscoveryService.searchByGremlin(GraphBackedDiscoveryService.java:175)\n\tat org.apache.atlas.GraphTransactionInterceptor.invoke(GraphTransactionInterceptor.java:41)\n\tat org.apache.atlas.web.resources.MetadataDiscoveryResource.searchUsingGremlinQuery(MetadataDiscoveryResource.java:155)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat java.lang.reflect.Method.invoke(Method.java:606)\n\tat com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)\n\tat com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)\n\tat com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)\n\tat com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)\n\tat com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)\n\tat com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)\n\tat com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)\n\tat com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)\n\tat com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)\n\tat com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)\n\tat com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)\n\tat com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)\n\tat com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409)\n\tat com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:558)\n\tat com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:733)\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:802)\n\tat com.google.inject.servlet.ServletDefinition.doServiceImpl(ServletDefinition.java:287)\n\tat com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:277)\n\tat com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:182)\n\tat com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91)\n\tat com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:85)\n\tat org.apache.atlas.web.filters.AuditFilter.doFilter(AuditFilter.java:67)\n\tat com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)\n\tat com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:119)\n\tat com.google.inject.servlet.GuiceFilter$1.call(GuiceFilter.java:133)\n\tat com.google.inject.servlet.GuiceFilter$1.call(GuiceFilter.java:130)\n\tat com.google.inject.servlet.GuiceFilter$Context.call(GuiceFilter.java:203)\n\tat com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:130)\n\tat org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)\n\tat org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)\n\tat org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)\n\tat org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)\n\tat org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)\n\tat org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)\n\tat org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)\n\tat org.mortbay.jetty.Server.handle(Server.java:326)\n\tat org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)\n\tat org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:928)\n\tat org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)\n\tat org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)\n\tat org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)\n\tat org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)\n\tat org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)\nCaused by: javax.script.ScriptException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:\nScript52.groovy: 1: illegal string body character after dollar sign;\n  solution: either escape a literal dollar sign \"\\$5\" or bracket the value expression \"${5}\" @ line 1, column 67.\n  ).has('hive_process.queryText', \"insert \n  ^\n\n1 error\n\n\tat com.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine.eval(GremlinGroovyScriptEngine.java:94)\n\tat javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:233)\n\tat org.apache.atlas.discovery.graph.GraphBackedDiscoveryService.searchByGremlin(GraphBackedDiscoveryService.java:172)\n\t... 49 more\nCaused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:\nScript52.groovy: 1: illegal string body character after dollar sign;\n  solution: either escape a literal dollar sign \"\\$5\" or bracket the value expression \"${5}\" @ line 1, column 67.\n  ).has('hive_process.queryText', \"insert \n  ^\n\n1 error\n\n\tat org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:302)\n\tat org.codehaus.groovy.control.ErrorCollector.addFatalError(ErrorCollector.java:149)\n\tat org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:119)\n\tat org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:131)\n\tat org.codehaus.groovy.control.SourceUnit.addError(SourceUnit.java:359)\n\tat org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:137)\n\tat org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:108)\n\tat org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:236)\n\tat org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:161)\n\tat org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:846)\n\tat org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:550)\n\tat org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:526)\n\tat org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:503)\n\tat groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:302)\n\tat groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:281)\n\tat groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:267)\n\tat groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:263)\n\tat com.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine.getScriptClass(GremlinGroovyScriptEngine.java:231)\n\tat com.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine.eval(GremlinGroovyScriptEngine.java:90)\n\t... 51 more\n"})) (state=08S01,code=12)
1 ACCEPTED SOLUTION

avatar
Rising Star

I received the same error when using get_json_object. Replacing the dollar sign with \044 worked. For example:

select get_json_object(jsonField,'$.subelement') from jsonTable;

Looks like Atlas is not handling '$' in hive queries correctly.

View solution in original post

1 REPLY 1

avatar
Rising Star

I received the same error when using get_json_object. Replacing the dollar sign with \044 worked. For example:

select get_json_object(jsonField,'$.subelement') from jsonTable;

Looks like Atlas is not handling '$' in hive queries correctly.