Skip to content

Commit

Permalink
Add UT for leastRestrictive
Browse files Browse the repository at this point in the history
  • Loading branch information
chucheng92 committed Oct 26, 2023
1 parent 3ae9c56 commit 84e97c1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -10534,6 +10534,13 @@ private static void checkArrayConcatAggFuncFails(SqlOperatorFixture t) {
"Map requires an even number of arguments", false);
f1.checkFails("^map(1, 1, 2, 'x')^",
"Parameters must be of the same type", false);
// leastRestrictive for key
f1.checkFails("^MAP('k1', 1, 1, 2.0, 'k3', 1)^",
"Parameters must be of the same type", false);
// leastRestrictive for value
f1.checkFails("^MAP('k1', 1, 'k2', 2.0, 'k3', '3')^",
"Parameters must be of the same type", false);

// this behavior is different from std MapValueConstructor
f1.checkScalar("map()",
"{}",
Expand All @@ -10550,6 +10557,9 @@ private static void checkArrayConcatAggFuncFails(SqlOperatorFixture t) {
f1.checkScalar("map('washington', 1, 'obama', 44)",
"{washington=1, obama=44}",
"(CHAR(10) NOT NULL, INTEGER NOT NULL) MAP NOT NULL");
f1.checkScalar("map('k1', 1, 'k2', 2.0)",
"{k1=1, k2=2.0}",
"(CHAR(2) NOT NULL, DECIMAL(11, 1) NOT NULL) MAP NOT NULL");
}

@Test void testCeilFunc() {
Expand Down

0 comments on commit 84e97c1

Please sign in to comment.