-4

random number generator SparkSQL ?

For example:

  • Netezza: sequence number

  • mysql: sequence number

Thanks.

2 Answers2

2

Sequence in spark sql is in spark 1.6 its select monotonically_increasing_id() from table , spark 1.6 is due to get released

  • here an example which works for Spark 2.2 sine_signale_no_ts.createOrReplaceTempView("signal") sine_signale_my_ts = sql("select (monotonically_increasing_id()+1483228800)*1000 as ts, sine from signal") – Romeo Kienzler Aug 25 '17 at 12:41
1

Spark Sql already have random functions there is one blog.

Or for number of rows spark sql also have row_number() function.

Community
  • 1
  • 1
Kaushal
  • 3,237
  • 3
  • 29
  • 48