Package com.facebook.presto.sql.parser

Examples of com.facebook.presto.sql.parser.StatementSplitter$ErrorHandlingLexer


    private List<String> loadQueries()
    {
        try {
            String query = Files.toString(new File(file), Charsets.UTF_8);
            StatementSplitter splitter = new StatementSplitter(query + ";");
            return ImmutableList.copyOf(transform(splitter.getCompleteStatements(), new Function<Statement, String>()
            {
                @Override
                public String apply(Statement statement)
                {
                    return statement.statement();
View Full Code Here


    private List<String> loadQueries()
    {
        try {
            String query = Files.toString(new File(file), Charsets.UTF_8);
            StatementSplitter splitter = new StatementSplitter(query + ";");
            return ImmutableList.copyOf(transform(splitter.getCompleteStatements(), new Function<Statement, String>()
            {
                @Override
                public String apply(Statement statement)
                {
                    return statement.statement();
View Full Code Here

                // not a command, add line to buffer
                buffer.append(line).append("\n");

                // execute any complete statements
                String sql = buffer.toString();
                StatementSplitter splitter = new StatementSplitter(sql, ImmutableSet.of(";", "\\G"));
                for (Statement split : splitter.getCompleteStatements()) {
                    Optional<Object> statement = getParsedStatement(split.statement());
                    if (statement.isPresent() && isSessionParameterChange(statement.get())) {
                        session = processSessionParameterChange(statement.get(), session);
                        queryRunner.setSession(session);
                        tableNameCompleter.populateCache();
                    }
                    else {
                        OutputFormat outputFormat = OutputFormat.ALIGNED;
                        if (split.terminator().equals("\\G")) {
                            outputFormat = OutputFormat.VERTICAL;
                        }

                        process(queryRunner, split.statement(), outputFormat, true);
                    }
                    reader.getHistory().add(squeezeStatement(split.statement()) + split.terminator());
                }

                // replace buffer with trailing partial statement
                buffer = new StringBuilder();
                String partial = splitter.getPartialStatement();
                if (!partial.isEmpty()) {
                    buffer.append(partial).append('\n');
                }
            }
        }
View Full Code Here

        return statement instanceof UseCollection;
    }

    private static void executeCommand(QueryRunner queryRunner, String query, OutputFormat outputFormat)
    {
        StatementSplitter splitter = new StatementSplitter(query + ";");
        for (Statement split : splitter.getCompleteStatements()) {
            process(queryRunner, split.statement(), outputFormat, false);
        }
    }
View Full Code Here

    private List<String> loadQueries()
    {
        try {
            String query = Files.toString(new File(file), Charsets.UTF_8);
            StatementSplitter splitter = new StatementSplitter(query + ";");
            return ImmutableList.copyOf(transform(splitter.getCompleteStatements(), new Function<Statement, String>()
            {
                @Override
                public String apply(Statement statement)
                {
                    return statement.statement();
View Full Code Here

                // not a command, add line to buffer
                buffer.append(line).append("\n");

                // execute any complete statements
                String sql = buffer.toString();
                StatementSplitter splitter = new StatementSplitter(sql, ImmutableSet.of(";", "\\G"));
                for (Statement split : splitter.getCompleteStatements()) {
                    OutputFormat outputFormat = OutputFormat.ALIGNED;
                    if (split.terminator().equals("\\G")) {
                        outputFormat = OutputFormat.VERTICAL;
                    }

                    process(queryRunner, split.statement(), outputFormat, true);
                    reader.getHistory().add(squeezeStatement(split.statement()) + split.terminator());
                }

                // replace buffer with trailing partial statement
                buffer = new StringBuilder();
                String partial = splitter.getPartialStatement();
                if (!partial.isEmpty()) {
                    buffer.append(partial).append('\n');
                }
            }
        }
View Full Code Here

        }
    }

    private static void executeCommand(QueryRunner queryRunner, String query, OutputFormat outputFormat)
    {
        StatementSplitter splitter = new StatementSplitter(query + ";");
        for (Statement split : splitter.getCompleteStatements()) {
            process(queryRunner, split.statement(), outputFormat, false);
        }
    }
View Full Code Here

    private List<String> loadQueries()
    {
        try {
            String query = Files.toString(new File(file), Charsets.UTF_8);
            StatementSplitter splitter = new StatementSplitter(query + ";");
            return ImmutableList.copyOf(transform(splitter.getCompleteStatements(), new Function<Statement, String>()
            {
                @Override
                public String apply(Statement statement)
                {
                    return statement.statement();
View Full Code Here

                // not a command, add line to buffer
                buffer.append(line).append("\n");

                // execute any complete statements
                String sql = buffer.toString();
                StatementSplitter splitter = new StatementSplitter(sql, ImmutableSet.of(";", "\\G"));
                for (Statement split : splitter.getCompleteStatements()) {
                    Optional<Object> statement = getParsedStatement(split.statement());
                    if (statement.isPresent() && isSessionParameterChange(statement.get())) {
                        session = processSessionParameterChange(statement.get(), session);
                        queryRunner = QueryRunner.create(session);
                    }
                    else {
                        OutputFormat outputFormat = OutputFormat.ALIGNED;
                        if (split.terminator().equals("\\G")) {
                            outputFormat = OutputFormat.VERTICAL;
                        }

                        process(queryRunner, split.statement(), outputFormat, true);
                    }
                    reader.getHistory().add(squeezeStatement(split.statement()) + split.terminator());
                }

                // replace buffer with trailing partial statement
                buffer = new StringBuilder();
                String partial = splitter.getPartialStatement();
                if (!partial.isEmpty()) {
                    buffer.append(partial).append('\n');
                }
            }
        }
View Full Code Here

        return statement instanceof UseCollection;
    }

    private static void executeCommand(QueryRunner queryRunner, String query, OutputFormat outputFormat)
    {
        StatementSplitter splitter = new StatementSplitter(query + ";");
        for (Statement split : splitter.getCompleteStatements()) {
            process(queryRunner, split.statement(), outputFormat, false);
        }
    }
View Full Code Here

TOP

Related Classes of com.facebook.presto.sql.parser.StatementSplitter$ErrorHandlingLexer

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.