Skip to content

Commit

Permalink
Merge pull request #168 from InterestingLab/rickyhuo.fix.empty
Browse files Browse the repository at this point in the history
Fix #167
  • Loading branch information
garyelephant authored Nov 10, 2018
2 parents f1d8349 + fd5689b commit e8d62ca
Showing 1 changed file with 19 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -265,24 +265,24 @@ object Waterdrop extends Logging {
var ds = sparkSession.createDataset(rowsRDD)(encoder)

// Ignore empty schema dataset
if (ds.columns.length > 0 && !rowsRDD.isEmpty()) {

for (f <- filters) {
for (f <- filters) {
if (ds.take(1).length > 0) {
ds = f.process(sparkSession, ds)
}
}

streamingInputs.foreach(p => {
p.beforeOutput
})
streamingInputs.foreach(p => {
p.beforeOutput
})

outputs.foreach(p => {
p.process(ds)
})
outputs.foreach(p => {
p.process(ds)
})

streamingInputs.foreach(p => {
p.afterOutput
})
}
streamingInputs.foreach(p => {
p.afterOutput
})
}

ssc.start()
Expand Down Expand Up @@ -335,14 +335,16 @@ object Waterdrop extends Logging {

if (staticInputs.nonEmpty) {
var ds = staticInputs.head.getDataset(sparkSession)
if (ds.columns.length > 0) {
for (f <- filters) {

for (f <- filters) {
if (ds.take(1).length > 0) {
ds = f.process(sparkSession, ds)
}
outputs.foreach(p => {
p.process(ds)
})
}
outputs.foreach(p => {
p.process(ds)
})

} else {
throw new ConfigRuntimeException("Input must be configured at least once.")
}
Expand Down

0 comments on commit e8d62ca

Please sign in to comment.