@Test public void testTimestampDiffCalendarBasedWeek1() throws Exception { assertEquals(Long.valueOf(0), FunctionMethods.timestampDiff(NonReserved.SQL_TSI_WEEK, new Timestamp(TimestampUtil.createDate(113, 2, 3).getTime()), new Timestamp(TimestampUtil.createDate(113, 2, 4).getTime()), true)); }
public static Long timestampDiff(String intervalType, Timestamp ts1Obj, Timestamp ts2Obj) throws FunctionExecutionException { return timestampDiff(intervalType, ts1Obj, ts2Obj, CALENDAR_TIMESTAMPDIFF); }
FunctionMethods { public static Long timestampDiff(String intervalType, Timestamp ts1Obj, Timestamp ts2Obj) throws FunctionExecutionException { return timestampDiff(intervalType, ts1Obj, ts2Obj, CALENDAR_TIMESTAMPDIFF); } }
FunctionMethods { public static Long timestampDiff(String intervalType, Timestamp ts1Obj, Timestamp ts2Obj) throws FunctionExecutionException { return timestampDiff(intervalType, ts1Obj, ts2Obj, CALENDAR_TIMESTAMPDIFF); }  }
FunctionMethods { public static Long timestampDiff(String intervalType, Timestamp ts1Obj, Timestamp ts2Obj) throws FunctionExecutionException { return timestampDiff(intervalType, ts1Obj, ts2Obj, CALENDAR_TIMESTAMPDIFF); }  static int plus(int x, int y); static int integerRangeCheck(long result); static long plus(long x, long y); static float plus(float x, float y); static double plus(double x, double y); static Object plus(BigInteger x, BigInteger y); static Object plus(BigDecimal x, BigDecimal y); static int minus(int x, int y); static long minus(long x, long y); static float minus(float x, float y); static double minus(double x, double y); static Object minus(BigInteger x, BigInteger y); static Object minus(BigDecimal x, BigDecimal y); static int multiply(int x, int y); static long multiply(long x, long y); static float multiply(float x, float y); static double multiply(double x, double y); static Object multiply(BigInteger x, BigInteger y); static Object multiply(BigDecimal x, BigDecimal y); static int divide(int x, int y); static long divide(long x, long y); static float divide(float x, float y); static double divide(double x, double y); static Object divide(BigInteger x, BigInteger y); static Object divide(BigDecimal x, BigDecimal y); static int abs(int x); static long abs(long x); static float abs(float x); static double abs(double x); static Object abs(BigInteger x); static Object abs(BigDecimal x); static Object ceiling(Number x); static Object exp(Number x); static Object floor(Number x); static Object log(Number x); static Object log10(Number x); static Object rand(CommandContext context, Integer seed); static Object rand(CommandContext context); static int mod(int x, int y); static long mod(long x, long y); static float mod(float x, float y); static double mod(double x, double y); static Object mod(BigInteger x, BigInteger y); static Object mod(BigDecimal x, BigDecimal y); static double power(double x, double y); static BigInteger power(BigInteger x, int y); static BigDecimal power(BigDecimal x, int y); static int round(int number, int places); static float round(float number, int places); static double round(double number, int places); static BigDecimal round(BigDecimal bigDecimalNumber, int places); static Object sign(int x); static Object sign(long x); static Object sign(float x); static Object sign(double x); static Object sign(BigInteger x); static Object sign(BigDecimal x); static Object sqrt(Number x); static Object currentDate(CommandContext context); static Object currentTime(CommandContext context); static Object currentTimestamp(CommandContext context); static Object dayName(Date x); static Object dayOfMonth(Date x); static int dayOfWeek(Date x); static Object dayOfYear(Date x); static Object hour(Date x); static Object minute(Date x); static Object month(Date x); static Object monthName(Date x); static Object second(Date x); static int week(Date x); static Object year(Date x); static Object quarter(Date date); @TeiidFunction(category=FunctionCategoryConstants.DATETIME, nullOnNull=true, pushdown=PushDown.CAN_PUSHDOWN) static double epoch(Timestamp date); @TeiidFunction(category=FunctionCategoryConstants.DATETIME, pushdown=PushDown.CAN_PUSHDOWN) static String from_unixtime(long count); @TeiidFunction(category=FunctionCategoryConstants.DATETIME, nullOnNull=true, pushdown=PushDown.CAN_PUSHDOWN) static Long unix_timestamp(String date); @TeiidFunction(category=FunctionCategoryConstants.DATETIME, pushdown=PushDown.CAN_PUSHDOWN) static Timestamp from_millis(long millis); @TeiidFunction(category=FunctionCategoryConstants.DATETIME, nullOnNull=true, pushdown=PushDown.CAN_PUSHDOWN) static Long to_millis(Timestamp date); static Object timestampAdd(String intervalType, int count, Timestamp timestamp); static Object timestampAdd(String intervalType, long count, Timestamp timestamp); static Long timestampDiff(String intervalType, Timestamp ts1Obj, Timestamp ts2Obj); static Long timestampDiff(String intervalType, Timestamp ts1Obj, Timestamp ts2Obj, boolean calendarBased); static Object timestampCreate(java.sql.Date date, Time time); static Object length(String str); static String concat(String str1, String str2); static String concat2(String str1, String str2); static ClobType concat(CommandContext context, ClobType str1, ClobType str2); static ClobType concat2(CommandContext context, ClobType str1, ClobType str2); static Object substring(String string, Integer startVal, Integer lengthVal); static Object substring(String string, Integer start); static Object left(String string, Integer count); static Object right(String string, Integer count); static Object lowerCase(String str); static ClobType lowerCase(ClobType str); static Object upperCase(String str); static ClobType upperCase(ClobType str); static Object locate(String sub, String str); static Object endsWith(String sub, String str); static Object locate(String sub, String str, Integer start); static String trim(String trimSpec, String trimChar, String string); static String leftTrim(String string, char trimChar); static String leftTrim(String string); static String rightTrim(String string, char trimChar); static String rightTrim(String string, char trimChar, boolean newString); static Object rightTrim(String string); static Object replace(String string, String subString, String replaceString); static Object insert(String string1, Integer start, Integer length, String str2); static Object repeat(String str, Integer count); static Integer ascii(String ch); static Integer ascii(Character ch); static Object chr(int intValue); static Object initCap(String s); static Object lpad(String inputString, Integer padLength, String padStr); static Object pad(String str, Integer padLength, String padStr, boolean left); static Object lpad(String inputString, Integer padLength); static Object rpad(String inputString, Integer padLength, String padStr); static Object rpad(String inputString, Integer padLength); static Object translate(String str, String in, String out); static Object convert(CommandContext context, Object src, String type); static Object lookup(Object codeTable, Object returnElement, Object keyElement, Object keyValue); static Object ifnull(Object value, Object ifNullValue); static Object coalesce(Object value, Object value1, Object... other); static String format(CommandContext context, Date date, String format); static Timestamp parseTimestamp(CommandContext context, String timestamp, String format); static String format(CommandContext context, Number number, String format); static Object parseInteger(CommandContext context, String number, String format); static Object parseLong(CommandContext context, String number, String format); static Object parseDouble(CommandContext context, String number, String format); static Object parseFloat(CommandContext context, String number, String format); static Object parseBigInteger(CommandContext context, String number, String format); static BigDecimal parseBigDecimal(CommandContext context, String number, String format); static Object acos(Number number); static Object asin(Number number); static Object atan(Number number); static Object atan2(Number number1, Number number2); static Object cos(Number number); static Object cot(Number number); static Object degrees(Number number); static Object pi(); static Object radians(Number number); static Object sin(Number number); static Object tan(Number number); static Object bitand(int x, int y); static Object bitor(int x, int y); static Object bitxor(int x, int y); static int bitnot(int x); static Object user(CommandContext context); static Object user(CommandContext context, boolean includeSecurityDomain); static Object current_database(CommandContext context); static Object commandPayload(CommandContext context); static Object commandPayload(CommandContext context, String param); static Object env(String propertyName); static Object sys_prop(String propertyName); static Object env_var(String propertyName); static Object session_id(CommandContext context); @TeiidFunction(category=FunctionCategoryConstants.MISCELLANEOUS, pushdown=PushDown.CANNOT_PUSHDOWN) static String node_id(); static Object modifyTimeZone(Timestamp value, String originalTimezoneString, String targetTimezoneString); static Object modifyTimeZone(CommandContext context, Timestamp value, String targetTimezoneString); @TeiidFunction(category=FunctionCategoryConstants.CONVERSION, name="to_chars", nullOnNull=true) static ClobType toChars(BlobType value, String encoding); @TeiidFunction(category=FunctionCategoryConstants.CONVERSION, name="to_chars") static ClobType toChars(BlobType value, String encoding, boolean wellFormed); @TeiidFunction(category=FunctionCategoryConstants.CONVERSION, name="to_bytes", nullOnNull=true) static BlobType toBytes(ClobType value, String encoding); @TeiidFunction(category=FunctionCategoryConstants.CONVERSION, name="to_bytes") static BlobType toBytes(ClobType value, String encoding, boolean wellFormed); static String unescape(String string); static String uuid(); static Object array_get(Object array, int index); static int array_length(Object array); @TeiidFunction(category=FunctionCategoryConstants.SYSTEM, determinism = Determinism.COMMAND_DETERMINISTIC, pushdown=PushDown.CANNOT_PUSHDOWN) static int mvstatus(CommandContext context, String schemaName, String viewName); @TeiidFunction(category=FunctionCategoryConstants.SYSTEM) static String[] tokenize(String str, char delimiter); @TeiidFunction(name=SourceSystemFunctions.REGEXP_REPLACE, category=FunctionCategoryConstants.STRING, nullOnNull=true) static String regexpReplace(CommandContext context,
                                       String source,
                                       String regex,
                                       String replacement); @TeiidFunction(name=SourceSystemFunctions.REGEXP_REPLACE, category=FunctionCategoryConstants.STRING, nullOnNull=true) static ClobType regexpReplace(CommandContext context,
                                    ClobType source,
                                    String regex,
                                    String replacement); @TeiidFunction(name=SourceSystemFunctions.REGEXP_REPLACE, category=FunctionCategoryConstants.STRING, nullOnNull=true) static String regexpReplace(CommandContext context,
                                String source,
                                String regex,
                                String replacement,
                                String flags); @TeiidFunction(name=SourceSystemFunctions.REGEXP_REPLACE, category=FunctionCategoryConstants.STRING, nullOnNull=true) static ClobType regexpReplace(CommandContext context,
                                ClobType source,
                                String regex,
                                String replacement,
                                String flags); static String regexpReplace(CommandContext context,
                                       CharSequence source,
                                       String regex,
                                       String replacement,
                                       String flags); @TeiidFunction(category=FunctionCategoryConstants.SECURITY, nullOnNull=true) static BinaryType md5(String plainText); @TeiidFunction(category=FunctionCategoryConstants.SECURITY, nullOnNull=true) static BinaryType sha1(String plainText); @TeiidFunction(category=FunctionCategoryConstants.SECURITY, nullOnNull=true) static BinaryType sha2_256(String plainText); @TeiidFunction(category=FunctionCategoryConstants.SECURITY, nullOnNull=true) static BinaryType sha2_512(String plainText); @TeiidFunction(category=FunctionCategoryConstants.SECURITY, nullOnNull=true) static BinaryType md5(BinaryType plainText); @TeiidFunction(category=FunctionCategoryConstants.SECURITY, nullOnNull=true) static BinaryType sha1(BinaryType plainText); @TeiidFunction(category=FunctionCategoryConstants.SECURITY, nullOnNull=true) static BinaryType sha2_256(BinaryType plainText); @TeiidFunction(category=FunctionCategoryConstants.SECURITY, nullOnNull=true) static BinaryType sha2_512(BinaryType plainText); static BinaryType digest(byte[] plainText, String algorithm); @TeiidFunction(category=FunctionCategoryConstants.SECURITY, nullOnNull=true) static BinaryType aes_encrypt(BinaryType dataBytes, BinaryType keyBytes); @TeiidFunction(category=FunctionCategoryConstants.SECURITY, nullOnNull=true) static BinaryType aes_decrypt(BinaryType dataBytes, BinaryType keyBytes); @TeiidFunction(category=FunctionCategoryConstants.DATETIME, pushdown=PushDown.CAN_PUSHDOWN) static Time current_time(CommandContext context, int precision); @TeiidFunction(category=FunctionCategoryConstants.DATETIME, pushdown=PushDown.CAN_PUSHDOWN) static Timestamp current_timestamp(CommandContext context, int precision); }
