DUAL

DUAL is a built-in data generator. It generates data records consisting of common data types: INTEGER (column i), LONG (column l), FLOAT (column f), DOUBLE (column d), mac-address (column m), IPv4-address (column ip), IPv4-socket (column ips), TIMESTAMP (column t) and STRING (column s).

The values of the fields are set incrementally and you can specify how many records to generate, which value to start from and the increment value. The only exception to setting the start value is the timestamp field that always starts from the current time.

Syntax:

DUAL(count:count_int)
DUAL(offset:offset_int, count:count_int)
DUAL(offset:offset_int, count:count_int, increment:increment_int)

DUAL(count_int)
DUAL(offset_int, count_int)
DUAL(offset_int, count_int, increment_int)
where:
  • count_int - integer specifying the count of records to be generated
  • offset_int - integer specifying the start value of the sequence
  • increment_int integer specifying the interval value of the sequence

DUAL may be called both with named parameters or with anonymous parameters. In the latter case, they are identified by a position.

Example 1. Calling DUAL with no parameters will result in just one row generated:

1
dual
i l f d m ip t s
0 0 0.0 0.0 00-00-00-00-00-00 0.0.0.0 2019-11-04 08:55:40.931 +0000 0ho0

Example 2. Calling DUAL with one anonymous parameter specifies the count of records (while the offset and increment values remain default):

1
dual(2)
i l f d m ip t s
0 0 0.0 0.0 00-00-00-00-00-00 0.0.0.0 2019-11-04 08:56:44.372 +0000 0ho0
1 1 1.0 1.0 00-00-00-00-00-01 0.0.0.1 2019-11-04 08:56:44.373 +0000 1ho1

Example 3. Calling DUAL with two anonymous parameters specifies the offset and count parameters respectively:

1
dual(2,2)
i l f d m ip t s
2 2 2.0 2.0 00-00-00-00-00-02 0.0.0.2 2019-11-04 08:58:17.199 +0000 2ho2
3 3 3.0 3.0 00-00-00-00-00-03 0.0.0.3 2019-11-04 08:58:17.200 +0000 3ho3

Example 4. Calling DUAL with three anonymous parameters specifies the offset, count and increment parameters:

1
dual(2,2,2)
i l f d m ip t s
2 2 2.0 2.0 00-00-00-00-00-02 0.0.0.2 2019-11-04 08:59:15.203 +0000 2ho2
4 4 4.0 4.0 00-00-00-00-00-04 0.0.0.4 2019-11-04 08:59:15.205 +0000 4ho4

Example 5. You can also call DUAL with named parameters (in this case, the parameter position has no significance):

1
DUAL(increment:4, offset:2, count:3);
i l f d m ip t s
2 2 2.0 2.0 00-00-00-00-00-02 0.0.0.2 2019-11-04 09:00:53.399 +0000 2ho2
6 6 6.0 6.0 00-00-00-00-00-06 0.0.0.6 2019-11-04 09:00:53.403 +0000 6ho6
10 10 10.0 10.0 00-00-00-00-00-0a 0.0.0.10 2019-11-04 09:00:53.407 +0000 10ho10

Tip

There are two additional fields that you can explicitly select from the DUAL stream: ARRAY and TUPLE. Arrays contain IPv4 values generated by DUAL, tuples also include other types of default DUAL results.

Example 6:

1
DUAL(3) | select(array, tuple);
array tuple
[] {i=0 ip=0.0.0.0 ip6=0.0.0.0 s=”0ho0” t=”0ho0” ips=[] ip6s=[]}
[0.0.0.1] {i=1 ip=0.0.0.1 ip6=0.0.0.1 s=”1ho1” t=”1ho1” ips=[0.0.0.1] ip6s=[0.0.0.1]}
[0.0.0.2, 0.0.0.3] {i=2 ip=0.0.0.2 ip6=0.0.0.2 s=”2ho2” t=”2ho2” ips=[0.0.0.2, 0.0.0.3] ip6s=[0.0.0.2, 0.0.0.3]}

Tip

You can discard the values generated by DUAL and use it as an “initiator” to generate your own values.

Example 7:

1
dual(5) | select(rad_val:RANDOM());
rand_val
6.557186868246561
6.91113776082584
6.801305043176229
6.98399452296478
6.164608210353048