Tabnine Logo
Description.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
io.prestosql.spi.function.Description
constructor

Best Java code snippets using io.prestosql.spi.function.Description.<init> (Showing top 20 results out of 315)

origin: io.prestosql/presto-main

@Description("absolute value")
@ScalarFunction("abs")
@SqlType(StandardTypes.REAL)
public static long absFloat(@SqlType(StandardTypes.REAL) long num)
{
  return floatToRawIntBits(Math.abs(intBitsToFloat((int) num)));
}
origin: io.prestosql/presto-main

@Description("Euler's number raised to the given power")
@ScalarFunction
@SqlType(StandardTypes.DOUBLE)
public static double exp(@SqlType(StandardTypes.DOUBLE) double num)
{
  return Math.exp(num);
}
origin: io.prestosql/presto-main

@Description("round up to nearest integer")
@ScalarFunction(alias = "ceil")
@SqlType(StandardTypes.BIGINT)
public static long ceiling(@SqlType(StandardTypes.BIGINT) long num)
{
  return num;
}
origin: io.prestosql/presto-main

@Description("round down to nearest integer")
@ScalarFunction("floor")
@SqlType(StandardTypes.INTEGER)
public static long floorInteger(@SqlType(StandardTypes.INTEGER) long num)
{
  return num;
}
origin: io.prestosql/presto-main

@Description("add the specified amount of date to the given date")
@LiteralParameters("x")
@ScalarFunction("date_add")
@SqlType(StandardTypes.DATE)
public static long addFieldValueDate(ConnectorSession session, @SqlType("varchar(x)") Slice unit, @SqlType(StandardTypes.BIGINT) long value, @SqlType(StandardTypes.DATE) long date)
{
  long millis = getDateField(UTC_CHRONOLOGY, unit).add(DAYS.toMillis(date), toIntExact(value));
  return MILLISECONDS.toDays(millis);
}
origin: io.prestosql/presto-main

@Description("second of the minute of the given time")
@ScalarFunction("second")
@SqlType(StandardTypes.BIGINT)
public static long secondFromTime(@SqlType(StandardTypes.TIME) long time)
{
  // No need to check isLegacyTimestamp:
  // * Under legacy semantics, the session zone matters. But a zone always has offset of whole minutes.
  // * Under new semantics, time is agnostic to the session zone.
  return SECOND_OF_MINUTE.get(time);
}
origin: io.prestosql/presto-main

@Description("time zone minute of the given timestamp")
@ScalarFunction("timezone_minute")
@SqlType(StandardTypes.BIGINT)
public static long timeZoneMinuteFromTimestampWithTimeZone(@SqlType(StandardTypes.TIMESTAMP_WITH_TIME_ZONE) long timestampWithTimeZone)
{
  return extractZoneOffsetMinutes(timestampWithTimeZone) % 60;
}
origin: io.prestosql/presto-main

@Description("remainder of given quotient")
@ScalarFunction
@SqlType(StandardTypes.BIGINT)
public static long mod(@SqlType(StandardTypes.BIGINT) long num1, @SqlType(StandardTypes.BIGINT) long num2)
{
  return num1 % num2;
}
origin: io.prestosql/presto-main

@Description("remainder of given quotient")
@ScalarFunction
@SqlType(StandardTypes.DOUBLE)
public static double mod(@SqlType(StandardTypes.DOUBLE) double num1, @SqlType(StandardTypes.DOUBLE) double num2)
{
  return num1 % num2;
}
origin: io.prestosql/presto-main

@Description("convert a number to a string in the given base")
@ScalarFunction
@SqlType("varchar(64)")
public static Slice toBase(@SqlType(StandardTypes.BIGINT) long value, @SqlType(StandardTypes.BIGINT) long radix)
{
  checkRadix(radix);
  return utf8Slice(Long.toString(value, (int) radix));
}
origin: io.prestosql/presto-main

@Description("current time zone")
@ScalarFunction("current_timezone")
@SqlType(StandardTypes.VARCHAR)
public static Slice currentTimeZone(ConnectorSession session)
{
  return utf8Slice(session.getTimeZoneKey().getId());
}
origin: io.prestosql/presto-main

@Description("millisecond of the second of the given time")
@ScalarFunction("millisecond")
@SqlType(StandardTypes.BIGINT)
public static long millisecondFromTimeWithTimeZone(@SqlType(StandardTypes.TIME_WITH_TIME_ZONE) long time)
{
  // No need to check the associated zone here. A zone always has offset of whole minutes.
  return MILLISECOND_OF_SECOND.get(unpackMillisUtc(time));
}
origin: io.prestosql/presto-main