FunctionMethods { public static Long timestampDiff(String intervalType, Timestamp ts1Obj, Timestamp ts2Obj) throws FunctionExecutionException { return timestampDiff(intervalType, ts1Obj, ts2Obj, CALENDAR_TIMESTAMPDIFF); }  static int plus(int x, int y); static int integerRangeCheck(long result); static long plus(long x, long y); static float plus(float x, float y); static double plus(double x, double y); static Object plus(BigInteger x, BigInteger y); static Object plus(BigDecimal x, BigDecimal y); static int minus(int x, int y); static long minus(long x, long y); static float minus(float x, float y); static double minus(double x, double y); static Object minus(BigInteger x, BigInteger y); static Object minus(BigDecimal x, BigDecimal y); static int multiply(int x, int y); static long multiply(long x, long y); static float multiply(float x, float y); static double multiply(double x, double y); static Object multiply(BigInteger x, BigInteger y); static Object multiply(BigDecimal x, BigDecimal y); static int divide(int x, int y); static long divide(long x, long y); static float divide(float x, float y); static double divide(double x, double y); static Object divide(BigInteger x, BigInteger y); static Object divide(BigDecimal x, BigDecimal y); static int abs(int x); static long abs(long x); static float abs(float x); static double abs(double x); static Object abs(BigInteger x); static Object abs(BigDecimal x); static Object ceiling(Number x); static Object exp(Number x); static Object floor(Number x); static Object log(Number x); static Object log10(Number x); static Object rand(CommandContext context, Integer seed); static Object rand(CommandContext context); static int mod(int x, int y); static long mod(long x, long y); static float mod(float x, float y); static double mod(double x, double y); static Object mod(BigInteger x, BigInteger y); static Object mod(BigDecimal x, BigDecimal y); static double power(double x, double y); static BigInteger power(BigInteger x, int y); static BigDecimal power(BigDecimal x, int y); static int round(int number, int places); static float round(float number, int places); static double round(double number, int places); static BigDecimal round(BigDecimal bigDecimalNumber, int places); static Object sign(int x); static Object sign(long x); static Object sign(float x); static Object sign(double x); static Object sign(BigInteger x); static Object sign(BigDecimal x); static Object sqrt(Number x); static Object currentDate(CommandContext context); static Object currentTime(CommandContext context); static Object currentTimestamp(CommandContext context); static Object dayName(Date x); static Object dayOfMonth(Date x); static int dayOfWeek(Date x); static Object dayOfYear(Date x); static Object hour(Date x); static Object minute(Date x); static Object month(Date x); static Object monthName(Date x); static Object second(Date x); static int week(Date x); static Object year(Date x); static Object quarter(Date date); @TeiidFunction(category=FunctionCategoryConstants.DATETIME, nullOnNull=true, pushdown=PushDown.CAN_PUSHDOWN) static double epoch(Timestamp date); @TeiidFunction(category=FunctionCategoryConstants.DATETIME, pushdown=PushDown.CAN_PUSHDOWN) static String from_unixtime(long count); @TeiidFunction(category=FunctionCategoryConstants.DATETIME, nullOnNull=true, pushdown=PushDown.CAN_PUSHDOWN) static Long unix_timestamp(String date); @TeiidFunction(category=FunctionCategoryConstants.DATETIME, pushdown=PushDown.CAN_PUSHDOWN) static Timestamp from_millis(long millis); @TeiidFunction(category=FunctionCategoryConstants.DATETIME, nullOnNull=true, pushdown=PushDown.CAN_PUSHDOWN) static Long to_millis(Timestamp date); static Object timestampAdd(String intervalType, int count, Timestamp timestamp); static Object timestampAdd(String intervalType, long count, Timestamp timestamp); static Long timestampDiff(String intervalType, Timestamp ts1Obj, Timestamp ts2Obj); static Long timestampDiff(String intervalType, Timestamp ts1Obj, Timestamp ts2Obj, boolean calendarBased); static Object timestampCreate(java.sql.Date date, Time time); static Object length(String str); static String concat(String str1, String str2); static String concat2(String str1, String str2); static ClobType concat(CommandContext context, ClobType str1, ClobType str2); static ClobType concat2(CommandContext context, ClobType str1, ClobType str2); static Object substring(String string, Integer startVal, Integer lengthVal); static Object substring(String string, Integer start); static Object left(String string, Integer count); static Object right(String string, Integer count); static Object lowerCase(String str); static ClobType lowerCase(ClobType str); static Object upperCase(String str); static ClobType upperCase(ClobType str); static Object locate(String sub, String str); static Object endsWith(String sub, String str); static Object locate(String sub, String str, Integer start); static String trim(String trimSpec, String trimChar, String string); static String leftTrim(String string, char trimChar); static String leftTrim(String string); static String rightTrim(String string, char trimChar); static String rightTrim(String string, char trimChar, boolean newString); static Object rightTrim(String string); static Object replace(String string, String subString, String replaceString); static Object insert(String string1, Integer start, Integer length, String str2); static Object repeat(String str, Integer count); static Integer ascii(String ch); static Integer ascii(Character ch); static Object chr(int intValue); static Object initCap(String s); static Object lpad(String inputString, Integer padLength, String padStr); static Object pad(String str, Integer padLength, String padStr, boolean left); static Object lpad(String inputString, Integer padLength); static Object rpad(String inputString, Integer padLength, String padStr); static Object rpad(String inputString, Integer padLength); static Object translate(String str, String in, String out); static Object convert(CommandContext context, Object src, String type); static Object lookup(Object codeTable, Object returnElement, Object keyElement, Object keyValue); static Object ifnull(Object value, Object ifNullValue); static Object coalesce(Object value, Object value1, Object... other); static String format(CommandContext context, Date date, String format); static Timestamp parseTimestamp(CommandContext context, String timestamp, String format); static String format(CommandContext context, Number number, String format); static Object parseInteger(CommandContext context, String number, String format); static Object parseLong(CommandContext context, String number, String format); static Object parseDouble(CommandContext context, String number, String format); static Object parseFloat(CommandContext context, String number, String format); static Object parseBigInteger(CommandContext context, String number, String format); static BigDecimal parseBigDecimal(CommandContext context, String number, String format); static Object acos(Number number); static Object asin(Number number); static Object atan(Number number); static Object atan2(Number number1, Number number2); static Object cos(Number number); static Object cot(Number number); static Object degrees(Number number); static Object pi(); static Object radians(Number number); static Object sin(Number number); static Object tan(Number number); static Object bitand(int x, int y); static Object bitor(int x, int y); static Object bitxor(int x, int y); static int bitnot(int x); static Object user(CommandContext context); static Object user(CommandContext context, boolean includeSecurityDomain); static Object current_database(CommandContext context); static Object commandPayload(CommandContext context); static Object commandPayload(CommandContext context, String param); static Object env(String propertyName); static Object sys_prop(String propertyName); static Object env_var(String propertyName); static Object session_id(CommandContext context); @TeiidFunction(category=FunctionCategoryConstants.MISCELLANEOUS, pushdown=PushDown.CANNOT_PUSHDOWN) static String node_id(); static Object modifyTimeZone(Timestamp value, String originalTimezoneString, String targetTimezoneString); static Object modifyTimeZone(CommandContext context, Timestamp value, String targetTimezoneString); @TeiidFunction(category=FunctionCategoryConstants.CONVERSION, name="to_chars", nullOnNull=true) static ClobType toChars(BlobType value, String encoding); @TeiidFunction(category=FunctionCategoryConstants.CONVERSION, name="to_chars") static ClobType toChars(BlobType value, String encoding, boolean wellFormed); @TeiidFunction(category=FunctionCategoryConstants.CONVERSION, name="to_bytes", nullOnNull=true) static BlobType toBytes(ClobType value, String encoding); @TeiidFunction(category=FunctionCategoryConstants.CONVERSION, name="to_bytes") static BlobType toBytes(ClobType value, String encoding, boolean wellFormed); static String unescape(String string); static String uuid(); static Object array_get(Object array, int index); static int array_length(Object array); @TeiidFunction(category=FunctionCategoryConstants.SYSTEM, determinism = Determinism.COMMAND_DETERMINISTIC, pushdown=PushDown.CANNOT_PUSHDOWN) static int mvstatus(CommandContext context, String schemaName, String viewName); @TeiidFunction(category=FunctionCategoryConstants.SYSTEM) static String[] tokenize(String str, char delimiter); @TeiidFunction(name=SourceSystemFunctions.REGEXP_REPLACE, category=FunctionCategoryConstants.STRING, nullOnNull=true) static String regexpReplace(CommandContext context,
                                       String source,
                                       String regex,
                                       String replacement); @TeiidFunction(name=SourceSystemFunctions.REGEXP_REPLACE, category=FunctionCategoryConstants.STRING, nullOnNull=true) static ClobType regexpReplace(CommandContext context,
                                    ClobType source,
                                    String regex,
                                    String replacement); @TeiidFunction(name=SourceSystemFunctions.REGEXP_REPLACE, category=FunctionCategoryConstants.STRING, nullOnNull=true) static String regexpReplace(CommandContext context,
                                String source,
                                String regex,
                                String replacement,
                                String flags); @TeiidFunction(name=SourceSystemFunctions.REGEXP_REPLACE, category=FunctionCategoryConstants.STRING, nullOnNull=true) static ClobType regexpReplace(CommandContext context,
                                ClobType source,
                                String regex,
                                String replacement,
                                String flags); static String regexpReplace(CommandContext context,
                                       CharSequence source,
                                       String regex,
                                       String replacement,
                                       String flags); @TeiidFunction(category=FunctionCategoryConstants.SECURITY, nullOnNull=true) static BinaryType md5(String plainText); @TeiidFunction(category=FunctionCategoryConstants.SECURITY, nullOnNull=true) static BinaryType sha1(String plainText); @TeiidFunction(category=FunctionCategoryConstants.SECURITY, nullOnNull=true) static BinaryType sha2_256(String plainText); @TeiidFunction(category=FunctionCategoryConstants.SECURITY, nullOnNull=true) static BinaryType sha2_512(String plainText); @TeiidFunction(category=FunctionCategoryConstants.SECURITY, nullOnNull=true) static BinaryType md5(BinaryType plainText); @TeiidFunction(category=FunctionCategoryConstants.SECURITY, nullOnNull=true) static BinaryType sha1(BinaryType plainText); @TeiidFunction(category=FunctionCategoryConstants.SECURITY, nullOnNull=true) static BinaryType sha2_256(BinaryType plainText); @TeiidFunction(category=FunctionCategoryConstants.SECURITY, nullOnNull=true) static BinaryType sha2_512(BinaryType plainText); static BinaryType digest(byte[] plainText, String algorithm); @TeiidFunction(category=FunctionCategoryConstants.SECURITY, nullOnNull=true) static BinaryType aes_encrypt(BinaryType dataBytes, BinaryType keyBytes); @TeiidFunction(category=FunctionCategoryConstants.SECURITY, nullOnNull=true) static BinaryType aes_decrypt(BinaryType dataBytes, BinaryType keyBytes); @TeiidFunction(category=FunctionCategoryConstants.DATETIME, pushdown=PushDown.CAN_PUSHDOWN) static Time current_time(CommandContext context, int precision); @TeiidFunction(category=FunctionCategoryConstants.DATETIME, pushdown=PushDown.CAN_PUSHDOWN) static Timestamp current_timestamp(CommandContext context, int precision); static final String AT; static final String SPACE_CHAR; }