Mobius:Spark Sql:无法将类型 'Microsoft.Spark.CSharp.Sql.DataFrame' 隐式转换为 'System.Collections.IEnumerable'

Mobius: Spark Sql : Cannot implicitly convert type 'Microsoft.Spark.CSharp.Sql.DataFrame' to 'System.Collections.IEnumerable'

我正在尝试使用 spark 从 MySQL table 获取一些记录 SQL 我在执行该查询时遇到错误

我想根据列的日期获取数据,该列的数据类型是 MySQL 中的 DATETIME 我正在使用 .Net 技术工作

这是我正在执行的查询

旧:

spark.sqlContext("select count(*), classification_id, to_date(cast('total_start' as date)) from call_stats where campaign_id = 172 and contact_list_id = 6288 and total_start between '2017-07-06 00:00:00' and '2017-07-07 23:59:00' group by to_date(cast('total_start' as date)) , classification_id").Collect();

这里 total_start 是我的 table 类型为 datetime 的列 我想输出日期 total_start、[=51= 的星期]、[= 的月份51=] 和年份 total_start

异常

方法或操作未实现

更新

将 qyery 更改为 :

select count(*), classification_id, date_format( cast( total_start as date), 'yyyy-MM-dd') from call_stats where campaign_id = 172 and contact_list_id = 6288 and total_start between '2017-07-06 00:00:00' and '2017-07-07 23:59:00' group by date_format( cast( total_start as date), 'yyyy-MM-dd'), classification_id 

得到新的异常:

匿名托管的 DynamicMethods 程序集:无法将类型 'Microsoft.Spark.CSharp.Sql.DataFrame' 隐式转换为 'System.Collections.IEnumerable'。存在显式转换(是否缺少转换?)

任何帮助将不胜感激

我正在使用一种存在但方式不正确的方法,所以我只需要更改该查询,例如:

select count(*) as count, classification_id, date_format( cast(total_start as date), 'dd-MM-yyyy')as label from call_stats where campaign_id = 172 and contact_list_id = 6288 and total_start between '2017-07-06 00:00:00' and '2017-07-14 23:59:00' group by date_format( cast(total_start as date), 'dd-MM-yyyy') ,classification_id

对于周、月和年,我得到了年份查询示例的答案:

select count(*) as count, classification_id, year(total_start) as label from call_stats where campaign_id = 172 and contact_list_id = 6288 and total_start between '2015-08-01 00:00:00' and '2017-09-22 23:59:00' group by year(total_start) , classification_id

查询的月份示例是:

select count(*) as count, classification_id, month(total_start) as label from call_stats where campaign_id = 77 and contact_list_id = 6037 and total_start between '2017-04-06 00:00:00' and '2017-05-26 23:59:00' group by month(total_start) , classification_id

周查询示例:

select count(*) as count, classification_id, weekofyear(total_start) as label from call_stats where campaign_id = 172 and contact_list_id = 6288 and total_start between '2017-07-06 00:00:00' and '2017-07-14 23:59:00' group by weekofyear(total_start) , classification_id