@Test public void testLocalTimeFunc() { tester.setFor(SqlStdOperatorTable.LOCALTIME); tester.checkScalar("LOCALTIME", TIME_PATTERN, "TIME(0) NOT NULL"); tester.checkFails( "^LOCALTIME()^", "No match found for function signature LOCALTIME\\(\\)", false); tester.checkScalar( "LOCALTIME(1)", TIME_PATTERN, "TIME(1) NOT NULL"); final Pair<String, Hook.Closeable> pair = currentTimeString(LOCAL_TZ); tester.checkScalar( "CAST(LOCALTIME AS VARCHAR(30))", Pattern.compile( pair.left.substring(11) + "[0-9][0-9]:[0-9][0-9]"), "VARCHAR(30) NOT NULL"); tester.checkScalar( "LOCALTIME", Pattern.compile( pair.left.substring(11) + "[0-9][0-9]:[0-9][0-9]"), "TIME(0) NOT NULL"); pair.right.close(); }
Pattern.compile(pair.left + "[0-9][0-9]:[0-9][0-9]"), "TIMESTAMP(0) NOT NULL"); pair.right.close();
Pattern.compile(pair.left + "[0-9][0-9]:[0-9][0-9]"), "TIMESTAMP(0) NOT NULL"); pair.right.close();
@Test public void testCurrentTimestampFunc() { tester.setFor(SqlStdOperatorTable.CURRENT_TIMESTAMP); tester.checkScalar( "CURRENT_TIMESTAMP", TIMESTAMP_PATTERN, "TIMESTAMP(0) NOT NULL"); tester.checkFails( "^CURRENT_TIMESTAMP()^", "No match found for function signature CURRENT_TIMESTAMP\\(\\)", false); tester.checkFails( "^CURRENT_TIMESTAMP(4000000000)^", LITERAL_OUT_OF_RANGE_MESSAGE, false); tester.checkScalar( "CURRENT_TIMESTAMP(1)", TIMESTAMP_PATTERN, "TIMESTAMP(1) NOT NULL"); final Pair<String, Hook.Closeable> pair = currentTimeString( CURRENT_TZ); tester.checkScalar( "CAST(CURRENT_TIMESTAMP AS VARCHAR(30))", Pattern.compile(pair.left + "[0-9][0-9]:[0-9][0-9]"), "VARCHAR(30) NOT NULL"); tester.checkScalar( "CURRENT_TIMESTAMP", Pattern.compile(pair.left + "[0-9][0-9]:[0-9][0-9]"), "TIMESTAMP(0) NOT NULL"); pair.right.close(); }
@Test public void testLocalTimeFunc() { tester.setFor(SqlStdOperatorTable.LOCALTIME); tester.checkScalar("LOCALTIME", TIME_PATTERN, "TIME(0) NOT NULL"); tester.checkFails( "^LOCALTIME()^", "No match found for function signature LOCALTIME\\(\\)", false); tester.checkScalar( "LOCALTIME(1)", TIME_PATTERN, "TIME(1) NOT NULL"); final Pair<String, Hook.Closeable> pair = currentTimeString(LOCAL_TZ); tester.checkScalar( "CAST(LOCALTIME AS VARCHAR(30))", Pattern.compile( pair.left.substring(11) + "[0-9][0-9]:[0-9][0-9]"), "VARCHAR(30) NOT NULL"); tester.checkScalar( "LOCALTIME", Pattern.compile( pair.left.substring(11) + "[0-9][0-9]:[0-9][0-9]"), "TIME(0) NOT NULL"); pair.right.close(); }
@Test public void testCurrentTimeFunc() { tester.setFor(SqlStdOperatorTable.CURRENT_TIME); tester.checkScalar( "CURRENT_TIME", TIME_PATTERN, "TIME(0) NOT NULL"); tester.checkFails( "^CURRENT_TIME()^", "No match found for function signature CURRENT_TIME\\(\\)", false); tester.checkScalar( "CURRENT_TIME(1)", TIME_PATTERN, "TIME(1) NOT NULL"); final Pair<String, Hook.Closeable> pair = currentTimeString(CURRENT_TZ); tester.checkScalar( "CAST(CURRENT_TIME AS VARCHAR(30))", Pattern.compile(pair.left.substring(11) + "[0-9][0-9]:[0-9][0-9]"), "VARCHAR(30) NOT NULL"); tester.checkScalar( "CURRENT_TIME", Pattern.compile(pair.left.substring(11) + "[0-9][0-9]:[0-9][0-9]"), "TIME(0) NOT NULL"); pair.right.close(); }
@Test public void testCurrentTimestampFunc() { tester.setFor(SqlStdOperatorTable.CURRENT_TIMESTAMP); tester.checkScalar( "CURRENT_TIMESTAMP", TIMESTAMP_PATTERN, "TIMESTAMP(0) NOT NULL"); tester.checkFails( "^CURRENT_TIMESTAMP()^", "No match found for function signature CURRENT_TIMESTAMP\\(\\)", false); tester.checkFails( "^CURRENT_TIMESTAMP(4000000000)^", LITERAL_OUT_OF_RANGE_MESSAGE, false); tester.checkScalar( "CURRENT_TIMESTAMP(1)", TIMESTAMP_PATTERN, "TIMESTAMP(1) NOT NULL"); final Pair<String, Hook.Closeable> pair = currentTimeString( CURRENT_TZ); tester.checkScalar( "CAST(CURRENT_TIMESTAMP AS VARCHAR(30))", Pattern.compile(pair.left + "[0-9][0-9]:[0-9][0-9]"), "VARCHAR(30) NOT NULL"); tester.checkScalar( "CURRENT_TIMESTAMP", Pattern.compile(pair.left + "[0-9][0-9]:[0-9][0-9]"), "TIMESTAMP(0) NOT NULL"); pair.right.close(); }
@Test public void testCurrentTimeFunc() { tester.setFor(SqlStdOperatorTable.CURRENT_TIME); tester.checkScalar( "CURRENT_TIME", TIME_PATTERN, "TIME(0) NOT NULL"); tester.checkFails( "^CURRENT_TIME()^", "No match found for function signature CURRENT_TIME\\(\\)", false); tester.checkScalar( "CURRENT_TIME(1)", TIME_PATTERN, "TIME(1) NOT NULL"); final Pair<String, Hook.Closeable> pair = currentTimeString(CURRENT_TZ); tester.checkScalar( "CAST(CURRENT_TIME AS VARCHAR(30))", Pattern.compile(pair.left.substring(11) + "[0-9][0-9]:[0-9][0-9]"), "VARCHAR(30) NOT NULL"); tester.checkScalar( "CURRENT_TIME", Pattern.compile(pair.left.substring(11) + "[0-9][0-9]:[0-9][0-9]"), "TIME(0) NOT NULL"); pair.right.close(); }
public static synchronized void removeHook() { if (globalProgramClosable != null) { globalProgramClosable.close(); globalProgramClosable = null; } }
@After public void after() { if (this.closeable != null) { this.closeable.close(); this.closeable = null; } }
@After public void after() { if (this.closeable != null) { this.closeable.close(); this.closeable = null; } }