Package dev.frostlake.types
Class IntegerResultWidths
java.lang.Object
dev.frostlake.types.IntegerResultWidths
The declared PRECISION of the integer-returning functions, which is not one number. A NUMBER column
is NUMBER(38,0) and so is anything derived arithmetically from it, but a function that returns a
COUNT, a LENGTH, a POSITION or a DATE PART declares only as many digits as its result can occupy —
and the account distinguishes five widths, every one of them measured here rather than reasoned:
2 MONTH DAY DAYOFMONTH DAYOFWEEK DAYOFWEEKISO WEEK WEEKISO WEEKOFYEAR QUARTER
HOUR MINUTE SECOND
4 YEAR DAYOFYEAR YEAROFWEEK YEAROFWEEKISO ASCII JAROWINKLER_SIMILARITY
9 CHARINDEX POSITION ARRAY_SIZE ARRAY_POSITION DATEDIFF TIMESTAMPDIFF EDITDISTANCE
18 LENGTH LEN OCTET_LENGTH RTRIMMED_LENGTH UNICODE REGEXP_INSTR REGEXP_COUNT
COUNT ROW_NUMBER RANK DENSE_RANK NTILE
19 BIT_LENGTH HASH
37 FACTORIAL
38 BITAND BITOR BITXOR BITNOT BITSHIFTLEFT BITSHIFTRIGHT BITCOUNT GETBIT AS_INTEGER
The widths track what the value can BE — two digits for a month, nine for a position in a string, eighteen for a row count, nineteen for a signed 64-bit hash — but do not derive them from that story: DAYOFYEAR is four where DAYOFWEEK is two, BIT_LENGTH is nineteen where OCTET_LENGTH is eighteen, ASCII is four where UNICODE is eighteen though both name a code point, and FACTORIAL stops one digit short of the widest NUMBER. Measure the function, then add it.
This table is for functions whose width is a CONSTANT. The ones that derive it from their input — the rounding family, whose precision follows the argument's, and SIGN, which passes an approximate straight through — do not belong here.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final NumericTypeA length, a count, a row number — the widest of the ordinary counters.static final NumericTypeA date part that cannot exceed two digits: a month, a day, an hour, a week, a quarter.static final NumericTypeA factorial, which stops one digit short of the widest NUMBER.static final NumericTypeA position within a string or array, and the difference between two temporals.static final NumericTypeA bit length or a hash, which need the extra digit a signed 64-bit value can reach.static final NumericTypeThe widest NUMBER, which a difference counted in fractions of a second needs.static final NumericTypeA year, a day of the year, a year-of-week. -
Method Summary
-
Field Details
-
DATE_PART_SMALL
A date part that cannot exceed two digits: a month, a day, an hour, a week, a quarter. -
YEAR_PART
A year, a day of the year, a year-of-week. -
POSITION
A position within a string or array, and the difference between two temporals. -
COUNTER
A length, a count, a row number — the widest of the ordinary counters. -
WIDE_COUNTER
A bit length or a hash, which need the extra digit a signed 64-bit value can reach. -
FACTORIAL
A factorial, which stops one digit short of the widest NUMBER. -
WIDEST
The widest NUMBER, which a difference counted in fractions of a second needs.
-