AZURE HD INSIGHT(群集)将CSV文件导入存储:创建表格

问题描述 投票:0回答:1

我对编码非常陌生 - 我知道基础知识,所以我在这个项目上拔头发。

我试图将我的Hadoop集群最终链接到Tableau,我的项目主要集中在那里。我关注this guy

但是,他没有详细说明如何将CSV文件链接到群集。经过一番研究后,我发现需要通过集群导入数据。我已设法通过CloudXplorer导入CSV文件。现在我只需要创建表格。

我没有通过Ambari获得运气(创建一个表错误是获取数据库的错误,并且它始终没有真正上传我的文件)或Zeppelin。

我在Zeppelin上的代码如下:

%livy2.spark
 //The above magic instructs Zeppelin to use the Livy Scala interpreter

 // Create an RDD using the default Spark context, sc
 val SearchText = sc.textFile("wasb://test'myname'[email protected]/sample/stopandsearch.csv")

 // Define a schema
 case class Search(Type: String, date: String, time: String, LATITUDE: String, LONGITUDE: String, Gender: String, Age_Range: String, Self_defined_Eth: String, Officer_defined_Eth: String, Legislation: String, Obj_Of_Search: String, Outcome: String)

 // Map the values in the .csv file to the schema
 val Search = SearchText.map(s => s.split(",")).map(
     s => Search(s(6), 
             s(1),
             s(7),
             s(3),
             s(6),
             s(7),
             s(3),
             s(7),
             s(12),
             s(12),
             s(12)
     )
 ).toDF()
 Search.registerAsTable("Search")
 Search.saveAsTable("Search")
<console>:30: error: recursive value Search needs type
            s => Search(s(6),
                 ^
<console>:42: error: value toDF is not a member of org.apache.spark.rdd.RDD[U]
possible cause: maybe a semicolon is missing before `value toDF'?
        ).toDF()
          ^

请给我任何建议。围绕这个的任何捷径,我只需要将数据插入到漂亮的表中! :)

提前致谢。

PS我不知道如何获得isb的链接? Http link为容器中的csv文件。

azure bigdata apache-zeppelin hdinsight
1个回答
0
投票

我认为这条道路不正确。

wasb://test'myname'[email protected]/sample/stopandsearch.csv"

它应该是

wasb://test'myname'1@<storageaccount>.blob.core.windows.net/sample/stopandsearch.csv"

您缺少storageaccount,我假设test'myname'1是容器名称。

© www.soinside.com 2019 - 2024. All rights reserved.