use of org.apache.calcite.sql.test.SqlOperatorFixture in project calcite by apache.
the class SqlOperatorTest method testLeastFunc.
@Test
void testLeastFunc() {
final SqlOperatorFixture f = fixture().setFor(SqlLibraryOperators.LEAST, VmName.EXPAND).withLibrary(SqlLibrary.ORACLE);
f.checkString("least('on', 'earth')", "earth", "CHAR(5) NOT NULL");
f.checkString("least('show', 'on', 'earth')", "earth", "CHAR(5) NOT NULL");
f.checkScalar("least(12, CAST(NULL AS INTEGER), 3)", isNullValue(), "INTEGER");
f.checkScalar("least(false, true)", false, "BOOLEAN NOT NULL");
final SqlOperatorFixture f12 = f.forOracle(SqlConformanceEnum.ORACLE_12);
f12.checkString("least('on', 'earth')", "earth", "VARCHAR(5) NOT NULL");
f12.checkString("least('show', 'on', 'earth')", "earth", "VARCHAR(5) NOT NULL");
}
use of org.apache.calcite.sql.test.SqlOperatorFixture in project calcite by apache.
the class SqlOperatorTest method testSecond.
@Test
void testSecond() {
final SqlOperatorFixture f = fixture();
f.setFor(SqlStdOperatorTable.SECOND, VM_FENNEL, VM_JAVA);
f.checkScalar("second(timestamp '2008-1-23 12:34:56')", "56", "BIGINT NOT NULL");
f.checkNull("second(cast(null as timestamp))");
}
use of org.apache.calcite.sql.test.SqlOperatorFixture in project calcite by apache.
the class SqlOperatorTest method testSha1.
@Test
void testSha1() {
final SqlOperatorFixture f = fixture().setFor(SqlLibraryOperators.SHA1).withLibrary(SqlLibrary.MYSQL);
f.checkString("sha1(x'')", "da39a3ee5e6b4b0d3255bfef95601890afd80709", "VARCHAR NOT NULL");
f.checkString("sha1('')", "da39a3ee5e6b4b0d3255bfef95601890afd80709", "VARCHAR NOT NULL");
f.checkString("sha1('ABC')", "3c01bdbb26f358bab27f267924aa2c9a03fcfdb8", "VARCHAR NOT NULL");
f.checkString("sha1(x'414243')", "3c01bdbb26f358bab27f267924aa2c9a03fcfdb8", "VARCHAR NOT NULL");
}
use of org.apache.calcite.sql.test.SqlOperatorFixture in project calcite by apache.
the class SqlOperatorTest method testIsFalseOperator.
@Test
void testIsFalseOperator() {
final SqlOperatorFixture f = fixture();
f.setFor(SqlStdOperatorTable.IS_FALSE, VmName.EXPAND);
f.checkBoolean("false is false", true);
f.checkBoolean("true is false", false);
f.checkBoolean("cast(null as boolean) is false", false);
}
use of org.apache.calcite.sql.test.SqlOperatorFixture in project calcite by apache.
the class SqlOperatorTest method testUpperFunc.
@Test
void testUpperFunc() {
final SqlOperatorFixture f = fixture();
f.setFor(SqlStdOperatorTable.UPPER, VmName.EXPAND);
f.checkString("upper('a')", "A", "CHAR(1) NOT NULL");
f.checkString("upper('A')", "A", "CHAR(1) NOT NULL");
f.checkString("upper('1')", "1", "CHAR(1) NOT NULL");
f.checkString("upper('aa')", "AA", "CHAR(2) NOT NULL");
f.checkNull("upper(cast(null as varchar(1)))");
}
Aggregations