use of org.apache.calcite.sql.test.SqlOperatorFixture in project calcite by apache.
the class SqlOperatorTest method testDifferenceFunc.
@Test
void testDifferenceFunc() {
final SqlOperatorFixture f = fixture().setFor(SqlLibraryOperators.DIFFERENCE).withLibrary(SqlLibrary.POSTGRESQL);
f.checkScalarExact("DIFFERENCE('Miller', 'miller')", 4);
f.checkScalarExact("DIFFERENCE('Miller', 'myller')", 4);
f.checkScalarExact("DIFFERENCE('muller', 'miller')", 4);
f.checkScalarExact("DIFFERENCE('muller', 'miller')", 4);
f.checkScalarExact("DIFFERENCE('muller', 'milk')", 2);
f.checkScalarExact("DIFFERENCE('muller', 'mile')", 2);
f.checkScalarExact("DIFFERENCE('muller', 'm')", 1);
f.checkScalarExact("DIFFERENCE('muller', 'lee')", 0);
f.checkNull("DIFFERENCE('muller', cast(null as varchar(1)))");
f.checkNull("DIFFERENCE(cast(null as varchar(1)), 'muller')");
}
use of org.apache.calcite.sql.test.SqlOperatorFixture in project calcite by apache.
the class SqlOperatorTest method testFromBase64.
@Test
void testFromBase64() {
final SqlOperatorFixture f = fixture().setFor(SqlLibraryOperators.FROM_BASE64).withLibrary(SqlLibrary.MYSQL);
f.checkString("from_base64('VGhpcyBpcyBhIHRlc3QgU3RyaW5nLg==')", "546869732069732061207465737420537472696e672e", "VARBINARY NOT NULL");
f.checkString("from_base64('VGhpcyBpcyBhIHRlc\t3QgU3RyaW5nLg==')", "546869732069732061207465737420537472696e672e", "VARBINARY NOT NULL");
f.checkString("from_base64('VGhpcyBpcyBhIHRlc\t3QgU3\nRyaW5nLg==')", "546869732069732061207465737420537472696e672e", "VARBINARY NOT NULL");
f.checkString("from_base64('VGhpcyB pcyBhIHRlc3Qg\tU3Ry\naW5nLg==')", "546869732069732061207465737420537472696e672e", "VARBINARY NOT NULL");
f.checkNull("from_base64('-1')");
f.checkNull("from_base64('-100')");
}
use of org.apache.calcite.sql.test.SqlOperatorFixture in project calcite by apache.
the class SqlOperatorTest method testCurrentUserFunc.
@Test
void testCurrentUserFunc() {
final SqlOperatorFixture f = fixture();
f.setFor(SqlStdOperatorTable.CURRENT_USER, VM_FENNEL);
f.checkString("CURRENT_USER", "sa", "VARCHAR(2000) NOT NULL");
}
use of org.apache.calcite.sql.test.SqlOperatorFixture in project calcite by apache.
the class SqlOperatorTest method testLessThanOrEqualOperatorInterval.
@Test
void testLessThanOrEqualOperatorInterval() {
final SqlOperatorFixture f = fixture();
f.checkBoolean("interval '2' day <= interval '1' day", false);
f.checkBoolean("interval '2' day <= interval '5' day", true);
f.checkBoolean("interval '2 2:2:2' day to second <= interval '2' day", false);
f.checkBoolean("interval '2' day <= interval '2' day", true);
f.checkBoolean("interval '2' day <= interval '-2' day", false);
f.checkBoolean("interval '2' day <= interval '2' hour", false);
f.checkBoolean("interval '2' minute <= interval '2' hour", true);
f.checkBoolean("interval '2' second <= interval '2' minute", true);
f.checkNull("cast(null as interval hour) <= interval '2' minute");
f.checkNull("interval '2:2' hour to minute " + "<= cast(null as interval second)");
}
use of org.apache.calcite.sql.test.SqlOperatorFixture in project calcite by apache.
the class SqlOperatorTest method testGroupConcatFunc.
@Test
void testGroupConcatFunc() {
final SqlOperatorFixture f = fixture();
checkGroupConcatFunc(f.withLibrary(SqlLibrary.MYSQL));
checkGroupConcatFuncFails(f.withLibrary(SqlLibrary.BIG_QUERY));
checkGroupConcatFuncFails(f.withLibrary(SqlLibrary.POSTGRESQL));
}
Aggregations