spark sql运行sql时报错
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了spark sql运行sql时报错相关的知识,希望对你有一定的参考价值。
运行这段(nvl(pc.piglet_cost,0)+nvl(pc.p_piglet_cost,0)
+nvl(pc.e_piglet_cost,0)+nvl(pc.feed_cost,0)+nvl(pc.p_feed_cost,0)
+nvl(pc.e_feed_cost,0)+nvl(pc.drug_vaccine_cost,0)+nvl(pc.p_drug_vaccine_cost,0)
+nvl(pc.e_drug_vaccine_cost,0)+nvl(pc.drug_nutritious_cost,0)+nvl(pc.p_drug_nutritious_cost,0)
+nvl(pc.e_drug_nutritious_cost,0)+nvl(pc.drug_treatment_cost,0)+nvl(pc.p_drug_treatment_cost,0)
+nvl(pc.e_drug_treatment_cost,0)+nvl(pc.drug_disinfect_cost,0)+nvl(pc.p_drug_disinfect_cost,0)
+nvl(pc.e_drug_disinfect_cost,0)+nvl(pc.drug_inseqpt_cost,0)+nvl(pc.p_drug_inseqpt_cost,0)
+nvl(pc.e_drug_inseqpt_cost,0)+nvl(pc.drug_other_cost,0)+nvl(pc.p_drug_other_cost,0)
+nvl(pc.e_drug_other_cost,0)+nvl(pc.combustion_water_cost,0)+nvl(pc.p_combustion_water_cost,0)
+nvl(pc.e_combustion_water_cost,0)+nvl(pc.combustion_power_cost,0)+nvl(pc.p_combustion_power_cost,0)
+nvl(pc.e_combustion_power_cost,0)+nvl(pc.combustion_fire_coal_cost,0)+nvl(pc.p_combustion_fire_coal_cost,0)
+nvl(pc.e_combustion_fire_coal_cost,0)+nvl(pc.combustion_fire_oil_cost,0)+nvl(pc.p_combustion_fire_oil_cost,0)
+nvl(pc.e_combustion_fire_oil_cost,0)+nvl(pc.combustion_gas_cost,0)+nvl(pc.p_combustion_gas_cost,0)
+nvl(pc.e_combustion_gas_cost,0)+nvl(pc.combustion_vapor_cost,0)+nvl(pc.p_combustion_vapor_cost,0)
+nvl(pc.e_combustion_vapor_cost,0)+nvl(pc.combustion_other_cost,0)+nvl(pc.p_combustion_other_cost,0)
+nvl(pc.e_combustion_other_cost,0)+nvl(pc.zy_carriage_cost,0)+nvl(pc.p_zy_carriage_cost,0)
+nvl(pc.e_zy_carriage_cost,0)+nvl(pc.fy_carriage_cost,0)+nvl(pc.p_fy_carriage_cost,0)
+nvl(pc.e_fy_carriage_cost,0)+nvl(pc.foster_cost,0)+nvl(pc.p_foster_cost,0)
+nvl(pc.e_foster_cost,0)+nvl(pc.director_cost,0)+nvl(pc.p_director_cost,0)
+nvl(pc.e_director_cost,0)+nvl(pc.asset_depreciation_cost,0)+nvl(pc.p_asset_depreciation_cost,0)
+nvl(pc.e_asset_depreciation_cost,0)+nvl(pc.fixed_emp_benefits_cost,0)+nvl(pc.p_fixed_emp_benefits_cost,0)时报错Error: org.apache.spark.sql.AnalysisException: cannot resolve '(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((CAST(pc.`piglet_cost` AS DOUBLE) + CAST(pc.`p_piglet_cost` AS DOUBLE)) + CAST(pc.`e_piglet_cost` AS DOUBLE)) + CAST(pc.`feed_cost` AS DOUBLE)) + CAST(pc.`p_feed_cost` AS DOUBLE)) + CAST(pc.`e_feed_cost` AS DOUBLE)) + CAST(pc.`drug_vaccine_cost` AS DOUBLE)) + CAST(pc.`p_drug_vaccine_cost` AS DOUBLE)) + CAST(pc.`e_drug_vaccine_cost` AS DOUBLE)) + CAST(pc.`drug_nutritious_cost` AS DOUBLE)) 大神帮忙看看
/data/spark-1.4.0-bin-cdh4/bin/spark-sql --master spark://master:7077 --total-executor-cores 10 --executor-memory 1g --executor-cores 2
注:/data/spark-1.4.0-bin-cdh4/为spark的安装路径
/data/spark-1.4.0-bin-cdh4/bin/spark-sql –help 查看启动选项追问
不是启动的时候报错,时运行这段代码时报错
参考技术B (CAST(pc.`piglet_cost` AS DOUBLE)DOUBLE类型的不能直接+号拼接,先转成varchar类型或者nvarchar类型的
navicat导入sql文件时报错:mysql server has gone away
在向navicat导入数据时,运行sql文件,报错首行信息提示:mysql server has gone away
1.首先查看MySQL服务是不是已启动:
方法有两种:(1)屏幕下边的任务栏,右键单击——任务管理器(K)(按K键即可)——查看后台进程里有没有mysqld.exe进程
或者(2)Ctrl+Alt+Delete——任务管理器——查看后台进程里有没有mysqld.exe进程
没有mysqld.exe进程,则先启动再做判断;
2.如果确认mysqld.exe进程已启动,则可能是导入的sql文件过大,MySQL容不下,这事可以改一个数据容量参数
进入MySQL命令行,设置可容纳160M的数据
mysql>set global max_allowed_packet = 1024*1024*160;
参考:http://www.jb51.net/article/23781.htm
(标题:MySQL server has gone away 问题的解决方法)
以上是关于spark sql运行sql时报错的主要内容,如果未能解决你的问题,请参考以下文章
MySQL(Navicat)运行.sql文件时报错:[Err] 2006 - MySQL server has gone away 的解决方法