Package com.facebook.presto.sql.gen

Examples of com.facebook.presto.sql.gen.TypedByteCodeNode


        }

        @Override
        public FunctionBinding bindFunction(long bindingId, String name, ByteCodeNode getSessionByteCode, List<TypedByteCodeNode> arguments)
        {
            TypedByteCodeNode patternNode = arguments.get(1);

            MethodHandle methodHandle;
            if (patternNode.getNode() instanceof Constant) {
                Slice patternSlice = (Slice) ((Constant) patternNode.getNode()).getValue();
                String pattern = patternSlice.toString(Charsets.UTF_8);

                JsonExtractor jsonExtractor;
                switch (name) {
                    case JSON_EXTRACT_SCALAR_FUNCTION_NAME:
View Full Code Here


        public FunctionBinding bindFunction(long bindingId, String name, ByteCodeNode getSessionByteCode, List<TypedByteCodeNode> arguments)
        {
            MethodHandle methodHandle;
            boolean nullable = false;
            TypedByteCodeNode patternNode = arguments.get(1);
            if (patternNode.getNode() instanceof Constant) {
                switch (name) {
                    case "regexp_like":
                        methodHandle = constantRegexpLike;
                        break;
                    case "regexp_replace":
                        methodHandle = constantRegexpReplace;
                        if (arguments.size() == 2) {
                            methodHandle = MethodHandles.insertArguments(methodHandle, 2, Slices.EMPTY_SLICE);
                        }
                        break;
                    case "regexp_extract":
                        methodHandle = constantRegexpExtract;
                        nullable = true;
                        if (arguments.size() == 2) {
                            methodHandle = MethodHandles.insertArguments(methodHandle, 2, 0L);
                        }
                        break;
                    default:
                        throw new IllegalArgumentException("Unsupported method " + name);
                }

                Slice patternSlice = (Slice) ((Constant) patternNode.getNode()).getValue();

                Pattern pattern = Pattern.compile(patternSlice.toString(UTF_8));

                methodHandle = MethodHandles.insertArguments(methodHandle, 1, pattern);
View Full Code Here

        }

        @Override
        public FunctionBinding bindFunction(long bindingId, String name, ByteCodeNode getSessionByteCode, List<TypedByteCodeNode> arguments)
        {
            TypedByteCodeNode patternNode = arguments.get(1);

            MethodHandle methodHandle;
            if (patternNode.getNode() instanceof Constant) {
                Slice patternSlice = (Slice) ((Constant) patternNode.getNode()).getValue();
                String pattern = patternSlice.toString(Charsets.UTF_8);

                JsonExtractor jsonExtractor;
                switch (name) {
                    case JSON_EXTRACT_SCALAR_FUNCTION_NAME:
View Full Code Here

        }

        @Override
        public FunctionBinding bindFunction(long bindingId, String name, ByteCodeNode getSessionByteCode, List<TypedByteCodeNode> arguments)
        {
            TypedByteCodeNode patternNode = arguments.get(1);

            MethodHandle methodHandle;
            if (patternNode.getNode() instanceof Constant) {
                Slice patternSlice = (Slice) ((Constant) patternNode.getNode()).getValue();
                String pattern = patternSlice.toString(Charsets.UTF_8);

                JsonExtractor jsonExtractor;
                switch (name) {
                    case JSON_EXTRACT_SCALAR_FUNCTION_NAME:
View Full Code Here

        public FunctionBinding bindFunction(long bindingId, String name, ByteCodeNode getSessionByteCode, List<TypedByteCodeNode> arguments)
        {
            MethodHandle methodHandle;
            boolean nullable = false;
            TypedByteCodeNode patternNode = arguments.get(1);
            if (patternNode.getNode() instanceof Constant) {
                switch (name) {
                    case "regexp_like":
                        methodHandle = constantRegexpLike;
                        break;
                    case "regexp_replace":
                        methodHandle = constantRegexpReplace;
                        if (arguments.size() == 2) {
                            methodHandle = MethodHandles.insertArguments(methodHandle, 2, Slices.EMPTY_SLICE);
                        }
                        break;
                    case "regexp_extract":
                        methodHandle = constantRegexpExtract;
                        nullable = true;
                        if (arguments.size() == 2) {
                            methodHandle = MethodHandles.insertArguments(methodHandle, 2, 0L);
                        }
                        break;
                    default:
                        throw new IllegalArgumentException("Unsupported method " + name);
                }

                Slice patternSlice = (Slice) ((Constant) patternNode.getNode()).getValue();

                Pattern pattern = Pattern.compile(patternSlice.toString(UTF_8));

                methodHandle = MethodHandles.insertArguments(methodHandle, 1, pattern);
View Full Code Here

TOP

Related Classes of com.facebook.presto.sql.gen.TypedByteCodeNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.