TID: [-1234] [] [2018-01-29 11:18:08,616] ERROR {org.wso2.carbon.analytics.spark.core.CarbonAnalyticsProcessorService} -  Error while executing query :     INSERT INTO TABLE APIMGT_PERDAY_REQUEST_DATA SELECT year, month, day, consumerKey, context, api_version, first(api), first(version), max(maxRequestTime), first(firstRequestTime), userId, hostName,    apiPublisher, sum(total_request_count_per_hour), resourceTemplate, method, applicationName, tenantDomain,    userAgent, first(resourcePath), request, applicationId, tier, first(throttledOut), clientIp, applicationOwner    FROM APIMGT_PERHOUR_REQUEST_DATA    GROUP BY year, month, day, consumerKey, context, api_version, userId, hostName, apiPublisher, resourceTemplate, method, userAgent, clientIp,    applicationName, tenantDomain,  request, applicationId, tier, applicationOwner {org.wso2.carbon.analytics.spark.core.CarbonAnalyticsProcessorService}
org.wso2.carbon.analytics.spark.core.exception.AnalyticsExecutionException: Exception in executing query INSERT INTO TABLE APIMGT_PERDAY_REQUEST_DATA SELECT year, month, day, consumerKey, context, api_version, first(api), first(version), max(maxRequestTime), first(firstRequestTime), userId, hostName,    apiPublisher, sum(total_request_count_per_hour), resourceTemplate, method, applicationName, tenantDomain,    userAgent, first(resourcePath), request, applicationId, tier, first(throttledOut), clientIp, applicationOwner    FROM APIMGT_PERHOUR_REQUEST_DATA    GROUP BY year, month, day, consumerKey, context, api_version, userId, hostName, apiPublisher, resourceTemplate, method, userAgent, clientIp,    applicationName, tenantDomain,  request, applicationId, tier, applicationOwner
	at org.wso2.carbon.analytics.spark.core.internal.SparkAnalyticsExecutor.executeQueryLocal(SparkAnalyticsExecutor.java:918)
	at org.wso2.carbon.analytics.spark.core.internal.SparkAnalyticsExecutor.executeQuery(SparkAnalyticsExecutor.java:875)
	at org.wso2.carbon.analytics.spark.core.CarbonAnalyticsProcessorService.executeQuery(CarbonAnalyticsProcessorService.java:201)
	at org.wso2.carbon.analytics.spark.core.CarbonAnalyticsProcessorService.executeScript(CarbonAnalyticsProcessorService.java:151)
	at org.wso2.carbon.analytics.spark.core.AnalyticsTask.execute(AnalyticsTask.java:60)
	at org.wso2.carbon.ntask.core.impl.TaskQuartzJobAdapter.execute(TaskQuartzJobAdapter.java:67)
	at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.spark.sql.catalyst.errors.package$TreeNodeException: execute, tree:
