Package ra

Examples of ra.Result


        }

        AlgebraToSpreadsheet ats = new AlgebraToSpreadsheet();
        Utils.reset();
        Term t = ats.readAlgebra(args[0]);
        Result r = t.execute();
        ats.writeExcel(fos, r);
    }
View Full Code Here


                /* translating the first query, then writing the first spreadsheet file take longer time, so let's
                 * warm up here */
                Schema schema = Schemas.fromDDL(DEFAULT_SCHEMA_TEXT);
                try {
                    Term translated = Queries.getRaOf(schema, DEFAULT_QUERY_TEXT);
                    Result result = translated.execute();
                    try (OutputStream os = new OutputStream() {
                        @Override
                        public void write(int b) throws IOException {
                            // nop
                        }};
View Full Code Here

            Iterator<String> tableNamesIter = databaseSchema.tableNames().iterator();
            for (Term inputTable : inputTables) {
                // add input tables to {@link results} so that they get borders
                // also add labels with column names
                // TODO refactor this and move to QuietSpreadsheetLayout
                Result result = inputTable.execute();
                ColumnLabels labels = result.getLabels();
                String tableName = tableNamesIter.next();
                ColumnNamesImpl cn = databaseSchema.schemaTable(tableName);
                ColumnIndexesImpl ci = cn.asColumnIndexesLookup();
                Iterator<SimpleColumn> scs = ci.iterator();
                for (Column c : result.getResultRelation()) {
                    SimpleColumn sc = scs.next();
                    labels.put(c, tableName+"."+sc.name());
                }

                results.add(result);
            }

            // add the SQL query to the comments for the result columns
            // TODO add column name or expression
            // TODO add only one formula's sql code, not all sql formulas' codes
            // TODO make sure the comment is wide enough so that no wrapping occurs
            String sourceComment = "|--SQL query:\n"+sqlSource;
            sourceComment = sourceComment.replace("\n", "\n|   ");
            for (Term formula : formulas) {
                // TODO refactor this and move to QuietSpreadsheetLayout
                Result result = formula.execute();
                ColumnLabels labels = result.getLabels();
                Relation resultRelation = result.getResultRelation();
                for (Column col : resultRelation) {
                    labels.put(col, sourceComment);
                }
                results.add(result);
            }
View Full Code Here

TOP

Related Classes of ra.Result

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.