@@ -7408,76 +7408,76 @@ private static void checkIf(SqlOperatorFixture f) {
7408
7408
@Test void testSafeAddFunc() {
7409
7409
final SqlOperatorFixture f0 = fixture().setFor(SqlLibraryOperators.SAFE_ADD);
7410
7410
f0.checkFails("^safe_add(2, 3)^",
7411
- "No match found for function signature "
7412
- + "SAFE_ADD\\(<NUMERIC>, <NUMERIC>\\)", false);
7411
+ "No match found for function signature "
7412
+ + "SAFE_ADD\\(<NUMERIC>, <NUMERIC>\\)", false);
7413
7413
final SqlOperatorFixture f = f0.withLibrary(SqlLibrary.BIG_QUERY);
7414
7414
// Basic test for each of the 9 2-permutations of BIGINT, DECIMAL, and FLOAT
7415
7415
f.checkScalar("safe_add(cast(20 as bigint), cast(20 as bigint))",
7416
- "40", "BIGINT");
7416
+ "40", "BIGINT");
7417
7417
f.checkScalar("safe_add(cast(20 as bigint), cast(1.2345 as decimal(5,4)))",
7418
- "21.2345", "DECIMAL(19, 4)");
7418
+ "21.2345", "DECIMAL(19, 4)");
7419
7419
f.checkScalar("safe_add(cast(1.2345 as decimal(5,4)), cast(20 as bigint))",
7420
- "21.2345", "DECIMAL(19, 4)");
7421
- f.checkScalar("safe_add(cast(1.2345 as decimal(5,4)), "
7422
- + "cast(2.0 as decimal(2, 1)))", "3.2345", "DECIMAL(6, 4)");
7420
+ "21.2345", "DECIMAL(19, 4)");
7421
+ f.checkScalar("safe_add(cast(1.2345 as decimal(5,4)), cast(2.0 as decimal(2, 1)))",
7422
+ "3.2345", "DECIMAL(6, 4)");
7423
7423
f.checkScalar("safe_add(cast(3 as double), cast(3 as bigint))",
7424
- "6.0", "DOUBLE");
7424
+ "6.0", "DOUBLE");
7425
7425
f.checkScalar("safe_add(cast(3 as bigint), cast(3 as double))",
7426
- "6.0", "DOUBLE");
7426
+ "6.0", "DOUBLE");
7427
7427
f.checkScalar("safe_add(cast(3 as double), cast(1.2345 as decimal(5, 4)))",
7428
- "4.2345", "DOUBLE");
7428
+ "4.2345", "DOUBLE");
7429
7429
f.checkScalar("safe_add(cast(1.2345 as decimal(5, 4)), cast(3 as double))",
7430
- "4.2345", "DOUBLE");
7430
+ "4.2345", "DOUBLE");
7431
7431
f.checkScalar("safe_add(cast(3 as double), cast(3 as double))",
7432
- "6.0", "DOUBLE");
7432
+ "6.0", "DOUBLE");
7433
7433
// Tests for + and - Infinity
7434
7434
f.checkScalar("safe_add(cast('Infinity' as double), cast(3 as double))",
7435
- "Infinity", "DOUBLE");
7435
+ "Infinity", "DOUBLE");
7436
7436
f.checkScalar("safe_add(cast('-Infinity' as double), cast(3 as double))",
7437
- "-Infinity", "DOUBLE");
7437
+ "-Infinity", "DOUBLE");
7438
7438
f.checkScalar("safe_add(cast('-Infinity' as double), "
7439
- + "cast('Infinity' as double))", "NaN", "DOUBLE");
7439
+ + "cast('Infinity' as double))", "NaN", "DOUBLE");
7440
7440
// Tests for NaN
7441
7441
f.checkScalar("safe_add(cast('NaN' as double), cast(3 as bigint))",
7442
- "NaN", "DOUBLE");
7442
+ "NaN", "DOUBLE");
7443
7443
f.checkScalar("safe_add(cast('NaN' as double), cast(1.23 as decimal(3, 2)))",
7444
- "NaN", "DOUBLE");
7444
+ "NaN", "DOUBLE");
7445
7445
f.checkScalar("safe_add(cast('NaN' as double), cast('Infinity' as double))",
7446
- "NaN", "DOUBLE");
7446
+ "NaN", "DOUBLE");
7447
7447
f.checkScalar("safe_add(cast(3 as bigint), cast('NaN' as double))",
7448
- "NaN", "DOUBLE");
7448
+ "NaN", "DOUBLE");
7449
7449
f.checkScalar("safe_add(cast(1.23 as decimal(3, 2)), cast('NaN' as double))",
7450
- "NaN", "DOUBLE");
7450
+ "NaN", "DOUBLE");
7451
7451
// Overflow test for each pairing
7452
7452
f.checkNull("safe_add(cast(20 as bigint), "
7453
- + "cast(9223372036854775807 as bigint))");
7453
+ + "cast(9223372036854775807 as bigint))");
7454
7454
f.checkNull("safe_add(cast(-20 as bigint), "
7455
- + "cast(-9223372036854775807 as bigint))");
7455
+ + "cast(-9223372036854775807 as bigint))");
7456
7456
f.checkNull("safe_add(9, cast(9.999999999999999999e75 as DECIMAL(38, 19)))");
7457
7457
f.checkNull("safe_add(-9, cast(-9.999999999999999999e75 as DECIMAL(38, 19)))");
7458
7458
f.checkNull("safe_add(cast(9.999999999999999999e75 as DECIMAL(38, 19)), 9)");
7459
7459
f.checkNull("safe_add(cast(-9.999999999999999999e75 as DECIMAL(38, 19)), -9)");
7460
7460
f.checkNull("safe_add(cast(9.9e75 as DECIMAL(76, 0)), "
7461
- + "cast(9.9e75 as DECIMAL(76, 0)))");
7461
+ + "cast(9.9e75 as DECIMAL(76, 0)))");
7462
7462
f.checkNull("safe_add(cast(-9.9e75 as DECIMAL(76, 0)), "
7463
- + "cast(-9.9e75 as DECIMAL(76, 0)))");
7463
+ + "cast(-9.9e75 as DECIMAL(76, 0)))");
7464
7464
f.checkNull("safe_add(cast(1.7976931348623157e308 as double), "
7465
- + "cast(9.9e7 as decimal(76, 0)))");
7465
+ + "cast(9.9e7 as decimal(76, 0)))");
7466
7466
f.checkNull("safe_add(cast(-1.7976931348623157e308 as double), "
7467
- + "cast(-9.9e7 as decimal(76, 0)))");
7467
+ + "cast(-9.9e7 as decimal(76, 0)))");
7468
7468
f.checkNull("safe_add(cast(9.9e7 as decimal(76, 0)), "
7469
- + "cast(1.7976931348623157e308 as double))");
7469
+ + "cast(1.7976931348623157e308 as double))");
7470
7470
f.checkNull("safe_add(cast(-9.9e7 as decimal(76, 0)), "
7471
- + "cast(-1.7976931348623157e308 as double))");
7471
+ + "cast(-1.7976931348623157e308 as double))");
7472
7472
f.checkNull("safe_add(cast(1.7976931348623157e308 as double), cast(3 as bigint))");
7473
7473
f.checkNull("safe_add(cast(-1.7976931348623157e308 as double), "
7474
- + "cast(-3 as bigint))");
7474
+ + "cast(-3 as bigint))");
7475
7475
f.checkNull("safe_add(cast(3 as bigint), cast(1.7976931348623157e308 as double))");
7476
7476
f.checkNull("safe_add(cast(-3 as bigint), "
7477
- + "cast(-1.7976931348623157e308 as double))");
7477
+ + "cast(-1.7976931348623157e308 as double))");
7478
7478
f.checkNull("safe_add(cast(3 as double), cast(1.7976931348623157e308 as double))");
7479
7479
f.checkNull("safe_add(cast(-3 as double), "
7480
- + "cast(-1.7976931348623157e308 as double))");
7480
+ + "cast(-1.7976931348623157e308 as double))");
7481
7481
// Check that null argument retuns null
7482
7482
f.checkNull("safe_add(cast(null as double), cast(3 as bigint))");
7483
7483
f.checkNull("safe_add(cast(3 as double), cast(null as bigint))");
@@ -7486,8 +7486,8 @@ private static void checkIf(SqlOperatorFixture f) {
7486
7486
@Test void testSafeDivideFunc() {
7487
7487
final SqlOperatorFixture f0 = fixture().setFor(SqlLibraryOperators.SAFE_DIVIDE);
7488
7488
f0.checkFails("^safe_divide(2, 3)^",
7489
- "No match found for function signature "
7490
- + "SAFE_DIVIDE\\(<NUMERIC>, <NUMERIC>\\)", false);
7489
+ "No match found for function signature "
7490
+ + "SAFE_DIVIDE\\(<NUMERIC>, <NUMERIC>\\)", false);
7491
7491
final SqlOperatorFixture f = f0.withLibrary(SqlLibrary.BIG_QUERY);
7492
7492
// Basic test for each of the 9 2-permutations of BIGINT, DECIMAL, and FLOAT
7493
7493
f.checkScalar("safe_divide(cast(2 as bigint), cast(4 as bigint))",
@@ -7633,8 +7633,8 @@ private static void checkIf(SqlOperatorFixture f) {
7633
7633
@Test void testSafeNegateFunc() {
7634
7634
final SqlOperatorFixture f0 = fixture().setFor(SqlLibraryOperators.SAFE_NEGATE);
7635
7635
f0.checkFails("^safe_negate(2)^",
7636
- "No match found for function signature "
7637
- + "SAFE_NEGATE\\(<NUMERIC>\\)", false);
7636
+ "No match found for function signature "
7637
+ + "SAFE_NEGATE\\(<NUMERIC>\\)", false);
7638
7638
final SqlOperatorFixture f = f0.withLibrary(SqlLibrary.BIG_QUERY);
7639
7639
f.checkScalar("safe_negate(cast(20 as bigint))", "-20",
7640
7640
"BIGINT");
@@ -7668,79 +7668,79 @@ private static void checkIf(SqlOperatorFixture f) {
7668
7668
@Test void testSafeSubtractFunc() {
7669
7669
final SqlOperatorFixture f0 = fixture().setFor(SqlLibraryOperators.SAFE_SUBTRACT);
7670
7670
f0.checkFails("^safe_subtract(2, 3)^",
7671
- "No match found for function signature "
7672
- + "SAFE_SUBTRACT\\(<NUMERIC>, <NUMERIC>\\)", false);
7671
+ "No match found for function signature "
7672
+ + "SAFE_SUBTRACT\\(<NUMERIC>, <NUMERIC>\\)", false);
7673
7673
final SqlOperatorFixture f = f0.withLibrary(SqlLibrary.BIG_QUERY);
7674
7674
// Basic test for each of the 9 2-permutations of BIGINT, DECIMAL, and FLOAT
7675
7675
f.checkScalar("safe_subtract(cast(20 as bigint), cast(20 as bigint))",
7676
- "0", "BIGINT");
7676
+ "0", "BIGINT");
7677
7677
f.checkScalar("safe_subtract(cast(20 as bigint), cast(-1.2345 as decimal(5,4)))",
7678
- "21.2345", "DECIMAL(19, 4)");
7678
+ "21.2345", "DECIMAL(19, 4)");
7679
7679
f.checkScalar("safe_subtract(cast(1.2345 as decimal(5,4)), cast(-20 as bigint))",
7680
- "21.2345", "DECIMAL(19, 4)");
7680
+ "21.2345", "DECIMAL(19, 4)");
7681
7681
f.checkScalar("safe_subtract(cast(1.23 as decimal(3,2)), "
7682
- + "cast(-2.0 as decimal(2, 1)))", "3.23", "DECIMAL(4, 2)");
7682
+ + "cast(-2.0 as decimal(2, 1)))", "3.23", "DECIMAL(4, 2)");
7683
7683
f.checkScalar("safe_subtract(cast(3 as double), cast(-3 as bigint))",
7684
- "6.0", "DOUBLE");
7684
+ "6.0", "DOUBLE");
7685
7685
f.checkScalar("safe_subtract(cast(3 as bigint), cast(-3 as double))",
7686
- "6.0", "DOUBLE");
7686
+ "6.0", "DOUBLE");
7687
7687
f.checkScalar("safe_subtract(cast(3 as double), cast(-1.2345 as decimal(5, 4)))",
7688
- "4.2345", "DOUBLE");
7688
+ "4.2345", "DOUBLE");
7689
7689
f.checkScalar("safe_subtract(cast(1.2345 as decimal(5, 4)), cast(-3 as double))",
7690
- "4.2345", "DOUBLE");
7690
+ "4.2345", "DOUBLE");
7691
7691
f.checkScalar("safe_subtract(cast(3 as double), cast(3 as double))",
7692
- "0.0", "DOUBLE");
7692
+ "0.0", "DOUBLE");
7693
7693
// Tests for + and - Infinity
7694
7694
f.checkScalar("safe_subtract(cast('Infinity' as double), cast(3 as double))",
7695
- "Infinity", "DOUBLE");
7695
+ "Infinity", "DOUBLE");
7696
7696
f.checkScalar("safe_subtract(cast('-Infinity' as double), cast(3 as double))",
7697
- "-Infinity", "DOUBLE");
7697
+ "-Infinity", "DOUBLE");
7698
7698
f.checkScalar("safe_subtract(cast('Infinity' as double), "
7699
- + "cast('Infinity' as double))", "NaN", "DOUBLE");
7699
+ + "cast('Infinity' as double))", "NaN", "DOUBLE");
7700
7700
// Tests for NaN
7701
7701
f.checkScalar("safe_subtract(cast('NaN' as double), cast(3 as bigint))",
7702
- "NaN", "DOUBLE");
7702
+ "NaN", "DOUBLE");
7703
7703
f.checkScalar("safe_subtract(cast('NaN' as double), cast(1.23 as decimal(3, 2)))",
7704
- "NaN", "DOUBLE");
7704
+ "NaN", "DOUBLE");
7705
7705
f.checkScalar("safe_subtract(cast('NaN' as double), cast('Infinity' as double))",
7706
- "NaN", "DOUBLE");
7706
+ "NaN", "DOUBLE");
7707
7707
f.checkScalar("safe_subtract(cast(3 as bigint), cast('NaN' as double))",
7708
- "NaN", "DOUBLE");
7708
+ "NaN", "DOUBLE");
7709
7709
f.checkScalar("safe_subtract(cast(1.23 as decimal(3, 2)), cast('NaN' as double))",
7710
- "NaN", "DOUBLE");
7710
+ "NaN", "DOUBLE");
7711
7711
// Overflow test for each pairing
7712
7712
f.checkNull("safe_subtract(cast(20 as bigint), "
7713
- + "cast(-9223372036854775807 as bigint))");
7713
+ + "cast(-9223372036854775807 as bigint))");
7714
7714
f.checkNull("safe_subtract(cast(-20 as bigint), "
7715
- + "cast(9223372036854775807 as bigint))");
7715
+ + "cast(9223372036854775807 as bigint))");
7716
7716
f.checkNull("safe_subtract(9, cast(-9.999999999999999999e75 as DECIMAL(38, 19)))");
7717
7717
f.checkNull("safe_subtract(-9, cast(9.999999999999999999e75 as DECIMAL(38, 19)))");
7718
7718
f.checkNull("safe_subtract(cast(-9.999999999999999999e75 as DECIMAL(38, 19)), 9)");
7719
7719
f.checkNull("safe_subtract(cast(9.999999999999999999e75 as DECIMAL(38, 19)), -9)");
7720
7720
f.checkNull("safe_subtract(cast(-9.9e75 as DECIMAL(76, 0)), "
7721
- + "cast(9.9e75 as DECIMAL(76, 0)))");
7721
+ + "cast(9.9e75 as DECIMAL(76, 0)))");
7722
7722
f.checkNull("safe_subtract(cast(9.9e75 as DECIMAL(76, 0)), "
7723
- + "cast(-9.9e75 as DECIMAL(76, 0)))");
7723
+ + "cast(-9.9e75 as DECIMAL(76, 0)))");
7724
7724
f.checkNull("safe_subtract(cast(1.7976931348623157e308 as double), "
7725
- + "cast(-9.9e7 as decimal(76, 0)))");
7725
+ + "cast(-9.9e7 as decimal(76, 0)))");
7726
7726
f.checkNull("safe_subtract(cast(-1.7976931348623157e308 as double), "
7727
- + "cast(9.9e7 as decimal(76, 0)))");
7727
+ + "cast(9.9e7 as decimal(76, 0)))");
7728
7728
f.checkNull("safe_subtract(cast(9.9e7 as decimal(76, 0)), "
7729
- + "cast(-1.7976931348623157e308 as double))");
7729
+ + "cast(-1.7976931348623157e308 as double))");
7730
7730
f.checkNull("safe_subtract(cast(-9.9e7 as decimal(76, 0)), "
7731
- + "cast(1.7976931348623157e308 as double))");
7731
+ + "cast(1.7976931348623157e308 as double))");
7732
7732
f.checkNull("safe_subtract(cast(1.7976931348623157e308 as double), "
7733
- + "cast(-3 as bigint))");
7733
+ + "cast(-3 as bigint))");
7734
7734
f.checkNull("safe_subtract(cast(-1.7976931348623157e308 as double), "
7735
- + "cast(3 as bigint))");
7735
+ + "cast(3 as bigint))");
7736
7736
f.checkNull("safe_subtract(cast(3 as bigint), "
7737
- + "cast(-1.7976931348623157e308 as double))");
7737
+ + "cast(-1.7976931348623157e308 as double))");
7738
7738
f.checkNull("safe_subtract(cast(-3 as bigint), "
7739
- + "cast(1.7976931348623157e308 as double))");
7739
+ + "cast(1.7976931348623157e308 as double))");
7740
7740
f.checkNull("safe_subtract(cast(3 as double), "
7741
- + "cast(-1.7976931348623157e308 as double))");
7741
+ + "cast(-1.7976931348623157e308 as double))");
7742
7742
f.checkNull("safe_subtract(cast(-3 as double), "
7743
- + "cast(1.7976931348623157e308 as double))");
7743
+ + "cast(1.7976931348623157e308 as double))");
7744
7744
// Check that null argument retuns null
7745
7745
f.checkNull("safe_subtract(cast(null as double), cast(3 as bigint))");
7746
7746
f.checkNull("safe_subtract(cast(3 as double), cast(null as bigint))");
0 commit comments