SortBasedAggregate(key=[year#28,month#29,day#30,consumerKey#32,context#33,api_version#34,userId#39,hostName#40,apiPublisher#41,resourceTemplate#43,method#44,userAgent#47,clientIp#53,applicationName#45,tenantDomain#46,request#49,applicationId#50,tier#51,applicationOwner#54], functions=[(first(api#35)(),mode=Final,isDistinct=false),(first(version#36)(),mode=Final,isDistinct=false),(max(maxRequestTime#37L),mode=Final,isDistinct=false),(first(firstRequestTime#38L)(),mode=Final,isDistinct=false),(sum(total_request_count_per_hour#42L),mode=Final,isDistinct=false),(first(resourcePath#48)(),mode=Final,isDistinct=false),(first(throttledOut#52)(),mode=Final,isDistinct=false)], output=[year#28,month#29,day#30,consumerKey#32,context#33,api_version#34,_c6#157,_c7#158,_c8#159L,_c9#160L,userId#39,hostName#40,apiPublisher#41,_c13#161L,resourceTemplate#43,method#44,applicationName#45,tenantDomain#46,userAgent#47,_c19#162,request#49,applicationId#50,tier#51,_c23#163,clientIp#53,applicationOwner#54])
+- ConvertToSafe
   +- Sort [year#28 ASC,month#29 ASC,day#30 ASC,consumerKey#32 ASC,context#33 ASC,api_version#34 ASC,userId#39 ASC,hostName#40 ASC,apiPublisher#41 ASC,resourceTemplate#43 ASC,method#44 ASC,userAgent#47 ASC,clientIp#53 ASC,applicationName#45 ASC,tenantDomain#46 ASC,request#49 ASC,applicationId#50 ASC,tier#51 ASC,applicationOwner#54 ASC], false, 0
      +- TungstenExchange hashpartitioning(year#28,month#29,day#30,consumerKey#32,context#33,api_version#34,userId#39,hostName#40,apiPublisher#41,resourceTemplate#43,method#44,userAgent#47,clientIp#53,applicationName#45,tenantDomain#46,request#49,applicationId#50,tier#51,applicationOwner#54,200), None
         +- ConvertToUnsafe
            +- SortBasedAggregate(key=[year#28,month#29,day#30,consumerKey#32,context#33,api_version#34,userId#39,hostName#40,apiPublisher#41,resourceTemplate#43,method#44,userAgent#47,clientIp#53,applicationName#45,tenantDomain#46,request#49,applicationId#50,tier#51,applicationOwner#54], functions=[(first(api#35)(),mode=Partial,isDistinct=false),(first(version#36)(),mode=Partial,isDistinct=false),(max(maxRequestTime#37L),mode=Partial,isDistinct=false),(first(firstRequestTime#38L)(),mode=Partial,isDistinct=false),(sum(total_request_count_per_hour#42L),mode=Partial,isDistinct=false),(first(resourcePath#48)(),mode=Partial,isDistinct=false),(first(throttledOut#52)(),mode=Partial,isDistinct=false)], output=[year#28,month#29,day#30,consumerKey#32,context#33,api_version#34,userId#39,hostName#40,apiPublisher#41,resourceTemplate#43,method#44,userAgent#47,clientIp#53,applicationName#45,tenantDomain#46,request#49,applicationId#50,tier#51,applicationOwner#54,first#190,valueSet#191,first#192,valueSet#193,max#194L,first#195L,valueSet#196,sum#197L,first#198,valueSet#199,first#200,valueSet#201])
               +- ConvertToSafe
                  +- Sort [year#28 ASC,month#29 ASC,day#30 ASC,consumerKey#32 ASC,context#33 ASC,api_version#34 ASC,userId#39 ASC,hostName#40 ASC,apiPublisher#41 ASC,resourceTemplate#43 ASC,method#44 ASC,userAgent#47 ASC,clientIp#53 ASC,applicationName#45 ASC,tenantDomain#46 ASC,request#49 ASC,applicationId#50 ASC,tier#51 ASC,applicationOwner#54 ASC], false, 0
                     +- Project [resourcePath#48,tenantDomain#46,context#33,apiPublisher#41,year#28,throttledOut#52,applicationName#45,resourceTemplate#43,method#44,api_version#34,userAgent#47,hostName#40,total_request_count_per_hour#42L,applicationId#50,applicationOwner#54,day#30,tier#51,maxRequestTime#37L,firstRequestTime#38L,month#29,api#35,consumerKey#32,version#36,request#49,clientIp#53,userId#39]
                        +- Scan org.wso2.carbon.analytics.spark.core.sources.AnalyticsRelation@72da309d[year#28,month#29,day#30,hour#31,consumerKey#32,context#33,api_version#34,api#35,version#36,maxRequestTime#37L,firstRequestTime#38L,userId#39,hostName#40,apiPublisher#41,total_request_count_per_hour#42L,resourceTemplate#43,method#44,applicationName#45,tenantDomain#46,userAgent#47,resourcePath#48,request#49,applicationId#50,tier#51,throttledOut#52,clientIp#53,applicationOwner#54,_timestamp#55L]

	at org.apache.spark.sql.catalyst.errors.package$.attachTree(package.scala:49)
	at org.apache.spark.sql.execution.aggregate.SortBasedAggregate.doExecute(SortBasedAggregate.scala:69)
	at org.apache.spark.sql.execution.SparkPlan$$anonfun$execute$5.apply(SparkPlan.scala:132)
	at org.apache.spark.sql.execution.SparkPlan$$anonfun$execute$5.apply(SparkPlan.scala:130)
	at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:150)
	at org.apache.spark.sql.execution.SparkPlan.execute(SparkPlan.scala:130)
	at org.apache.spark.sql.execution.Project.doExecute(basicOperators.scala:46)
	at org.apache.spark.sql.execution.SparkPlan$$anonfun$execute$5.apply(SparkPlan.scala:132)
	at org.apache.spark.sql.execution.SparkPlan$$anonfun$execute$5.apply(SparkPlan.scala:130)
	at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:150)
	at org.apache.spark.sql.execution.SparkPlan.execute(SparkPlan.scala:130)
	at org.apache.spark.sql.execution.QueryExecution.toRdd$lzycompute(QueryExecution.scala:55)
	at org.apache.spark.sql.execution.QueryExecution.toRdd(QueryExecution.scala:55)
	at org.apache.spark.sql.execution.datasources.InsertIntoDataSource.run(InsertIntoDataSource.scala:39)
	at org.apache.spark.sql.execution.ExecutedCommand.sideEffectResult$lzycompute(commands.scala:58)
	at org.apache.spark.sql.execution.ExecutedCommand.sideEffectResult(commands.scala:56)
	at org.apache.spark.sql.execution.ExecutedCommand.doExecute(commands.scala:70)
	at org.apache.spark.sql.execution.SparkPlan$$anonfun$execute$5.apply(SparkPlan.scala:132)
	at org.apache.spark.sql.execution.SparkPlan$$anonfun$execute$5.apply(SparkPlan.scala:130)
	at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:150)
	at org.apache.spark.sql.execution.SparkPlan.execute(SparkPlan.scala:130)
	at org.apache.spark.sql.execution.QueryExecution.toRdd$lzycompute(QueryExecution.scala:55)
	at org.apache.spark.sql.execution.QueryExecution.toRdd(QueryExecution.scala:55)
	at org.apache.spark.sql.DataFrame.<init>(DataFrame.scala:145)
	at org.apache.spark.sql.DataFrame.<init>(DataFrame.scala:130)
	at org.apache.spark.sql.DataFrame$.apply(DataFrame.scala:52)
	at org.apache.spark.sql.SQLContext.sql(SQLContext.scala:817)
	at org.wso2.carbon.analytics.spark.core.internal.SparkAnalyticsExecutor.executeQueryLocal(SparkAnalyticsExecutor.java:914)
	... 11 more
Caused by: org.apache.spark.sql.catalyst.errors.package$TreeNodeException: execute, tree:
TungstenExchange hashpartitioning(year#28,month#29,day#30,consumerKey#32,context#33,api_version#34,userId#39,hostName#40,apiPublisher#41,resourceTemplate#43,method#44,userAgent#47,clientIp#53,applicationName#45,tenantDomain#46,request#49,applicationId#50,tier#51,applicationOwner#54,200), None
+- ConvertToUnsafe
   +- SortBasedAggregate(key=[year#28,month#29,day#30,consumerKey#32,context#33,api_version#34,userId#39,hostName#40,apiPublisher#41,resourceTemplate#43,method#44,userAgent#47,clientIp#53,applicationName#45,tenantDomain#46,request#49,applicationId#50,tier#51,applicationOwner#54], functions=[(first(api#35)(),mode=Partial,isDistinct=false),(first(version#36)(),mode=Partial,isDistinct=false),(max(maxRequestTime#37L),mode=Partial,isDistinct=false),(first(firstRequestTime#38L)(),mode=Partial,isDistinct=false),(sum(total_request_count_per_hour#42L),mode=Partial,isDistinct=false),(first(resourcePath#48)(),mode=Partial,isDistinct=false),(first(throttledOut#52)(),mode=Partial,isDistinct=false)], output=[year#28,month#29,day#30,consumerKey#32,context#33,api_version#34,userId#39,hostName#40,apiPublisher#41,resourceTemplate#43,method#44,userAgent#47,clientIp#53,applicationName#45,tenantDomain#46,request#49,applicationId#50,tier#51,applicationOwner#54,first#190,valueSet#191,first#192,valueSet#193,max#194L,first#195L,valueSet#196,sum#197L,first#198,valueSet#199,first#200,valueSet#201])
      +- ConvertToSafe
         +- Sort [year#28 ASC,month#29 ASC,day#30 ASC,consumerKey#32 ASC,context#33 ASC,api_version#34 ASC,userId#39 ASC,hostName#40 ASC,apiPublisher#41 ASC,resourceTemplate#43 ASC,method#44 ASC,userAgent#47 ASC,clientIp#53 ASC,applicationName#45 ASC,tenantDomain#46 ASC,request#49 ASC,applicationId#50 ASC,tier#51 ASC,applicationOwner#54 ASC], false, 0
            +- Project [resourcePath#48,tenantDomain#46,context#33,apiPublisher#41,year#28,throttledOut#52,applicationName#45,resourceTemplate#43,method#44,api_version#34,userAgent#47,hostName#40,total_request_count_per_hour#42L,applicationId#50,applicationOwner#54,day#30,tier#51,maxRequestTime#37L,firstRequestTime#38L,month#29,api#35,consumerKey#32,version#36,request#49,clientIp#53,userId#39]
               +- Scan org.wso2.carbon.analytics.spark.core.sources.AnalyticsRelation@72da309d[year#28,month#29,day#30,hour#31,consumerKey#32,context#33,api_version#34,api#35,version#36,maxRequestTime#37L,firstRequestTime#38L,userId#39,hostName#40,apiPublisher#41,total_request_count_per_hour#42L,resourceTemplate#43,method#44,applicationName#45,tenantDomain#46,userAgent#47,resourcePath#48,request#49,applicationId#50,tier#51,throttledOut#52,clientIp#53,applicationOwner#54,_timestamp#55L]

	at org.apache.spark.sql.catalyst.errors.package$.attachTree(package.scala:49)
	at org.apache.spark.sql.execution.Exchange.doExecute(Exchange.scala:247)
	at org.apache.spark.sql.execution.SparkPlan$$anonfun$execute$5.apply(SparkPlan.scala:132)
	at org.apache.spark.sql.execution.SparkPlan$$anonfun$execute$5.apply(SparkPlan.scala:130)
	at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:150)
	at org.apache.spark.sql.execution.SparkPlan.execute(SparkPlan.scala:130)
	at org.apache.spark.sql.execution.Sort.doExecute(Sort.scala:64)
	at org.apache.spark.sql.execution.SparkPlan$$anonfun$execute$5.apply(SparkPlan.scala:132)
	at org.apache.spark.sql.execution.SparkPlan$$anonfun$execute$5.apply(SparkPlan.scala:130)
	at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:150)
	at org.apache.spark.sql.execution.SparkPlan.execute(SparkPlan.scala:130)
	at org.apache.spark.sql.execution.ConvertToSafe.doExecute(rowFormatConverters.scala:56)
	at org.apache.spark.sql.execution.SparkPlan$$anonfun$execute$5.apply(SparkPlan.scala:132)
	at org.apache.spark.sql.execution.SparkPlan$$anonfun$execute$5.apply(SparkPlan.scala:130)
	at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:150)
	at org.apache.spark.sql.execution.SparkPlan.execute(SparkPlan.scala:130)
	at org.apache.spark.sql.execution.aggregate.SortBasedAggregate$$anonfun$doExecute$1.apply(SortBasedAggregate.scala:72)
	at org.apache.spark.sql.execution.aggregate.SortBasedAggregate$$anonfun$doExecute$1.apply(SortBasedAggregate.scala:69)
	at org.apache.spark.sql.catalyst.errors.package$.attachTree(package.scala:48)
	... 38 more
Caused by: java.lang.RuntimeException: [-1234:ORG_WSO2_APIMGT_STATISTICS_PERHOURREQUEST] does not exist
	at org.wso2.carbon.analytics.spark.core.rdd.AnalyticsRDD.getPartitions(AnalyticsRDD.java:122)
	at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:239)
	at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:237)
	at scala.Option.getOrElse(Option.scala:120)
	at org.apache.spark.rdd.RDD.partitions(RDD.scala:237)
	at org.apache.spark.rdd.MapPartitionsRDD.getPartitions(MapPartitionsRDD.scala:35)
	at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:239)
	at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:237)
	at scala.Option.getOrElse(Option.scala:120)
	at org.apache.spark.rdd.RDD.partitions(RDD.scala:237)
	at org.apache.spark.rdd.MapPartitionsRDD.getPartitions(MapPartitionsRDD.scala:35)
	at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:239)
	at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:237)
	at scala.Option.getOrElse(Option.scala:120)
	at org.apache.spark.rdd.RDD.partitions(RDD.scala:237)
	at org.apache.spark.rdd.MapPartitionsRDD.getPartitions(MapPartitionsRDD.scala:35)
	at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:239)
	at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:237)
	at scala.Option.getOrElse(Option.scala:120)
	at org.apache.spark.rdd.RDD.partitions(RDD.scala:237)
	at org.apache.spark.rdd.MapPartitionsRDD.getPartitions(MapPartitionsRDD.scala:35)
	at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:239)
	at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:237)
	at scala.Option.getOrElse(Option.scala:120)
	at org.apache.spark.rdd.RDD.partitions(RDD.scala:237)
	at org.apache.spark.rdd.MapPartitionsRDD.getPartitions(MapPartitionsRDD.scala:35)
	at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:239)
	at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:237)
	at scala.Option.getOrElse(Option.scala:120)
	at org.apache.spark.rdd.RDD.partitions(RDD.scala:237)
	at org.apache.spark.rdd.MapPartitionsRDD.getPartitions(MapPartitionsRDD.scala:35)
	at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:239)
	at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:237)
	at scala.Option.getOrElse(Option.scala:120)
	at org.apache.spark.rdd.RDD.partitions(RDD.scala:237)
	at org.apache.spark.rdd.MapPartitionsRDD.getPartitions(MapPartitionsRDD.scala:35)
	at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:239)
	at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:237)
	at scala.Option.getOrElse(Option.scala:120)
	at org.apache.spark.rdd.RDD.partitions(RDD.scala:237)
	at org.apache.spark.ShuffleDependency.<init>(Dependency.scala:91)
	at org.apache.spark.sql.execution.Exchange.prepareShuffleDependency(Exchange.scala:220)
	at org.apache.spark.sql.execution.Exchange$$anonfun$doExecute$1.apply(Exchange.scala:254)
	at org.apache.spark.sql.execution.Exchange$$anonfun$doExecute$1.apply(Exchange.scala:248)
	at org.apache.spark.sql.catalyst.errors.package$.attachTree(package.scala:48)
	... 56 more
