spark-instrumented-optimizer/sql/core/benchmarks/IntervalBenchmark-results.txt
Kent Yao ed0c33fdd4 [SPARK-30026][SQL] Whitespaces can be identified as delimiters in interval string
### What changes were proposed in this pull request?

We are now able to handle whitespaces for integral and fractional types, and the leading or trailing whitespaces for interval, date, and timestamps. But the current interval parser is not able to identify whitespaces as separates as PostgreSQL can do.

This PR makes the whitespaces handling be consistent for nterval values.
Typed interval literal, multi-unit representation, and casting from strings are all supported.

```sql
postgres=# select interval E'1 \t day';
 interval
----------
 1 day
(1 row)

postgres=# select interval E'1\t' day;
 interval
----------
 1 day
(1 row)
```

### Why are the changes needed?

Whitespace handling should be consistent for interval value, and across different types in Spark.
PostgreSQL feature parity.

### Does this PR introduce any user-facing change?
Yes, the interval string of multi-units values which separated by whitespaces can be valid now.

### How was this patch tested?
add ut.

Closes #26662 from yaooqinn/SPARK-30026.

Authored-by: Kent Yao <yaooqinn@hotmail.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
2019-11-27 01:20:38 +08:00

30 lines
3.2 KiB
Plaintext

Java HotSpot(TM) 64-Bit Server VM 1.8.0_231-b11 on Mac OS X 10.15.1
Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
cast strings to intervals: Best Time(ms) Avg Time(ms) Stdev(ms) Rate(M/s) Per Row(ns) Relative
------------------------------------------------------------------------------------------------------------------------
prepare string w/ interval 357 370 22 2.8 357.0 1.0X
prepare string w/o interval 315 333 22 3.2 314.7 1.1X
1 units w/ interval 356 380 21 2.8 355.8 1.0X
1 units w/o interval 317 326 12 3.2 317.1 1.1X
2 units w/ interval 481 488 8 2.1 480.8 0.7X
2 units w/o interval 456 464 9 2.2 456.0 0.8X
3 units w/ interval 1074 1080 5 0.9 1073.7 0.3X
3 units w/o interval 1025 1027 2 1.0 1025.4 0.3X
4 units w/ interval 1192 1196 5 0.8 1192.2 0.3X
4 units w/o interval 1219 1233 14 0.8 1218.9 0.3X
5 units w/ interval 1367 1382 23 0.7 1367.3 0.3X
5 units w/o interval 1295 1301 7 0.8 1295.1 0.3X
6 units w/ interval 1489 1525 31 0.7 1489.3 0.2X
6 units w/o interval 1496 1500 6 0.7 1495.8 0.2X
7 units w/ interval 1326 1330 4 0.8 1325.5 0.3X
7 units w/o interval 1324 1332 11 0.8 1324.1 0.3X
8 units w/ interval 1535 1547 11 0.7 1535.4 0.2X
8 units w/o interval 1542 1547 5 0.6 1542.3 0.2X
9 units w/ interval 1623 1641 18 0.6 1623.0 0.2X
9 units w/o interval 1615 1619 3 0.6 1615.3 0.2X
10 units w/ interval 1845 1861 16 0.5 1844.7 0.2X
10 units w/o interval 1858 1868 9 0.5 1857.8 0.2X
11 units w/ interval 1919 1925 11 0.5 1918.7 0.2X
11 units w/o interval 1973 1995 23 0.5 1972.8 0.2X