Created 02-07-2018 09:01 AM
Hi i have a data for 2015 to 2018 year i am using hive query to get the data based on below condition but i am getting meta exception
Query : select ct_code,date_code from dim_table where substr(date_code,1,4)>=2015 and substr(date_code,1,4)<=2018;
FAILED: SemanticException MetaException(message:Exception thrown when executing query)
If i give select with out where conditon: select * from dim_table it is working fine.
or when i split above query to parts based on years it also working fine.
select ct_code,date_code from dim_table where substr(date_code,1,4)>=2015 and substr(date_code,1,4)<=2017 ;
select ct_code,date_code from dim_table where substr(date_code,1,4)=2018;
But when i give only where substr(date_code,1,4)>=2015 it also not working
Can you please help me to understand that why i am getting this issue.
Created 02-27-2018 10:42 PM
Can you please provide the stack trace for the exception? It can be found in hiveserver2.log.
Created 03-01-2018 08:29 AM
Thanks @djaiswal for your response
i could not find any logs for query..at initial stage only it got failed i hope its not giving any job/Application id..while i execute from Ambari HIVE view i am getting below error and i attached completed error message
org.apache.ambari.view.hive.client.HiveInvalidQueryException: Error while compiling statement: FAILED: SemanticException MetaException(message:Exception thrown when executing query) [ERROR_STATUS] org.apache.ambari.view.hive.client.HiveInvalidQueryException: Error while compiling statement: FAILED: SemanticException MetaException(message:Exception thrown when executing query) [ERROR_STATUS] at org.apache.ambari.view.hive.client.Utils.verifySuccess(Utils.java:46) at org.apache.ambari.view.hive.client.Connection.execute(Connection.java:614) at org.apache.ambari.view.hive.client.Connection.executeAsync(Connection.java:625) at org.apache.ambari.view.hive.resources.jobs.ConnectionController.executeQuery(ConnectionController.java:67) at org.apache.ambari.view.hive.resources.jobs.viewJobs.JobControllerImpl.submit(JobControllerImpl.java:109) at org.apache.ambari.view.hive.resources.jobs.JobService.create(JobService.java:414) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60) at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205) at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75) at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302) at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:137) at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:137) at
Created 03-01-2018 09:02 AM
I guess the issue here is due to incorrect mapping between the substr return type and the value being compared. I verified similar scenario and below are the details:
hive> desc flight_details; OK flightnum string tailnum string uniquecarrier string origin string dest string Time taken: 0.295 seconds, Fetched: 5 row(s) hive> select * from flight_details where substr(tailnum,2,3)>=500 limit 10; OK 1018 N828UA UA OAK ORD 1020 N567UA UA IAD BOS 1020 N561UA UA IAD BOS 1020 N554UA UA IAD BOS 1020 N535UA UA IAD BOS 1020 N571UA UA IAD BOS 1020 N530UA UA IAD BOS 1020 N553UA UA IAD BOS 1020 N525UA UA IAD BOS 1020 N585UA UA IAD BOS