From 43ebe287fff10ba1243e14fee874b85c016d1064 Mon Sep 17 00:00:00 2001 From: yanfqidong0604 Date: Sat, 13 Oct 2018 11:53:10 +0800 Subject: [PATCH] csv yang qi dong --- piflow-bundle/src/main/resources/CsvFolderTest.json | 1 - piflow-bundle/src/main/resources/CsvStringTest.json | 1 - .../src/main/scala/cn/piflow/bundle/csv/CsvStringParser.scala | 1 + .../src/main/scala/cn/piflow/bundle/csv/FolderCsvParser.scala | 4 ---- .../src/test/scala/cn/piflow/bundle/CscFolderTest.scala | 1 - .../src/test/scala/cn/piflow/bundle/CsvStringTest.scala | 1 - 6 files changed, 1 insertion(+), 8 deletions(-) diff --git a/piflow-bundle/src/main/resources/CsvFolderTest.json b/piflow-bundle/src/main/resources/CsvFolderTest.json index c0e2306..9074086 100644 --- a/piflow-bundle/src/main/resources/CsvFolderTest.json +++ b/piflow-bundle/src/main/resources/CsvFolderTest.json @@ -10,7 +10,6 @@ "bundle":"cn.piflow.bundle.csv.FolderCsvParser", "properties":{ "csvPath":"hdfs://10.0.86.89:9000/aYQD/", - "header":"true", "delimiter":",", "schema":"id,name,gender,age" } diff --git a/piflow-bundle/src/main/resources/CsvStringTest.json b/piflow-bundle/src/main/resources/CsvStringTest.json index 0a12927..7bbf76f 100644 --- a/piflow-bundle/src/main/resources/CsvStringTest.json +++ b/piflow-bundle/src/main/resources/CsvStringTest.json @@ -13,7 +13,6 @@ "delimiter":",", "schema":"" } - }, { "uuid":"1111", diff --git a/piflow-bundle/src/main/scala/cn/piflow/bundle/csv/CsvStringParser.scala b/piflow-bundle/src/main/scala/cn/piflow/bundle/csv/CsvStringParser.scala index 446ee95..8b473b8 100644 --- a/piflow-bundle/src/main/scala/cn/piflow/bundle/csv/CsvStringParser.scala +++ b/piflow-bundle/src/main/scala/cn/piflow/bundle/csv/CsvStringParser.scala @@ -67,6 +67,7 @@ class CsvStringParser extends ConfigurableStop{ val schema = new PropertyDescriptor().name("schema").displayName("schema").description("The schema of the String,The delimiter is ,").defaultValue("").required(false) descriptor = schema :: descriptor descriptor + } override def getIcon(): Array[Byte] = { diff --git a/piflow-bundle/src/main/scala/cn/piflow/bundle/csv/FolderCsvParser.scala b/piflow-bundle/src/main/scala/cn/piflow/bundle/csv/FolderCsvParser.scala index 32c965d..3a96b45 100644 --- a/piflow-bundle/src/main/scala/cn/piflow/bundle/csv/FolderCsvParser.scala +++ b/piflow-bundle/src/main/scala/cn/piflow/bundle/csv/FolderCsvParser.scala @@ -18,7 +18,6 @@ class FolderCsvParser extends ConfigurableStop{ var FolderPath:String=_ - var header:Boolean=_ var delimiter: String = _ var schema: String = _ @@ -66,7 +65,6 @@ class FolderCsvParser extends ConfigurableStop{ override def setProperties(map: Map[String, Any]): Unit = { FolderPath = MapUtil.get(map,"csvPath").asInstanceOf[String] - header = MapUtil.get(map,"header").asInstanceOf[String].toBoolean delimiter = MapUtil.get(map,"delimiter").asInstanceOf[String] schema = MapUtil.get(map,"schema").asInstanceOf[String] } @@ -75,8 +73,6 @@ class FolderCsvParser extends ConfigurableStop{ var descriptor : List[PropertyDescriptor] = List() val FolderPath = new PropertyDescriptor().name("FolderPath").displayName("FolderPath").description("The path of csv Folder").defaultValue("").required(true) descriptor = FolderPath :: descriptor - val header = new PropertyDescriptor().name("header").displayName("header").description("Whether the csv file have header or not").defaultValue("").required(true) - descriptor = header :: descriptor val delimiter = new PropertyDescriptor().name("delimiter").displayName("delimiter").description("The delimiter of csv file").defaultValue("").required(true) descriptor = delimiter :: descriptor val schema = new PropertyDescriptor().name("schema").displayName("schema").description("The schema of csv file,The delimiter is ,").defaultValue("").required(true) diff --git a/piflow-bundle/src/test/scala/cn/piflow/bundle/CscFolderTest.scala b/piflow-bundle/src/test/scala/cn/piflow/bundle/CscFolderTest.scala index 3ed1b2f..8bc7990 100644 --- a/piflow-bundle/src/test/scala/cn/piflow/bundle/CscFolderTest.scala +++ b/piflow-bundle/src/test/scala/cn/piflow/bundle/CscFolderTest.scala @@ -18,7 +18,6 @@ class CscFolderTest { val flowJsonStr = FileUtil.fileReader(file) val map = OptionUtil.getAny(JSON.parseFull(flowJsonStr)).asInstanceOf[Map[String, Any]] println(map) - //create flow val flowBean = FlowBean(map) val flow = flowBean.constructFlow() diff --git a/piflow-bundle/src/test/scala/cn/piflow/bundle/CsvStringTest.scala b/piflow-bundle/src/test/scala/cn/piflow/bundle/CsvStringTest.scala index b5fb989..0822890 100644 --- a/piflow-bundle/src/test/scala/cn/piflow/bundle/CsvStringTest.scala +++ b/piflow-bundle/src/test/scala/cn/piflow/bundle/CsvStringTest.scala @@ -44,7 +44,6 @@ class CsvStringTest { println(pid + "!!!!!!!!!!!!!!!!!!!!!") spark.close(); } - @Test def testFlow2json() = {