@Description("string(s) extracted using the given pattern")
@ScalarFunction
@LiteralParameters("x")
@SqlType("array(varchar(x))")
public static Block regexpExtractAll(@SqlType("varchar(x)") Slice source, @SqlType(JoniRegexpType.NAME) Regex pattern)
{
  return regexpExtractAll(source, pattern, 0);
}
origin: io.prestosql/presto-main

@Description("day of the month of the given timestamp")
@ScalarFunction(value = "day", alias = "day_of_month")
@SqlType(StandardTypes.BIGINT)
public static long dayFromTimestampWithTimeZone(@SqlType(StandardTypes.TIMESTAMP_WITH_TIME_ZONE) long timestampWithTimeZone)
{
  return unpackChronology(timestampWithTimeZone).dayOfMonth().get(unpackMillisUtc(timestampWithTimeZone));
}
origin: io.prestosql/presto-main

@Description("quarter of the year of the given timestamp")
@ScalarFunction("quarter")
@SqlType(StandardTypes.BIGINT)
public static long quarterFromTimestampWithTimeZone(@SqlType(StandardTypes.TIMESTAMP_WITH_TIME_ZONE) long timestampWithTimeZone)
{
  return QUARTER_OF_YEAR.getField(unpackChronology(timestampWithTimeZone)).get(unpackMillisUtc(timestampWithTimeZone));
}
origin: io.prestosql/presto-main

@SqlNullable
@Description("string extracted using the given pattern")
@ScalarFunction
@LiteralParameters("x")
@SqlType("varchar(x)")
public static Slice regexpExtract(@SqlType("varchar(x)") Slice source, @SqlType(JoniRegexpType.NAME) Regex pattern)
{
  return regexpExtract(source, pattern, 0);
}
origin: io.prestosql/presto-main

@Description("minute of the hour of the given time")
@ScalarFunction("minute")
@SqlType(StandardTypes.BIGINT)
public static long minuteFromTime(ConnectorSession session, @SqlType(StandardTypes.TIME) long time)
{
  if (session.isLegacyTimestamp()) {
    return getChronology(session.getTimeZoneKey()).minuteOfHour().get(time);
  }
  else {
    return MINUTE_OF_HOUR.get(time);
  }
}
origin: io.prestosql/presto-main

@Description("month of the year of the given timestamp")
@ScalarFunction("month")
@SqlType(StandardTypes.BIGINT)
public static long monthFromTimestamp(ConnectorSession session, @SqlType(StandardTypes.TIMESTAMP) long timestamp)
{
  if (session.isLegacyTimestamp()) {
    return getChronology(session.getTimeZoneKey()).monthOfYear().get(timestamp);
  }
  else {
    return MONTH_OF_YEAR.get(timestamp);
  }
}
origin: io.prestosql/presto-main

@Description("truncate to the specified precision")
@ScalarFunction("date_trunc")
@LiteralParameters("x")
@SqlType(StandardTypes.TIME_WITH_TIME_ZONE)
public static long truncateTimeWithTimeZone(@SqlType("varchar(x)") Slice unit, @SqlType(StandardTypes.TIME_WITH_TIME_ZONE) long timeWithTimeZone)
{
  long millis = getTimeField(unpackChronology(timeWithTimeZone), unit).roundFloor(unpackMillisUtc(timeWithTimeZone));
  return updateMillisUtc(millis, timeWithTimeZone);
}
origin: io.prestosql/presto-main

@Description("difference of the given times in the given unit")
@ScalarFunction("date_diff")
@LiteralParameters("x")
@SqlType(StandardTypes.BIGINT)
public static long diffTimestampWithTimeZone(
    @SqlType("varchar(x)") Slice unit,
    @SqlType(StandardTypes.TIMESTAMP_WITH_TIME_ZONE) long timestampWithTimeZone1,
    @SqlType(StandardTypes.TIMESTAMP_WITH_TIME_ZONE) long timestampWithTimeZone2)
{
  return getTimestampField(unpackChronology(timestampWithTimeZone1), unit).getDifferenceAsLong(unpackMillisUtc(timestampWithTimeZone2), unpackMillisUtc(timestampWithTimeZone1));
}
io.prestosql.spi.functionDescription<init>

Popular methods of Description

  • value

Popular in Java

  • Reactive rest calls using spring rest template
  • getResourceAsStream (ClassLoader)
  • runOnUiThread (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • Permission (java.security)
    Legacy security code; do not use.
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now