Caused by: org.wso2.carbon.analytics.datasource.commons.exception.AnalyticsTableNotAvailableException: [-1234:ORG_WSO2_APIMGT_STATISTICS_PERHOURREQUEST] does not exist
	at org.wso2.carbon.analytics.datasource.rdbms.RDBMSAnalyticsRecordStore.get(RDBMSAnalyticsRecordStore.java:420)
	at org.wso2.carbon.analytics.dataservice.core.AnalyticsDataServiceImpl.getByRange(AnalyticsDataServiceImpl.java:961)
	at org.wso2.carbon.analytics.dataservice.core.AnalyticsDataServiceImpl.get(AnalyticsDataServiceImpl.java:910)
	at org.wso2.carbon.analytics.spark.core.rdd.AnalyticsRDD.getPartitions(AnalyticsRDD.java:119)
	... 100 more
TID: [-1234] [] [2018-01-29 11:18:08,650] ERROR {org.wso2.carbon.analytics.spark.core.AnalyticsTask} -  Error while executing the scheduled task for the script: APIM_INCREMENTAL_PROCESSING_SCRIPT {org.wso2.carbon.analytics.spark.core.AnalyticsTask}
org.wso2.carbon.analytics.spark.core.exception.AnalyticsExecutionException: Exception in executing query INSERT INTO TABLE APIMGT_PERDAY_REQUEST_DATA SELECT year, month, day, consumerKey, context, api_version, first(api), first(version), max(maxRequestTime), first(firstRequestTime), userId, hostName,    apiPublisher, sum(total_request_count_per_hour), resourceTemplate, method, applicationName, tenantDomain,    userAgent, first(resourcePath), request, applicationId, tier, first(throttledOut), clientIp, applicationOwner    FROM APIMGT_PERHOUR_REQUEST_DATA    GROUP BY year, month, day, consumerKey, context, api_version, userId, hostName, apiPublisher, resourceTemplate, method, userAgent, clientIp,    applicationName, tenantDomain,  request, applicationId, tier, applicationOwner
	at org.wso2.carbon.analytics.spark.core.internal.SparkAnalyticsExecutor.executeQueryLocal(SparkAnalyticsExecutor.java:918)
	at org.wso2.carbon.analytics.spark.core.internal.SparkAnalyticsExecutor.executeQuery(SparkAnalyticsExecutor.java:875)
	at org.wso2.carbon.analytics.spark.core.CarbonAnalyticsProcessorService.executeQuery(CarbonAnalyticsProcessorService.java:201)
	at org.wso2.carbon.analytics.spark.core.CarbonAnalyticsProcessorService.executeScript(CarbonAnalyticsProcessorService.java:151)
	at org.wso2.carbon.analytics.spark.core.AnalyticsTask.execute(AnalyticsTask.java:60)
	at org.wso2.carbon.ntask.core.impl.TaskQuartzJobAdapter.execute(TaskQuartzJobAdapter.java:67)
	at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.spark.sql.catalyst.errors.package$TreeNodeException: execute, tree:
