@ScalarOperator(EQUAL) @SqlType(StandardTypes.BOOLEAN) @SqlNullable public static Boolean equal(@SqlType(StandardTypes.REAL) long left, @SqlType(StandardTypes.REAL) long right) { return intBitsToFloat((int) left) == intBitsToFloat((int) right); }
@ScalarOperator(EQUAL) @SuppressWarnings("FloatingPointEquality") @SqlType(StandardTypes.BOOLEAN) @SqlNullable public static Boolean equal(@SqlType(StandardTypes.DOUBLE) double left, @SqlType(StandardTypes.DOUBLE) double right) { return left == right; }
@ScalarOperator(NOT_EQUAL) @SuppressWarnings("FloatingPointEquality") @SqlType(StandardTypes.BOOLEAN) @SqlNullable public static Boolean notEqual(@SqlType(StandardTypes.DOUBLE) double left, @SqlType(StandardTypes.DOUBLE) double right) { return left != right; }
@ScalarOperator(EQUAL) @SqlType(StandardTypes.BOOLEAN) @SqlNullable public static Boolean equal(@SqlType(StandardTypes.INTERVAL_DAY_TO_SECOND) long left, @SqlType(StandardTypes.INTERVAL_DAY_TO_SECOND) long right) { return left == right; }
@ScalarOperator(NOT_EQUAL) @SqlType(StandardTypes.BOOLEAN) @SqlNullable public static Boolean notEqual(@SqlType(StandardTypes.IPADDRESS) Slice left, @SqlType(StandardTypes.IPADDRESS) Slice right) { return !left.equals(right); }
@SqlNullable @SqlType(StandardTypes.BOOLEAN) public Boolean arraysOverlapInt( @OperatorDependency(operator = LESS_THAN, returnType = StandardTypes.BOOLEAN, argumentTypes = {"integer", "integer"}) MethodHandle lessThanFunction, @SqlType("array(integer)") Block leftArray, @SqlType("array(integer)") Block rightArray) { return genericArraysOverlap(leftArray, rightArray, INTEGER); }
@SqlNullable @Description("extract protocol from url") @ScalarFunction @LiteralParameters("x") @SqlType("varchar(x)") public static Slice urlExtractProtocol(@SqlType("varchar(x)") Slice url) { URI uri = parseUrl(url); return (uri == null) ? null : slice(uri.getScheme()); }
@SqlNullable @Description("extract part from url") @ScalarFunction @LiteralParameters("x") @SqlType("varchar(x)") public static Slice urlExtractPath(@SqlType("varchar(x)") Slice url) { URI uri = parseUrl(url); return (uri == null) ? null : slice(uri.getPath()); }
@ScalarOperator(NOT_EQUAL) @SqlType(BOOLEAN) @SqlNullable public static Boolean notEqual(@SqlType(JSON) Slice leftJson, @SqlType(JSON) Slice rightJson) { return !leftJson.equals(rightJson); }
@TypeParameter("T") @SqlType("T") @SqlNullable public static Long longArrayMax( @OperatorDependency(operator = GREATER_THAN, returnType = StandardTypes.BOOLEAN, argumentTypes = {"T", "T"}) MethodHandle compareMethodHandle, @TypeParameter("T") Type elementType, @SqlType("array(T)") Block block) { return longArrayMinMax(compareMethodHandle, elementType, block); }
@SqlNullable @ScalarFunction("json_array_contains") @LiteralParameters("x") @SqlType(StandardTypes.BOOLEAN) public static Boolean varcharJsonArrayContains(@SqlType("varchar(x)") Slice json, @SqlType(StandardTypes.BIGINT) long value) { return jsonArrayContains(json, value); }
@SqlNullable @ScalarFunction("json_array_contains") @LiteralParameters("x") @SqlType(StandardTypes.BOOLEAN) public static Boolean varcharJsonArrayContains(@SqlType("varchar(x)") Slice json, @SqlType(StandardTypes.DOUBLE) double value) { return jsonArrayContains(json, value); }
@TypeParameter("T") @SqlType("T") @SqlNullable public static Long longArrayMin( @OperatorDependency(operator = LESS_THAN, returnType = StandardTypes.BOOLEAN, argumentTypes = {"T", "T"}) MethodHandle compareMethodHandle, @TypeParameter("T") Type elementType, @SqlType("array(T)") Block block) { return longArrayMinMax(compareMethodHandle, elementType, block); }
@TypeParameter("T") @SqlType("T") @SqlNullable public static Slice sliceArrayMin( @OperatorDependency(operator = LESS_THAN, returnType = StandardTypes.BOOLEAN, argumentTypes = {"T", "T"}) MethodHandle compareMethodHandle, @TypeParameter("T") Type elementType, @SqlType("array(T)") Block block) { return sliceArrayMinMax(compareMethodHandle, elementType, block); }
@SqlNullable @ScalarFunction("json_array_get") @LiteralParameters("x") @SqlType(StandardTypes.JSON) public static Slice varcharJsonArrayGet(@SqlType("varchar(x)") Slice json, @SqlType(StandardTypes.BIGINT) long index) { return jsonArrayGet(json, index); }
@ScalarFunction @SqlNullable @SqlType(StandardTypes.JSON) public static Slice jsonExtract(@SqlType(StandardTypes.JSON) Slice json, @SqlType(JsonPathType.NAME) JsonPath jsonPath) { return JsonExtract.extract(json, jsonPath.getObjectExtractor()); }
@ScalarFunction @SqlNullable @SqlType(StandardTypes.BIGINT) public static Long jsonSize(@SqlType(StandardTypes.JSON) Slice json, @SqlType(JsonPathType.NAME) JsonPath jsonPath) { return JsonExtract.extract(json, jsonPath.getSizeExtractor()); }
@ScalarFunction("json_extract_scalar") @SqlNullable @LiteralParameters("x") @SqlType("varchar(x)") public static Slice varcharJsonExtractScalar(@SqlType("varchar(x)") Slice json, @SqlType(JsonPathType.NAME) JsonPath jsonPath) { return JsonExtract.extract(json, jsonPath.getScalarExtractor()); }
@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); }
@TypeParameter("E") @SqlNullable @SqlType("E") public static Object generic(@TypeParameter("E") Type type, @BlockPosition @SqlType("E") Block block, @BlockIndex int position) { hitBlockPositionObject.set(true); return readNativeValue(type, block, position); }