Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
titleInteractive Programming in Batch Processing
Table a = ….
Table b = a.select(...).filter(...)
intInteger cmax = b.max()
int d = b.min(.orderBy($("val").desc()).limit(1).execute().collect().next().getField(...)
Integer min = b.orderBy($("val").asc()).limit(1).execute().collect().next().getField(...) // recompute table b from table a
Table e = b.select("(f1 - min)/(max - min)").filter(...)
e.execute().print() // recompute table b from table a
...
If (b.count() > 10) { // recompute table b from table a
  b.select(UDF1(...)).execute().print()// recompute table b from table a
} else {
  b.select(UDF2(...)).execute().print()
}

In the above code, because b is not cached, it will be computed from scratch multiple times whenever referred later in the program.

...