SortBasedAggregate(key=[year#28,month#29,day#30,consumerKey#32,context#33,api_version#34,userId#39,hostName#40,apiPublisher#41,resourceTemplate#43,method#44,userAgent#47,clientIp#53,applicationName#45,tenantDomain#46,request#49,applicationId#50,tier#51,applicationOwner#54], functions=[(first(api#35)(),mode=Final,isDistinct=false),(first(version#36)(),mode=Final,isDistinct=false),(max(maxRequestTime#37L),mode=Final,isDistinct=false),(first(firstRequestTime#38L)(),mode=Final,isDistinct=false),(sum(total_request_count_per_hour#42L),mode=Final,isDistinct=false),(first(resourcePath#48)(),mode=Final,isDistinct=false),(first(throttledOut#52)(),mode=Final,isDistinct=false)], output=[year#28,month#29,day#30,consumerKey#32,context#33,api_version#34,_c6#157,_c7#158,_c8#159L,_c9#160L,userId#39,hostName#40,apiPublisher#41,_c13#161L,resourceTemplate#43,method#44,applicationName#45,tenantDomain#46,userAgent#47,_c19#162,request#49,applicationId#50,tier#51,_c23#163,clientIp#53,applicationOwner#54])
+- ConvertToSafe
   +- Sort [year#28 ASC,month#29 ASC,day#30 ASC,consumerKey#32 ASC,context#33 ASC,api_version#34 ASC,userId#39 ASC,hostName#40 ASC,apiPublisher#41 ASC,resourceTemplate#43 ASC,method#44 ASC,userAgent#47 ASC,clientIp#53 ASC,applicationName#45 ASC,tenantDomain#46 ASC,request#49 ASC,applicationId#50 ASC,tier#51 ASC,applicationOwner#54 ASC], false, 0
      +- TungstenExchange hashpartitioning(year#28,month#29,day#30,consumerKey#32,context#33,api_version#34,userId#39,hostName#40,apiPublisher#41,resourceTemplate#43,method#44,userAgent#47,clientIp#53,applicationName#45,tenantDomain#46,request#49,applicationId#50,tier#51,applicationOwner#54,200), None
         +- ConvertToUnsafe
            +- SortBasedAggregate(key=[year#28,month#29,day#30,consumerKey#32,context#33,api_version#34,userId#39,hostName#40,apiPublisher#41,resourceTemplate#43,method#44,userAgent#47,clientIp#53,applicationName#45,tenantDomain#46,request#49,applicationId#50,tier#51,applicationOwner#54], functions=[(first(api#35)(),mode=Partial,isDistinct=false),(first(version#36)(),mode=Partial,isDistinct=false),(max(maxRequestTime#37L),mode=Partial,isDistinct=false),(first(firstRequestTime#38L)(),mode=Partial,isDistinct=false),(sum(total_request_count_per_hour#42L),mode=Partial,isDistinct=false),(first(resourcePath#48)(),mode=Partial,isDistinct=false),(first(throttledOut#52)(),mode=Partial,isDistinct=false)], output=[year#28,month#29,day#30,consumerKey#32,context#33,api_version#34,userId#39,hostName#40,apiPublisher#41,resourceTemplate#43,method#44,userAgent#47,clientIp#53,applicationName#45,tenantDomain#46,request#49,applicationId#50,tier#51,applicationOwner#54,first#190,valueSet#191,first#192,valueSet#193,max#194L,first#195L,valueSet#196,sum#197L,first#198,valueSet#199,first#200,valueSet#201])
               +- ConvertToSafe
                  +- Sort [year#28 ASC,month#29 ASC,day#30 ASC,consumerKey#32 ASC,context#33 ASC,api_version#34 ASC,userId#39 ASC,hostName#40 ASC,apiPublisher#41 ASC,resourceTemplate#43 ASC,method#44 ASC,userAgent#47 ASC,clientIp#53 ASC,applicationName#45 ASC,tenantDomain#46 ASC,request#49 ASC,applicationId#50 ASC,tier#51 ASC,applicationOwner#54 ASC], false, 0
                     +- Project [resourcePath#48,tenantDomain#46,context#33,apiPublisher#41,year#28,throttledOut#52,applicationName#45,resourceTemplate#43,method#44,api_version#34,userAgent#47,hostName#40,total_request_count_per_hour#42L,applicationId#50,applicationOwner#54,day#30,tier#51,maxRequestTime#37L,firstRequestTime#38L,month#29,api#35,consumerKey#32,version#36,request#49,clientIp#53,userId#39]
                        +- Scan org.wso2.carbon.analytics.spark.core.sources.AnalyticsRelation@72da309d[year#28,month#29,day#30,hour#31,consumerKey#32,context#33,api_version#34,api#35,version#36,maxRequestTime#37L,firstRequestTime#38L,userId#39,hostName#40,apiPublisher#41,total_request_count_per_hour#42L,resourceTemplate#43,method#44,applicationName#45,tenantDomain#46,userAgent#47,resourcePath#48,request#49,applicationId#50,tier#51,throttledOut#52,clientIp#53,applicationOwner#54,_timestamp#55L]

	at org.apache.spark.sql.catalyst.errors.package$.attachTree(package.scala:49)
	at org.apache.spark.sql.execution.aggregate.SortBasedAggregate.doExecute(SortBasedAggregate.scala:69)
	at org.apache.spark.sql.execution.SparkPlan$$anonfun$execute$5.apply(SparkPlan.scala:132)
	at org.apache.spark.sql.execution.SparkPlan$$anonfun$execute$5.apply(SparkPlan.scala:130)
	at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:150)
	at org.apache.spark.sql.execution.SparkPlan.execute(SparkPlan.scala:130)
	at org.apache.spark.sql.execution.Project.doExecute(basicOperators.scala:46)
	at org.apache.spark.sql.execution.SparkPlan$$anonfun$execute$5.apply(SparkPlan.scala:132)
	at org.apache.spark.sql.execution.SparkPlan$$anonfun$execute$5.apply(SparkPlan.scala:130)
	at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:150)
	at org.apache.spark.sql.execution.SparkPlan.execute(SparkPlan.scala:130)
	at org.apache.spark.sql.execution.QueryExecution.toRdd$lzycompute(QueryExecution.scala:55)
	at org.apache.spark.sql.execution.QueryExecution.toRdd(QueryExecution.scala:55)
	at org.apache.spark.sql.execution.datasources.InsertIntoDataSource.run(InsertIntoDataSource.scala:39)
	at org.apache.spark.sql.execution.ExecutedCommand.sideEffectResult$lzycompute(commands.scala:58)
	at org.apache.spark.sql.execution.ExecutedCommand.sideEffectResult(commands.scala:56)
	at org.apache.spark.sql.execution.ExecutedCommand.doExecute(commands.scala:70)
	at org.apache.spark.sql.execution.SparkPlan$$anonfun$execute$5.apply(SparkPlan.scala:132)
	at org.apache.spark.sql.execution.SparkPlan$$anonfun$execute$5.apply(SparkPlan.scala:130)
	at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:150)
	at org.apache.spark.sql.execution.SparkPlan.execute(SparkPlan.scala:130)
	at org.apache.spark.sql.execution.QueryExecution.toRdd$lzycompute(QueryExecution.scala:55)
	at org.apache.spark.sql.execution.QueryExecution.toRdd(QueryExecution.scala:55)
	at org.apache.spark.sql.DataFrame.<init>(DataFrame.scala:145)
	at org.apache.spark.sql.DataFrame.<init>(DataFrame.scala:130)
	at org.apache.spark.sql.DataFrame$.apply(DataFrame.scala:52)
	at org.apache.spark.sql.SQLContext.sql(SQLContext.scala:817)
	at org.wso2.carbon.analytics.spark.core.internal.SparkAnalyticsExecutor.executeQueryLocal(SparkAnalyticsExecutor.java:914)
	... 11 more
Caused by: org.apache.spark.sql.catalyst.errors.package$TreeNodeException: execute, tree:
TungstenExchange hashpartitioning(year#28,month#29,day#30,consumerKey#32,context#33,api_version#34,userId#39,hostName#40,apiPublisher#41,resourceTemplate#43,method#44,userAgent#47,clientIp#53,applicationName#45,tenantDomain#46,request#49,applicationId#50,tier#51,applicationOwner#54,200), None
+- ConvertToUnsafe
   +- SortBasedAggregate(key=[year#28,month#29,day#30,consumerKey#32,context#33,api_version#34,userId#39,hostName#40,apiPublisher#41,resourceTemplate#43,method#44,userAgent#47,clientIp#53,applicationName#45,tenantDomain#46,request#49,applicationId#50,tier#51,applicationOwner#54], functions=[(first(api#35)(),mode=Partial,isDistinct=false),(first(version#36)(),mode=Partial,isDistinct=false),(max(maxRequestTime#37L),mode=Partial,isDistinct=false),(first(firstRequestTime#38L)(),mode=Partial,isDistinct=false),(sum(total_request_count_per_hour#42L),mode=Partial,isDistinct=false),(first(resourcePath#48)(),mode=Partial,isDistinct=false),(first(throttledOut#52)(),mode=Partial,isDistinct=false)], output=[year#28,month#29,day#30,consumerKey#32,context#33,api_version#34,userId#39,hostName#40,apiPublisher#41,resourceTemplate#43,method#44,userAgent#47,clientIp#53,applicationName#45,tenantDomain#46,request#49,applicationId#50,tier#51,applicationOwner#54,first#190,valueSet#191,first#192,valueSet#193,max#194L,first#195L,valueSet#196,sum#197L,first#198,valueSet#199,first#200,valueSet#201])
      +- ConvertToSafe
         +- Sort [year#28 ASC,month#29 ASC,day#30 ASC,consumerKey#32 ASC,context#33 ASC,api_version#34 ASC,userId#39 ASC,hostName#40 ASC,apiPublisher#41 ASC,resourceTemplate#43 ASC,method#44 ASC,userAgent#47 ASC,clientIp#53 ASC,applicationName#45 ASC,tenantDomain#46 ASC,request#49 ASC,applicationId#50 ASC,tier#51 ASC,applicationOwner#54 ASC], false, 0
            +- Project [resourcePath#48,tenantDomain#46,context#33,apiPublisher#41,year#28,throttledOut#52,applicationName#45,resourceTemplate#43,method#44,api_version#34,userAgent#47,hostName#40,total_request_count_per_hour#42L,applicationId#50,applicationOwner#54,day#30,tier#51,maxRequestTime#37L,firstRequestTime#38L,month#29,api#35,consumerKey#32,version#36,request#49,clientIp#53,userId#39]
               +- Scan org.wso2.carbon.analytics.spark.core.sources.AnalyticsRelation@72da309d[year#28,month#29,day#30,hour#31,consumerKey#32,context#33,api_version#34,api#35,version#36,maxRequestTime#37L,firstRequestTime#38L,userId#39,hostName#40,apiPublisher#41,total_request_count_per_hour#42L,resourceTemplate#43,method#44,applicationName#45,tenantDomain#46,userAgent#47,resourcePath#48,request#49,applicationId#50,tier#51,throttledOut#52,clientIp#53,applicationOwner#54,_timestamp#55L]

	at org.apache.spark.sql.catalyst.errors.package$.attachTree(package.scala:49)
	at org.apache.spark.sql.execution.Exchange.doExecute(Exchange.scala:247)
	at org.apache.spark.sql.execution.SparkPlan$$anonfun$execute$5.apply(SparkPlan.scala:132)
	at org.apache.spark.sql.execution.SparkPlan$$anonfun$execute$5.apply(SparkPlan.scala:130)
	at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:150)
	at org.apache.spark.sql.execution.SparkPlan.execute(SparkPlan.scala:130)
	at org.apache.spark.sql.execution.Sort.doExecute(Sort.scala:64)
	at org.apache.spark.sql.execution.SparkPlan$$anonfun$execute$5.apply(SparkPlan.scala:132)
	at org.apache.spark.sql.execution.SparkPlan$$anonfun$execute$5.apply(SparkPlan.scala:130)
	at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:150)
	at org.apache.spark.sql.execution.SparkPlan.execute(SparkPlan.scala:130)
	at org.apache.spark.sql.execution.ConvertToSafe.doExecute(rowFormatConverters.scala:56)
	at org.apache.spark.sql.execution.SparkPlan$$anonfun$execute$5.apply(SparkPlan.scala:132)
	at org.apache.spark.sql.execution.SparkPlan$$anonfun$execute$5.apply(SparkPlan.scala:130)
	at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:150)
	at org.apache.spark.sql.execution.SparkPlan.execute(SparkPlan.scala:130)
	at org.apache.spark.sql.execution.aggregate.SortBasedAggregate$$anonfun$doExecute$1.apply(SortBasedAggregate.scala:72)
	at org.apache.spark.sql.execution.aggregate.SortBasedAggregate$$anonfun$doExecute$1.apply(SortBasedAggregate.scala:69)
	at org.apache.spark.sql.catalyst.errors.package$.attachTree(package.scala:48)
	... 38 more
Caused by: java.lang.RuntimeException: [-1234:ORG_WSO2_APIMGT_STATISTICS_PERHOURREQUEST] does not exist
	at org.wso2.carbon.analytics.spark.core.rdd.AnalyticsRDD.getPartitions(AnalyticsRDD.java:122)
	at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:239)
	at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:237)
	at scala.Option.getOrElse(Option.scala:120)
	at org.apache.spark.rdd.RDD.partitions(RDD.scala:237)
	at org.apache.spark.rdd.MapPartitionsRDD.getPartitions(MapPartitionsRDD.scala:35)
	at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:239)
	at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:237)
	at scala.Option.getOrElse(Option.scala:120)
	at org.apache.spark.rdd.RDD.partitions(RDD.scala:237)
	at org.apache.spark.rdd.MapPartitionsRDD.getPartitions(MapPartitionsRDD.scala:35)
	at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:239)
	at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:237)
	at scala.Option.getOrElse(Option.scala:120)
	at org.apache.spark.rdd.RDD.partitions(RDD.scala:237)
	at org.apache.spark.rdd.MapPartitionsRDD.getPartitions(MapPartitionsRDD.scala:35)
	at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:239)
	at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:237)
	at scala.Option.getOrElse(Option.scala:120)
	at org.apache.spark.rdd.RDD.partitions(RDD.scala:237)
	at org.apache.spark.rdd.MapPartitionsRDD.getPartitions(MapPartitionsRDD.scala:35)
	at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:239)
	at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:237)
	at scala.Option.getOrElse(Option.scala:120)
	at org.apache.spark.rdd.RDD.partitions(RDD.scala:237)
	at org.apache.spark.rdd.MapPartitionsRDD.getPartitions(MapPartitionsRDD.scala:35)
	at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:239)
	at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:237)
	at scala.Option.getOrElse(Option.scala:120)
	at org.apache.spark.rdd.RDD.partitions(RDD.scala:237)
	at org.apache.spark.rdd.MapPartitionsRDD.getPartitions(MapPartitionsRDD.scala:35)
	at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:239)
	at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:237)
	at scala.Option.getOrElse(Option.scala:120)
	at org.apache.spark.rdd.RDD.partitions(RDD.scala:237)
	at org.apache.spark.rdd.MapPartitionsRDD.getPartitions(MapPartitionsRDD.scala:35)
	at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:239)
	at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:237)
	at scala.Option.getOrElse(Option.scala:120)
	at org.apache.spark.rdd.RDD.partitions(RDD.scala:237)
	at org.apache.spark.ShuffleDependency.<init>(Dependency.scala:91)
	at org.apache.spark.sql.execution.Exchange.prepareShuffleDependency(Exchange.scala:220)
	at org.apache.spark.sql.execution.Exchange$$anonfun$doExecute$1.apply(Exchange.scala:254)
	at org.apache.spark.sql.execution.Exchange$$anonfun$doExecute$1.apply(Exchange.scala:248)
	at org.apache.spark.sql.catalyst.errors.package$.attachTree(package.scala:48)
	... 56 more
Caused by: org.wso2.carbon.analytics.datasource.commons.exception.AnalyticsTableNotAvailableException: [-1234:ORG_WSO2_APIMGT_STATISTICS_PERHOURREQUEST] does not exist
	at org.wso2.carbon.analytics.datasource.rdbms.RDBMSAnalyticsRecordStore.get(RDBMSAnalyticsRecordStore.java:420)
	at org.wso2.carbon.analytics.dataservice.core.AnalyticsDataServiceImpl.getByRange(AnalyticsDataServiceImpl.java:961)
	at org.wso2.carbon.analytics.dataservice.core.AnalyticsDataServiceImpl.get(AnalyticsDataServiceImpl.java:910)
	at org.wso2.carbon.analytics.spark.core.rdd.AnalyticsRDD.getPartitions(AnalyticsRDD.java:119)
	... 100 more