code stringlengths 25 201k | docstring stringlengths 19 96.2k | func_name stringlengths 0 235 | language stringclasses 1 value | repo stringlengths 8 51 | path stringlengths 11 314 | url stringlengths 62 377 | license stringclasses 7 values |
|---|---|---|---|---|---|---|---|
public OutType overlay(InType newString, InType starting, InType length) {
return toApiSpecificExpression(
unresolvedCall(
OVERLAY,
toExpr(),
objectToExpression(newString),
objectToExpression(starting),
objectToExpression(length)));
} | Replaces a substring of string with a string starting at a position (starting at 1). The
length specifies how many characters should be removed.
<p>e.g. lit("xxxxxtest").overlay("xxxx", 6, 2) leads to "xxxxxxxxxst" | overlay | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType regexp(InType regex) {
return toApiSpecificExpression(unresolvedCall(REGEXP, toExpr(), objectToExpression(regex)));
} | Returns TRUE if any (possibly empty) substring matches the Java regular expression, otherwise
FALSE. Returns NULL if any of arguments is NULL. | regexp | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType regexpCount(InType regex) {
return toApiSpecificExpression(
unresolvedCall(REGEXP_COUNT, toExpr(), objectToExpression(regex)));
} | Returns the number of times {@code str} matches the {@code regex} pattern. {@code regex} must
be a Java regular expression.
@param regex A STRING expression with a matching pattern.
@return An INTEGER representation of the number of matches. <br>
null if any of the arguments are null or {@code regex} is invalid. | regexpCount | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType regexpReplace(InType regex, InType replacement) {
return toApiSpecificExpression(
unresolvedCall(
REGEXP_REPLACE,
toExpr(),
objectToExpression(regex),
objectToExpression(replacement)));
} | Returns a string with all substrings that match the regular expression consecutively being
replaced. | regexpReplace | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType regexpExtract(InType regex) {
return toApiSpecificExpression(
unresolvedCall(REGEXP_EXTRACT, toExpr(), objectToExpression(regex)));
} | Returns a string extracted with a specified regular expression. | regexpExtract | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType regexpExtractAll(InType regex, InType extractIndex) {
return toApiSpecificExpression(
unresolvedCall(
REGEXP_EXTRACT_ALL,
toExpr(),
objectToExpression(regex),
objectToExpression(extractIndex)));
} | Extracts all the substrings in {@code str} that match the {@code regex} expression and
correspond to the regex group {@code extractIndex}. <br>
{@code regex} may contain multiple groups. {@code extractIndex} indicates which regex group
to extract and starts from 1, also the default value if not specified. 0 means matching the
entire regular expression.
@param regex A STRING expression with a matching pattern.
@param extractIndex An optional INTEGER expression with default 1.
@return An ARRAY<STRING> of all the matched substrings. <br>
null if any of the arguments are null or invalid. | regexpExtractAll | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType regexpExtractAll(InType regex) {
return toApiSpecificExpression(
unresolvedCall(REGEXP_EXTRACT_ALL, toExpr(), objectToExpression(regex)));
} | Extracts all the strings in str that match the regex expression. | regexpExtractAll | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType regexpInstr(InType regex) {
return toApiSpecificExpression(
unresolvedCall(REGEXP_INSTR, toExpr(), objectToExpression(regex)));
} | Returns the position of the first substring in {@code str} that matches {@code regex}. <br>
Result indexes begin at 1, 0 if there is no match. <br>
@param regex A STRING expression with a matching pattern.
@return An INTEGER representation of the first matched substring index. <br>
null if any of the arguments are null or {@code regex} is invalid. | regexpInstr | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType regexpSubstr(InType regex) {
return toApiSpecificExpression(
unresolvedCall(REGEXP_SUBSTR, toExpr(), objectToExpression(regex)));
} | Returns the first substring in {@code str} that matches {@code regex}.
@param regex A STRING expression with a matching pattern.
@return A STRING representation of the first matched substring. <br>
null if any of the arguments are null or {@code regex} is invalid or pattern is not
found. | regexpSubstr | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType jsonQuote() {
return toApiSpecificExpression(unresolvedCall(JSON_QUOTE, objectToExpression(toExpr())));
} | Returns a string by quotes a string as a JSON value and wrapping it with double quote
characters. | jsonQuote | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType jsonUnquote() {
return toApiSpecificExpression(unresolvedCall(JSON_UNQUOTE, objectToExpression(toExpr())));
} | Returns a string by unquoting JSON value. | jsonUnquote | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType fromBase64() {
return toApiSpecificExpression(unresolvedCall(FROM_BASE64, toExpr()));
} | Returns the base string decoded with base64. | fromBase64 | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType toBase64() {
return toApiSpecificExpression(unresolvedCall(TO_BASE64, toExpr()));
} | Returns the base64-encoded result of the input string. | toBase64 | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType ascii() {
return toApiSpecificExpression(unresolvedCall(ASCII, toExpr()));
} | Returns the numeric value of the first character of the input string. | ascii | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType chr() {
return toApiSpecificExpression(unresolvedCall(CHR, toExpr()));
} | Returns the ASCII character result of the input integer. | chr | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType decode(InType charset) {
return toApiSpecificExpression(
unresolvedCall(DECODE, toExpr(), objectToExpression(charset)));
} | Decodes the first argument into a String using the provided character set. | decode | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType encode(InType charset) {
return toApiSpecificExpression(
unresolvedCall(ENCODE, toExpr(), objectToExpression(charset)));
} | Encodes the string into a BINARY using the provided character set. | encode | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType left(InType len) {
return toApiSpecificExpression(unresolvedCall(LEFT, toExpr(), objectToExpression(len)));
} | Returns the leftmost integer characters from the input string. | left | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType right(InType len) {
return toApiSpecificExpression(unresolvedCall(RIGHT, toExpr(), objectToExpression(len)));
} | Returns the rightmost integer characters from the input string. | right | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType instr(InType str) {
return toApiSpecificExpression(unresolvedCall(INSTR, toExpr(), objectToExpression(str)));
} | Returns the position of the first occurrence of the input string. | instr | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType locate(InType str) {
return toApiSpecificExpression(unresolvedCall(LOCATE, toExpr(), objectToExpression(str)));
} | Returns the position of the first occurrence in the input string. | locate | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType locate(InType str, InType pos) {
return toApiSpecificExpression(
unresolvedCall(LOCATE, toExpr(), objectToExpression(str), objectToExpression(pos)));
} | Returns the position of the first occurrence in the input string after position integer. | locate | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType urlDecode() {
return toApiSpecificExpression(unresolvedCall(URL_DECODE, toExpr()));
} | Decodes a given string in 'application/x-www-form-urlencoded' format using the UTF-8 encoding
scheme. If the input is null, or there is an issue with the decoding process(such as
encountering an illegal escape pattern), or the encoding scheme is not supported, will return
null. | urlDecode | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType urlEncode() {
return toApiSpecificExpression(unresolvedCall(URL_ENCODE, toExpr()));
} | Translates a string into 'application/x-www-form-urlencoded' format using the UTF-8 encoding
scheme. If the input is null, or there is an issue with the encoding process, or the encoding
scheme is not supported, will return null. | urlEncode | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public final OutType printf(InType... obj) {
Expression[] args =
Stream.concat(
Stream.of(toExpr()),
Arrays.stream(obj).map(ApiExpressionUtils::objectToExpression))
.toArray(Expression[]::new);
return toApiSpecificExpression(unresolvedCall(PRINTF, args));
} | Returns a formatted string from printf-style format string. The function exploits the {@link
java.util.Formatter} with Locale.US.
@param obj any expression
@return a formatted string. null if {@code format} is null or invalid. | printf | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType ltrim() {
return toApiSpecificExpression(unresolvedCall(LTRIM, toExpr()));
} | Returns a string that removes the left whitespaces from the given string. | ltrim | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType ltrim(InType trimStr) {
return toApiSpecificExpression(
unresolvedCall(LTRIM, toExpr(), objectToExpression(trimStr)));
} | Returns a string that removes the left chars in trimStr from the given string. | ltrim | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType rtrim() {
return toApiSpecificExpression(unresolvedCall(RTRIM, toExpr()));
} | Returns a string that removes the right whitespaces from the given string. | rtrim | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType rtrim(InType trimStr) {
return toApiSpecificExpression(
unresolvedCall(RTRIM, toExpr(), objectToExpression(trimStr)));
} | Returns a string that removes the right chars in trimStr from the given string. | rtrim | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType btrim() {
return toApiSpecificExpression(unresolvedCall(BTRIM, toExpr()));
} | Returns a string that removes the left and right whitespaces from the given string. | btrim | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType btrim(InType trimStr) {
return toApiSpecificExpression(
unresolvedCall(BTRIM, toExpr(), objectToExpression(trimStr)));
} | Returns a string that removes the left and right chars in trimStr from the given string. | btrim | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType splitIndex(InType separator, InType index) {
return toApiSpecificExpression(
unresolvedCall(
SPLIT_INDEX,
toExpr(),
objectToExpression(separator),
objectToExpression(index)));
} | Split target string with custom separator and pick the index-th(start with 0) result.
@param separator custom separator.
@param index index of the result which you want.
@return the string at the index of split results. | splitIndex | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType elt(InType expr, InType... exprs) {
Expression[] args =
Stream.concat(
Stream.of(toExpr(), objectToExpression(expr)),
Arrays.stream(exprs).map(ApiExpressionUtils::objectToExpression))
.toArray(Expression[]::new);
return toApiSpecificExpression(unresolvedCall(ELT, args));
} | Returns the {@code index}-th expression. {@code index} must be an integer between 1 and the
number of expressions.
@param expr a STRING or BINARY expression
@param exprs a STRING or BINARY expression
@return result type is the least common type of all expressions.<br>
null if {@code index} is null or out of range. | elt | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType toDate() {
return toApiSpecificExpression(
unresolvedCall(
CAST,
toExpr(),
typeLiteral(fromLegacyInfoToDataType(SqlTimeTypeInfo.DATE))));
} | Parses a date string in the form "yyyy-MM-dd" to a SQL Date. | toDate | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType toTime() {
return toApiSpecificExpression(
unresolvedCall(
CAST,
toExpr(),
typeLiteral(fromLegacyInfoToDataType(SqlTimeTypeInfo.TIME))));
} | Parses a time string in the form "HH:mm:ss" to a SQL Time. | toTime | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType toTimestamp() {
return toApiSpecificExpression(
unresolvedCall(
CAST,
toExpr(),
typeLiteral(fromLegacyInfoToDataType(SqlTimeTypeInfo.TIMESTAMP))));
} | Parses a timestamp string in the form "yyyy-MM-dd HH:mm:ss[.SSS]" to a SQL Timestamp. | toTimestamp | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType extract(TimeIntervalUnit timeIntervalUnit) {
return toApiSpecificExpression(
unresolvedCall(EXTRACT, valueLiteral(timeIntervalUnit), toExpr()));
} | Extracts parts of a time point or time interval. Returns the part as a long value.
<p>e.g. lit("2006-06-05").toDate().extract(DAY) leads to 5 | extract | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType floor(TimeIntervalUnit timeIntervalUnit) {
return toApiSpecificExpression(
unresolvedCall(FLOOR, toExpr(), valueLiteral(timeIntervalUnit)));
} | Rounds down a time point to the given unit.
<p>e.g. lit("12:44:31").toDate().floor(MINUTE) leads to 12:44:00 | floor | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType ceil(TimeIntervalUnit timeIntervalUnit) {
return toApiSpecificExpression(
unresolvedCall(CEIL, toExpr(), valueLiteral(timeIntervalUnit)));
} | Rounds up a time point to the given unit.
<p>e.g. lit("12:44:31").toDate().ceil(MINUTE) leads to 12:45:00 | ceil | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType get(String name) {
return toApiSpecificExpression(unresolvedCall(GET, toExpr(), valueLiteral(name)));
} | Accesses the field of a Flink composite type (such as Tuple, POJO, etc.) by name and returns
it's value.
@param name name of the field (similar to Flink's field expressions) | get | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType get(int index) {
return toApiSpecificExpression(unresolvedCall(GET, toExpr(), valueLiteral(index)));
} | Accesses the field of a Flink composite type (such as Tuple, POJO, etc.) by index and returns
it's value.
@param index position of the field | get | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType flatten() {
return toApiSpecificExpression(unresolvedCall(FLATTEN, toExpr()));
} | Converts a Flink composite type (such as Tuple, POJO, etc.) and all of its direct subtypes
into a flat representation where every subtype is a separate field. | flatten | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType at(InType index) {
return toApiSpecificExpression(unresolvedCall(AT, toExpr(), objectToExpression(index)));
} | Accesses the element of an array or map based on a key or an index (starting at 1).
@param index key or position of the element (array index starting at 1) | at | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType cardinality() {
return toApiSpecificExpression(unresolvedCall(CARDINALITY, toExpr()));
} | Returns the number of elements of an array or number of entries of a map. | cardinality | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType element() {
return toApiSpecificExpression(unresolvedCall(ARRAY_ELEMENT, toExpr()));
} | Returns the sole element of an array with a single element. Returns null if the array is
empty. Throws an exception if the array has more than one element. | element | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType arrayAppend(InType element) {
return toApiSpecificExpression(
unresolvedCall(ARRAY_APPEND, toExpr(), objectToExpression(element)));
} | Appends an element to the end of the array and returns the result.
<p>If the array itself is null, the function will return null. If an element to add is null,
the null element will be added to the end of the array. The given element is cast implicitly
to the array's element type if necessary. | arrayAppend | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType arrayContains(InType needle) {
return toApiSpecificExpression(
unresolvedCall(ARRAY_CONTAINS, toExpr(), objectToExpression(needle)));
} | Returns whether the given element exists in an array.
<p>Checking for null elements in the array is supported. If the array itself is null, the
function will return null. The given element is cast implicitly to the array's element type
if necessary. | arrayContains | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType arrayDistinct() {
return toApiSpecificExpression(unresolvedCall(ARRAY_DISTINCT, toExpr()));
} | Returns an array with unique elements.
<p>If the array itself is null, the function will return null. Keeps ordering of elements. | arrayDistinct | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType arrayPosition(InType needle) {
return toApiSpecificExpression(
unresolvedCall(ARRAY_POSITION, toExpr(), objectToExpression(needle)));
} | Returns the position of the first occurrence of element in the given array as int. Returns 0
if the given value could not be found in the array. Returns null if either of the arguments
are null
<p>NOTE: that this is not zero based, but 1-based index. The first element in the array has
index 1. | arrayPosition | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType arrayPrepend(InType element) {
return toApiSpecificExpression(
unresolvedCall(ARRAY_PREPEND, toExpr(), objectToExpression(element)));
} | Appends an element to the beginning of the array and returns the result.
<p>If the array itself is null, the function will return null. If an element to add is null,
the null element will be added to the beginning of the array. The given element is cast
implicitly to the array's element type if necessary. | arrayPrepend | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType arrayRemove(InType needle) {
return toApiSpecificExpression(
unresolvedCall(ARRAY_REMOVE, toExpr(), objectToExpression(needle)));
} | Removes all elements that equal to element from array.
<p>If the array itself is null, the function will return null. Keeps ordering of elements. | arrayRemove | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType arrayReverse() {
return toApiSpecificExpression(unresolvedCall(ARRAY_REVERSE, toExpr()));
} | Returns an array in reverse order.
<p>If the array itself is null, the function will return null. | arrayReverse | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType arrayUnion(InType array) {
return toApiSpecificExpression(
unresolvedCall(ARRAY_UNION, toExpr(), objectToExpression(array)));
} | Returns an array of the elements in the union of array1 and array2, without duplicates.
<p>If any of the array is null, the function will return null. | arrayUnion | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType arrayMax() {
return toApiSpecificExpression(unresolvedCall(ARRAY_MAX, toExpr()));
} | Returns the maximum value from the array.
<p>if array itself is null, the function returns null. | arrayMax | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType arrayMin() {
return toApiSpecificExpression(unresolvedCall(ARRAY_MIN, toExpr()));
} | Returns the minimum value from the array.
<p>if array itself is null, the function returns null. | arrayMin | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType mapKeys() {
return toApiSpecificExpression(unresolvedCall(MAP_KEYS, toExpr()));
} | Returns the keys of the map as an array. | mapKeys | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType mapValues() {
return toApiSpecificExpression(unresolvedCall(MAP_VALUES, toExpr()));
} | Returns the values of the map as an array. | mapValues | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType mapEntries() {
return toApiSpecificExpression(unresolvedCall(MAP_ENTRIES, toExpr()));
} | Returns an array of all entries in the given map. | mapEntries | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType mapUnion(InType... inputs) {
Expression[] args =
Stream.concat(
Stream.of(toExpr()),
Arrays.stream(inputs).map(ApiExpressionUtils::objectToExpression))
.toArray(Expression[]::new);
return toApiSpecificExpression(unresolvedCall(MAP_UNION, args));
} | Returns a map created by merging at least one map. These maps should have a common map type.
If there are overlapping keys, the value from 'map2' will overwrite the value from 'map1',
the value from 'map3' will overwrite the value from 'map2', the value from 'mapn' will
overwrite the value from 'map(n-1)'. If any of maps is null, return null. | mapUnion | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType rowtime() {
return toApiSpecificExpression(unresolvedCall(ROWTIME, toExpr()));
} | Declares a field as the rowtime attribute for indicating, accessing, and working in Flink's
event time. | rowtime | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType proctime() {
return toApiSpecificExpression(unresolvedCall(PROCTIME, toExpr()));
} | Declares a field as the proctime attribute for indicating, accessing, and working in Flink's
processing time. | proctime | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType year() {
return toApiSpecificExpression(toMonthInterval(toExpr(), 12));
} | Creates an interval of the given number of years.
<p>The produced expression is of type {@code DataTypes.INTERVAL} | year | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType years() {
return year();
} | Creates an interval of the given number of years. | years | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType md5() {
return toApiSpecificExpression(unresolvedCall(MD5, toExpr()));
} | Returns the MD5 hash of the string argument; null if string is null.
@return string of 32 hexadecimal digits or null | md5 | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType sha1() {
return toApiSpecificExpression(unresolvedCall(SHA1, toExpr()));
} | Returns the SHA-1 hash of the string argument; null if string is null.
@return string of 40 hexadecimal digits or null | sha1 | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType sha224() {
return toApiSpecificExpression(unresolvedCall(SHA224, toExpr()));
} | Returns the SHA-224 hash of the string argument; null if string is null.
@return string of 56 hexadecimal digits or null | sha224 | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType sha256() {
return toApiSpecificExpression(unresolvedCall(SHA256, toExpr()));
} | Returns the SHA-256 hash of the string argument; null if string is null.
@return string of 64 hexadecimal digits or null | sha256 | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType sha384() {
return toApiSpecificExpression(unresolvedCall(SHA384, toExpr()));
} | Returns the SHA-384 hash of the string argument; null if string is null.
@return string of 96 hexadecimal digits or null | sha384 | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType sha512() {
return toApiSpecificExpression(unresolvedCall(SHA512, toExpr()));
} | Returns the SHA-512 hash of the string argument; null if string is null.
@return string of 128 hexadecimal digits or null | sha512 | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType sha2(InType hashLength) {
return toApiSpecificExpression(
unresolvedCall(SHA2, toExpr(), objectToExpression(hashLength)));
} | Returns the hash for the given string expression using the SHA-2 family of hash functions
(SHA-224, SHA-256, SHA-384, or SHA-512).
@param hashLength bit length of the result (either 224, 256, 384, or 512)
@return string or null if one of the arguments is null. | sha2 | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType isJson(JsonType type) {
return toApiSpecificExpression(unresolvedCall(IS_JSON, toExpr(), valueLiteral(type)));
} | Determine whether a given string is valid JSON.
<p>Specifying the optional {@param type} argument puts a constraint on which type of JSON
object is allowed. If the string is valid JSON, but not that type, {@code false} is returned.
The default is {@link JsonType#VALUE}.
<p>Examples:
<pre>{@code
lit("1").isJson() // true
lit("[]").isJson() // true
lit("{}").isJson() // true
lit("\"abc\"").isJson() // true
lit("abc").isJson() // false
nullOf(DataTypes.STRING()).isJson() // false
lit("1").isJson(JsonType.SCALAR) // true
lit("1").isJson(JsonType.ARRAY) // false
lit("1").isJson(JsonType.OBJECT) // false
lit("{}").isJson(JsonType.SCALAR) // false
lit("{}").isJson(JsonType.ARRAY) // false
lit("{}").isJson(JsonType.OBJECT) // true
}</pre>
@param type The type of JSON object to validate against.
@return {@code true} if the string is a valid JSON of the given {@param type}, {@code false}
otherwise. | isJson | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType isJson() {
return toApiSpecificExpression(unresolvedCall(IS_JSON, toExpr()));
} | Determine whether a given string is valid JSON.
<p>This is a shortcut for {@code isJson(JsonType.VALUE)}. See {@link #isJson(JsonType)}.
@return {@code true} if the string is a valid JSON value, {@code false} otherwise. | isJson | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType jsonExists(String path, JsonExistsOnError onError) {
return toApiSpecificExpression(
unresolvedCall(JSON_EXISTS, toExpr(), valueLiteral(path), valueLiteral(onError)));
} | Returns whether a JSON string satisfies a given search criterion.
<p>This follows the ISO/IEC TR 19075-6 specification for JSON support in SQL.
<p>Examples:
<pre>{@code
// true
lit("{\"a\": true}").jsonExists("$.a")
// false
lit("{\"a\": true}").jsonExists("$.b")
// true
lit("{\"a\": [{ \"b\": 1 }]}").jsonExists("$.a[0].b")
// true
lit("{\"a\": true}").jsonExists("strict $.b", JsonExistsOnError.TRUE)
// false
lit("{\"a\": true}").jsonExists("strict $.b", JsonExistsOnError.FALSE)
}</pre>
@param path JSON path to search for.
@param onError Behavior in case of an error.
@return {@code true} if the JSON string satisfies the search criterion. | jsonExists | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType jsonExists(String path) {
return toApiSpecificExpression(unresolvedCall(JSON_EXISTS, toExpr(), valueLiteral(path)));
} | Determines whether a JSON string satisfies a given search criterion.
<p>This follows the ISO/IEC TR 19075-6 specification for JSON support in SQL.
<p>Examples:
<pre>{@code
// true
lit("{\"a\": true}").jsonExists("$.a")
// false
lit("{\"a\": true}").jsonExists("$.b")
// true
lit("{\"a\": [{ \"b\": 1 }]}").jsonExists("$.a[0].b")
// true
lit("{\"a\": true}").jsonExists("strict $.b", JsonExistsOnError.TRUE)
// false
lit("{\"a\": true}").jsonExists("strict $.b", JsonExistsOnError.FALSE)
}</pre>
@param path JSON path to search for.
@return {@code true} if the JSON string satisfies the search criterion. | jsonExists | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType jsonValue(
String path,
DataType returningType,
JsonValueOnEmptyOrError onEmpty,
InType defaultOnEmpty,
JsonValueOnEmptyOrError onError,
InType defaultOnError) {
return toApiSpecificExpression(
unresolvedCall(
JSON_VALUE,
toExpr(),
valueLiteral(path),
typeLiteral(returningType),
valueLiteral(onEmpty),
objectToExpression(defaultOnEmpty),
valueLiteral(onError),
objectToExpression(defaultOnError)));
} | Extracts a scalar from a JSON string.
<p>This method searches a JSON string for a given path expression and returns the value if
the value at that path is scalar. Non-scalar values cannot be returned. By default, the value
is returned as {@link DataTypes#STRING()}. Using {@param returningType} a different type can
be chosen, with the following types being supported:
<ul>
<li>{@link DataTypes#STRING()}
<li>{@link DataTypes#BOOLEAN()}
<li>{@link DataTypes#INT()}
<li>{@link DataTypes#DOUBLE()}
</ul>
<p>For empty path expressions or errors a behavior can be defined to either return {@code
null}, raise an error or return a defined default value instead.
<p>See {@link #jsonQuery(String, JsonQueryWrapper, JsonQueryOnEmptyOrError,
JsonQueryOnEmptyOrError)} for extracting non-scalar values from a JSON string.
<p>Examples:
<pre>{@code
// STRING: "true"
lit("{\"a\": true}").jsonValue("$.a")
// DOUBLE: 0.998
lit("{\"a.b\": [0.998,0.996]}").jsonValue("$.['a.b'][0]", DataTypes.DOUBLE())
// BOOLEAN: true
lit("{\"a\": true}").jsonValue("$.a", DataTypes.BOOLEAN())
// BOOLEAN: "false"
lit("{\"a\": true}").jsonValue("lax $.b",
JsonValueOnEmptyOrError.DEFAULT, false, JsonValueOnEmptyOrError.NULL, null)
// BOOLEAN: "false"
lit("{\"a\": true}").jsonValue("strict $.b",
JsonValueOnEmptyOrError.NULL, null, JsonValueOnEmptyOrError.DEFAULT, false)
}</pre>
@param path JSON path to extract.
@param returningType Type to convert the extracted scalar to, otherwise defaults to {@link
DataTypes#STRING()}.
@param onEmpty Behavior in case the path expression is empty.
@param defaultOnEmpty Default value to return if the path expression is empty and {@param
onEmpty} is set to {@link JsonValueOnEmptyOrError#DEFAULT}.
@param onError Behavior in case of an error.
@param defaultOnError Default value to return if there is an error and {@param onError} is
set to {@link JsonValueOnEmptyOrError#DEFAULT}.
@return The extracted scalar value. | jsonValue | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType jsonValue(String path, DataType returningType) {
return jsonValue(
path,
returningType,
JsonValueOnEmptyOrError.NULL,
null,
JsonValueOnEmptyOrError.NULL,
null);
} | Extracts a scalar from a JSON string.
<p>This method searches a JSON string for a given path expression and returns the value if
the value at that path is scalar. Non-scalar values cannot be returned. By default, the value
is returned as {@link DataTypes#STRING()}.
<p>See also {@link #jsonValue(String, DataType, JsonValueOnEmptyOrError, Object,
JsonValueOnEmptyOrError, Object)}.
@param path JSON path to extract.
@param returningType Type to convert the extracted scalar to, otherwise defaults to {@link
DataTypes#STRING()}.
@return The extracted scalar value. | jsonValue | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType jsonValue(String path, DataType returningType, InType defaultOnEmptyOrError) {
return jsonValue(
path,
returningType,
JsonValueOnEmptyOrError.DEFAULT,
defaultOnEmptyOrError,
JsonValueOnEmptyOrError.DEFAULT,
defaultOnEmptyOrError);
} | Extracts a scalar from a JSON string.
<p>This method searches a JSON string for a given path expression and returns the value if
the value at that path is scalar. Non-scalar values cannot be returned. By default, the value
is returned as {@link DataTypes#STRING()}.
<p>See also {@link #jsonValue(String, DataType, JsonValueOnEmptyOrError, Object,
JsonValueOnEmptyOrError, Object)}.
<p>This is a convenience method using {@link JsonValueOnEmptyOrError#DEFAULT} for both empty
and error cases with the same default value.
@param path JSON path to extract.
@param returningType Type to convert the extracted scalar to, otherwise defaults to {@link
DataTypes#STRING()}.
@return The extracted scalar value. | jsonValue | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType jsonValue(String path) {
return jsonValue(path, DataTypes.STRING());
} | Extracts a scalar from a JSON string.
<p>This method searches a JSON string for a given path expression and returns the value if
the value at that path is scalar. Non-scalar values cannot be returned. By default, the value
is returned as {@link DataTypes#STRING()}.
<p>See also {@link #jsonValue(String, DataType, JsonValueOnEmptyOrError, Object,
JsonValueOnEmptyOrError, Object)}.
@param path JSON path to extract.
@return The extracted scalar value. | jsonValue | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType jsonQuery(
String path,
DataType returnType,
JsonQueryWrapper wrappingBehavior,
JsonQueryOnEmptyOrError onEmpty,
JsonQueryOnEmptyOrError onError) {
return toApiSpecificExpression(
unresolvedCall(
JSON_QUERY,
toExpr(),
valueLiteral(path),
typeLiteral(returnType),
valueLiteral(wrappingBehavior),
valueLiteral(onEmpty),
valueLiteral(onError)));
} | Extracts JSON values from a JSON string.
<p>This follows the ISO/IEC TR 19075-6 specification for JSON support in SQL. The result is
always returned as a {@link DataTypes#STRING()}.
<p>The {@param wrappingBehavior} determines whether the extracted value should be wrapped
into an array, and whether to do so unconditionally or only if the value itself isn't an
array already.
<p>{@param onEmpty} and {@param onError} determine the behavior in case the path expression
is empty, or in case an error was raised, respectively. By default, in both cases {@code
null} is returned. Other choices are to use an empty array, an empty object, or to raise an
error.
<p>See {@link #jsonValue(String, DataType, JsonValueOnEmptyOrError, Object,
JsonValueOnEmptyOrError, Object)} for extracting scalars from a JSON string.
<p>Examples:
<pre>{@code
lit("{ \"a\": { \"b\": 1 } }").jsonQuery("$.a") // "{ \"b\": 1 }"
lit("[1, 2]").jsonQuery("$") // "[1, 2]"
nullOf(DataTypes.STRING()).jsonQuery("$") // null
// Wrap result into an array
lit("{}").jsonQuery("$", JsonQueryWrapper.CONDITIONAL_ARRAY) // "[{}]"
lit("[1, 2]").jsonQuery("$", JsonQueryWrapper.CONDITIONAL_ARRAY) // "[1, 2]"
lit("[1, 2]").jsonQuery("$", JsonQueryWrapper.UNCONDITIONAL_ARRAY) // "[[1, 2]]"
// Scalars must be wrapped to be returned
lit(1).jsonQuery("$") // null
lit(1).jsonQuery("$", JsonQueryWrapper.CONDITIONAL_ARRAY) // "[1]"
// Behavior if path expression is empty / there is an error
// "{}"
lit("{}").jsonQuery("lax $.invalid", JsonQueryWrapper.WITHOUT_ARRAY,
JsonQueryOnEmptyOrError.EMPTY_OBJECT, JsonQueryOnEmptyOrError.NULL)
// "[]"
lit("{}").jsonQuery("strict $.invalid", JsonQueryWrapper.WITHOUT_ARRAY,
JsonQueryOnEmptyOrError.NULL, JsonQueryOnEmptyOrError.EMPTY_ARRAY)
// Return results as an array instead of a string
lit("[1, 2]").jsonQuery("$", DataTypes.ARRAY(DataTypes.STRING()),
JsonQueryWrapper.CONDITIONAL_ARRAY) // ["1", "2"]
lit("[1, 2]").jsonQuery("$", DataTypes.ARRAY(DataTypes.STRING()),
JsonQueryWrapper.UNCONDITIONAL_ARRAY) // ["[1, 2]"]
}</pre>
@param path JSON path to search for.
@param returnType Type to convert the extracted array to, otherwise defaults to {@link
DataTypes#STRING()}.
@param wrappingBehavior Determine if and when to wrap the resulting value into an array.
@param onEmpty Behavior in case the path expression is empty.
@param onError Behavior in case of an error.
@return The extracted JSON value. | jsonQuery | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType jsonQuery(
String path,
JsonQueryWrapper wrappingBehavior,
JsonQueryOnEmptyOrError onEmpty,
JsonQueryOnEmptyOrError onError) {
return jsonQuery(path, DataTypes.STRING(), wrappingBehavior, onEmpty, onError);
} | Extracts JSON values from a JSON string.
<p>The result is returned as a {@link DataTypes#STRING()}.
<p>See also {@link #jsonQuery(String, DataType, JsonQueryWrapper, JsonQueryOnEmptyOrError,
JsonQueryOnEmptyOrError)}.
@param path JSON path to search for.
@param wrappingBehavior Determine if and when to wrap the resulting value into an array.
@param onEmpty Behavior in case the path expression is empty.
@param onError Behavior in case of an error.
@return The extracted JSON value. | jsonQuery | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType jsonQuery(String path, JsonQueryWrapper wrappingBehavior) {
return jsonQuery(
path, wrappingBehavior, JsonQueryOnEmptyOrError.NULL, JsonQueryOnEmptyOrError.NULL);
} | Extracts JSON values from a JSON string.
<p>The {@param wrappingBehavior} determines whether the extracted value should be wrapped
into an array, and whether to do so unconditionally or only if the value itself isn't an
array already.
<p>See also {@link #jsonQuery(String, JsonQueryWrapper, JsonQueryOnEmptyOrError,
JsonQueryOnEmptyOrError)}.
@param path JSON path to search for.
@param wrappingBehavior Determine if and when to wrap the resulting value into an array.
@return The extracted JSON value. | jsonQuery | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType jsonQuery(String path, DataType returnType, JsonQueryWrapper wrappingBehavior) {
return jsonQuery(
path,
returnType,
wrappingBehavior,
JsonQueryOnEmptyOrError.NULL,
JsonQueryOnEmptyOrError.NULL);
} | Extracts JSON values from a JSON string.
<p>The {@param wrappingBehavior} determines whether the extracted value should be wrapped
into an array, and whether to do so unconditionally or only if the value itself isn't an
array already.
<p>See also {@link #jsonQuery(String, JsonQueryWrapper, JsonQueryOnEmptyOrError,
JsonQueryOnEmptyOrError)}.
@param path JSON path to search for.
@param returnType Type to convert the extracted array to, otherwise defaults to {@link
DataTypes#STRING()}.
@param wrappingBehavior Determine if and when to wrap the resulting value into an array.
@return The extracted JSON value. | jsonQuery | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType jsonQuery(String path) {
return jsonQuery(path, JsonQueryWrapper.WITHOUT_ARRAY);
} | Extracts JSON values from a JSON string.
<p>See also {@link #jsonQuery(String, JsonQueryWrapper, JsonQueryOnEmptyOrError,
JsonQueryOnEmptyOrError)}.
@param path JSON path to search for.
@return The extracted JSON value. | jsonQuery | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType jsonQuery(String path, DataType returnType) {
return jsonQuery(path, returnType, JsonQueryWrapper.WITHOUT_ARRAY);
} | Extracts JSON values from a JSON string.
<p>See also {@link #jsonQuery(String, JsonQueryWrapper, JsonQueryOnEmptyOrError,
JsonQueryOnEmptyOrError)}.
@param path JSON path to search for.
@param returnType Type to convert the extracted array to, otherwise defaults to {@link
DataTypes#STRING()}.
@return The extracted JSON value. | jsonQuery | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType percentile(InType percentage) {
return toApiSpecificExpression(
unresolvedCall(PERCENTILE, toExpr(), objectToExpression(percentage)));
} | See {@link BaseExpressions#percentile(Object, Object)}. | percentile | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
public OutType percentile(InType percentage, InType frequency) {
return toApiSpecificExpression(
unresolvedCall(
PERCENTILE,
toExpr(),
objectToExpression(percentage),
objectToExpression(frequency)));
} | Returns the exact percentile value of {@code expr} at the specified {@code percentage} in a
group.
<p>{@code percentage} must be a literal numeric value between [0.0, 1.0] or an array of such
values. If a variable expression is passed to this function, the result will be calculated
using any one of them.
<p>{@code frequency} describes how many times {@code expr} should be counted, the default
value is 1.
<p>If no {@code expr} lies exactly at the desired percentile, the result is calculated using
linear interpolation of the two nearest exprs. If {@code expr} or {@code frequency} is null,
or {@code frequency} is not positive, the input row will be ignored.
<p>NOTE: It is recommended to use this function in a window scenario, as it typically offers
better performance. In a regular group aggregation scenario, users should be aware of the
performance overhead caused by a full sort triggered by each record.
@param percentage A NUMERIC NOT NULL or ARRAY<NUMERIC NOT NULL> NOT NULL expression.
@param frequency An optional INTEGER_NUMERIC expression.
@return A DOUBLE if percentage is numeric, or an ARRAY<DOUBLE> if percentage is an
array. null if percentage is an empty array. | percentile | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java | Apache-2.0 |
@VisibleForTesting
static RowData rowToInternalRow(Row row) {
Object[] values = new Object[row.getArity()];
for (int i = 0; i < row.getArity(); i++) {
Object value = row.getField(i);
if (value == null) {
values[i] = null;
} else if (value instanceof String) {
values[i] = StringData.fromString((String) value);
} else if (value instanceof Boolean
|| value instanceof Long
|| value instanceof Integer) {
values[i] = value;
} else {
throw new TableException("Cannot convert row type");
}
}
return GenericRowData.of(values);
} | This function supports only String, long, int and boolean fields. | rowToInternalRow | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/StaticResultProvider.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/StaticResultProvider.java | Apache-2.0 |
@VisibleForTesting
public Pipeline generatePipelineFromQueryOperation(
QueryOperation operation, List<Transformation<?>> transformations) {
String defaultJobName = "collect";
try {
defaultJobName = operation.asSerializableString(catalogManager.getSqlFactory());
} catch (Throwable e) {
// ignore error for unsupported operations and use 'collect' as default job name
}
// We pass only the configuration to avoid reconfiguration with the rootConfiguration
return execEnv.createPipeline(
transformations, tableConfig.getConfiguration(), defaultJobName);
} | generate execution {@link Pipeline} from {@link QueryOperation}. | generatePipelineFromQueryOperation | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/TableEnvironmentImpl.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/TableEnvironmentImpl.java | Apache-2.0 |
private List<String> extractSinkIdentifierNames(List<ModifyOperation> operations) {
List<String> tableNames = new ArrayList<>(operations.size());
for (ModifyOperation operation : operations) {
if (operation instanceof SinkModifyOperation) {
String fullName =
((SinkModifyOperation) operation)
.getContextResolvedTable()
.getIdentifier()
.asSummaryString();
tableNames.add(fullName);
} else {
throw new UnsupportedOperationException("Unsupported operation: " + operation);
}
}
return deduplicateSinkIdentifierNames(tableNames);
} | extract sink identifier names from {@link ModifyOperation}s and deduplicate them with {@link
#deduplicateSinkIdentifierNames(List)}. | extractSinkIdentifierNames | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/TableEnvironmentImpl.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/TableEnvironmentImpl.java | Apache-2.0 |
default String explainInternal(List<Operation> operations, ExplainDetail... extraDetails) {
return explainInternal(operations, ExplainFormat.TEXT, extraDetails);
} | Returns the AST of this table and the execution plan to compute the result of this table.
@param operations The operations to be explained.
@param extraDetails The extra explain details which the explain result should include, e.g.
estimated cost, changelog mode for streaming
@return AST and the execution plan. | explainInternal | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/TableEnvironmentInternal.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/TableEnvironmentInternal.java | Apache-2.0 |
public Builder schema(ResolvedSchema resolvedSchema) {
Preconditions.checkNotNull(resolvedSchema, "resolvedSchema should not be null");
this.resolvedSchema = resolvedSchema;
return this;
} | Specifies schema of the execution result.
@param resolvedSchema a {@link ResolvedSchema} for the execution result. | schema | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/TableResultImpl.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/TableResultImpl.java | Apache-2.0 |
public Builder data(List<Row> rowList) {
Preconditions.checkNotNull(rowList, "listRows should not be null");
this.resultProvider = new StaticResultProvider(rowList);
return this;
} | Specifies an row list as the execution result.
@param rowList a row list as the execution result. | data | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/TableResultImpl.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/TableResultImpl.java | Apache-2.0 |
public Builder setPrintStyle(PrintStyle printStyle) {
Preconditions.checkNotNull(printStyle, "printStyle should not be null");
this.printStyle = printStyle;
return this;
} | Specifies print style. Default is {@link TableauStyle} with max integer column width. | setPrintStyle | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/TableResultImpl.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/TableResultImpl.java | Apache-2.0 |
public String getComment() {
return comment;
} | Get comment of the database.
@return comment of the database | getComment | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/CatalogDatabaseImpl.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/CatalogDatabaseImpl.java | Apache-2.0 |
public Optional<String> getDescription() {
return Optional.ofNullable(comment);
} | Get a brief description of the database.
@return an optional short description of the database | getDescription | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/CatalogDatabaseImpl.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/CatalogDatabaseImpl.java | Apache-2.0 |
public Optional<String> getDetailedDescription() {
return Optional.ofNullable(comment);
} | Get a detailed description of the database.
@return an optional long description of the database | getDetailedDescription | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/CatalogDatabaseImpl.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/CatalogDatabaseImpl.java | Apache-2.0 |
public void close() throws CatalogException {
// close the initialized catalogs
List<Throwable> errors = new ArrayList<>();
for (Map.Entry<String, Catalog> entry : catalogs.entrySet()) {
String catalogName = entry.getKey();
Catalog catalog = entry.getValue();
try {
catalog.close();
} catch (Throwable e) {
LOG.error(
String.format(
"Failed to close catalog %s: %s", catalogName, e.getMessage()),
e);
errors.add(e);
}
}
// close the catalog store holder
try {
catalogStoreHolder.close();
} catch (Throwable e) {
errors.add(e);
LOG.error(String.format("Failed to close catalog store holder: %s", e.getMessage()), e);
}
if (!errors.isEmpty()) {
CatalogException exception = new CatalogException("Failed to close catalog manager");
for (Throwable e : errors) {
exception.addSuppressed(e);
}
throw exception;
}
} | Closes the catalog manager and releases its resources.
<p>This method closes all initialized catalogs and the catalog store.
@throws CatalogException if an error occurs while closing the catalogs or the catalog store | close | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/CatalogManager.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/CatalogManager.java | Apache-2.0 |
public void initSchemaResolver(
boolean isStreamingMode,
ExpressionResolverBuilder expressionResolverBuilder,
Parser parser) {
this.schemaResolver =
new DefaultSchemaResolver(isStreamingMode, typeFactory, expressionResolverBuilder);
this.parser = parser;
} | Initializes a {@link SchemaResolver} for {@link Schema} resolution.
<p>Currently, the resolver cannot be passed in the constructor because of a chicken-and-egg
problem between {@link Planner} and {@link CatalogManager}.
@see TableEnvironmentImpl#create(EnvironmentSettings) | initSchemaResolver | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/CatalogManager.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/CatalogManager.java | Apache-2.0 |
public SchemaResolver getSchemaResolver() {
return schemaResolver;
} | Returns a {@link SchemaResolver} for creating {@link ResolvedSchema} from {@link Schema}. | getSchemaResolver | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/CatalogManager.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/CatalogManager.java | Apache-2.0 |
@Deprecated
public void registerCatalog(String catalogName, Catalog catalog) {
checkArgument(
!StringUtils.isNullOrWhitespaceOnly(catalogName),
"Catalog name cannot be null or empty.");
checkNotNull(catalog, "Catalog cannot be null");
if (catalogs.containsKey(catalogName)) {
throw new CatalogException(format("Catalog %s already exists.", catalogName));
}
catalog.open();
catalogs.put(catalogName, catalog);
} | Registers a catalog under the given name. The catalog name must be unique.
@param catalogName name under which to register the given catalog
@param catalog catalog to register
@throws CatalogException if the registration of the catalog under the given name failed
@deprecated This method is deprecated and will be removed in a future release. Use {@code
createCatalog} instead to create a catalog using {@link CatalogDescriptor} and store it
in the {@link CatalogStore}. | registerCatalog | java | apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/CatalogManager.java | https://github.com/apache/flink/blob/master/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/CatalogManager.java | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.