modification of ConvertSchema

yang qidong
This commit is contained in:
yanfqidong0604 2018-11-23 12:56:14 +08:00
parent cda81eae5c
commit 2b46264473
1 changed files with 2 additions and 2 deletions

View File

@ -16,14 +16,14 @@ class ConvertSchema extends ConfigurableStop {
var schema:String = _
def perform(in: JobInputStream, out: JobOutputStream, pec: JobContext): Unit = {
val df = in.read()
var df = in.read()
//oldField1->newField1, oldField2->newField2
val field = schema.split(",")
field.foreach(f => {
val old_new: Array[String] = f.split("->")
df.withColumnRenamed(old_new(0),old_new(1))
df = df.withColumnRenamed(old_new(0),old_new(1))
})
println("###########################")