Examples of TableHandle


Examples of com.facebook.presto.spi.TableHandle

        // TODO: replace this with a table-generating operator that produces 1 row with no columns

        QualifiedTableName name = MetadataUtil.createQualifiedTableName(session, QualifiedName.of("dual"));
        Optional<TableHandle> optionalHandle = metadata.getTableHandle(name);
        checkState(optionalHandle.isPresent(), "Dual table provider not installed");
        TableHandle table = optionalHandle.get();
        TableMetadata tableMetadata = metadata.getTableMetadata(table);
        Map<String, ColumnHandle> columnHandles = metadata.getColumnHandles(table);

        ImmutableMap.Builder<Symbol, ColumnHandle> columns = ImmutableMap.builder();
        for (ColumnMetadata column : tableMetadata.getColumns()) {
View Full Code Here

Examples of com.facebook.presto.spi.TableHandle

        }

        @Override
        public Void visitTableScan(TableScanNode node, Void context)
        {
            TableHandle tableHandle = node.getTable();
            TableMetadata table = metadata.getTableMetadata(tableHandle);
            SchemaTableName schemaTable = table.getTable();

            TableEntry entry = new TableEntry(table.getConnectorId(), schemaTable.getSchemaName(), schemaTable.getTableName());
View Full Code Here

Examples of com.facebook.presto.spi.TableHandle

    private RelationPlan createMaterializedViewWriterPlan(Analysis analysis)
    {
        QualifiedTableName destination = analysis.getMaterializedViewDestination().get();

        TableHandle targetTable;
        List<ColumnHandle> targetColumnHandles;

        RelationPlan plan;
        if (analysis.isDoRefresh()) {
            // TODO: some of this should probably move to the analyzer, which should be able to compute the tuple descriptor for the source table from metadata
            targetTable = metadata.getTableHandle(destination).get();
            QualifiedTableName sourceTable = storageManager.getTableSource((NativeTableHandle) targetTable);
            TableHandle sourceTableHandle = metadata.getTableHandle(sourceTable).get();
            TableMetadata sourceTableMetadata = metadata.getTableMetadata(sourceTableHandle);
            Map<String, ColumnHandle> sourceTableColumns = metadata.getColumnHandles(sourceTableHandle);
            Map<String, ColumnHandle> targetTableColumns = metadata.getColumnHandles(targetTable);

            ImmutableList.Builder<Symbol> outputSymbolsBuilder = ImmutableList.builder();
View Full Code Here

Examples of org.eclipse.birt.report.model.api.TableHandle

    System.out.println("Finished");
  }

  private static void test10() throws SemanticException, IOException {
    TableHandle table = createSampleTable(null, 3, 1, 16, 1, true);
    reportDesignHandle.getBody().add(table);
  }
View Full Code Here

Examples of org.eclipse.birt.report.model.api.TableHandle

    return reportDesignHandle.getElementFactory().newGridItem(name, columnNum, rowNum);
  }

  private static TableHandle createSampleTable(String name, int columnNum, int headerRow, int detailRow, int footerRow, boolean border)
      throws SemanticException {
    TableHandle table = reportDesignHandle.getElementFactory().newTableItem(name, columnNum, headerRow, detailRow, footerRow);

    RowHandle myHeader = (RowHandle) table.getHeader().get(0);
    for (int i = 0; i < myHeader.getCells().getCount(); i++) {
      CellHandle cell = (CellHandle) myHeader.getCells().get(i);
      LabelHandle label = createLabel("Column " + i);
      cell.getContent().add(label);
      if (border) {
        setBorders(cell);
      }
    }

    for (int i = 0; i < table.getDetail().getCount(); i++) {
      RowHandle myDetail = (RowHandle) table.getDetail().get(i);
      for (int j = 0; j < myDetail.getCells().getCount(); j++) {
        CellHandle cell = (CellHandle) myDetail.getCells().get(j);
        LabelHandle label = createLabel("Cell " + i + ":" + j);
        cell.getContent().add(label);
        if (border) {
          setBorders(cell);
        }
      }
    }

    table.setProperty("repeatHeader", "true");
    return table;
  }
View Full Code Here

Examples of org.eclipse.birt.report.model.api.TableHandle

    computedSet.addItem(cs2);
    computedSet.addItem(cs3);

    reportDesignHandle.getDataSets().add(dataSetHandle);

    TableHandle mytable = elementFactory.newTableItem(null, 3, 1, 1, 1);
    mytable.setWidth("100%");
    mytable.setProperty("dataSet", dataSet);

    computedSet = mytable.getColumnBindings();

    cs1.setExpression("dataSetRow[\"Month\"]");
    computedSet.addItem(cs1);

    cs2.setExpression("dataSetRow[\"Product\"]");
    computedSet.addItem(cs2);

    cs3.setExpression("dataSetRow[\"Amount\"]");
    computedSet.addItem(cs3);

    // Header
    RowHandle myheader = (RowHandle) mytable.getHeader().get(0);

    CellHandle tcell = (CellHandle) myheader.getCells().get(0);
    setBorders(tcell);
    LabelHandle mylabel = elementFactory.newLabel(null);
    mylabel.setText("Col1");
    tcell.getContent().add(mylabel);

    tcell = (CellHandle) myheader.getCells().get(1);
    setBorders(tcell);
    // tcell.setProperty(propName, value);
    mylabel = elementFactory.newLabel(null);
    mylabel.setText("Col2");
    tcell.getContent().add(mylabel);

    tcell = (CellHandle) myheader.getCells().get(2);
    setBorders(tcell);
    mylabel = elementFactory.newLabel(null);
    mylabel.setText("Col3");
    tcell.getContent().add(mylabel);

    RowHandle mydetail = (RowHandle) mytable.getDetail().get(0);
    tcell = (CellHandle) mydetail.getCells().get(0);
    setBorders(tcell);
    DataItemHandle mydata = elementFactory.newDataItem(null);
    mydata.setResultSetColumn("Month");
    tcell.getContent().add(mydata);

    tcell = (CellHandle) mydetail.getCells().get(1);
    mydata = elementFactory.newDataItem(null);
    mydata.setResultSetColumn("Product");
    tcell.getContent().add(mydata);

    CellHandle lastCell = (CellHandle) mydetail.getCells().get(2);
    lastCell.drop();
    tcell.setColumnSpan(2);
    setBorders(tcell);

    mytable.getColumns().get(0).setProperty("width", "45%");
    mytable.getColumns().get(1).setProperty("width", "45%");
    mytable.getColumns().get(2).setProperty("width", "10%");

    return mytable;
  }
View Full Code Here

Examples of org.eclipse.birt.report.model.api.TableHandle

  }

  public static void test02() throws Exception {
    SlotHandle container = null;

    TableHandle table = createTable(100);
    // GridHandle outerGrid = (GridHandle) reportDesignHandle
    // .findElement("outerGrid");
    // container = outerGrid.getCell(1, 1).getContent();
    container = reportDesignHandle.getBody();
    // container.add(table);
View Full Code Here

Examples of org.eclipse.birt.report.model.api.TableHandle

    System.out.println("Finished");
  }

  public static void test06() throws Exception {
    GridHandle gridHandle = (GridHandle) reportDesignHandle.findElement("myGrid5");
    TableHandle table = createTable(30);
    CellHandle cell2 = gridHandle.getCell(0, 1);
    cell2.getContent().add(table);
    System.out.println("Finished");
  }
View Full Code Here

Examples of org.eclipse.birt.report.model.api.TableHandle

          columnList.add(colInfo.getColumnName());
        }

        // create new table, set the data set
        TableHandle reportTable = reportDesign.getElementFactory()
            .newTableItem(
                "testTable" + dataSetHandleToUse.getName(),
                columnList.size());
        reportTable.setWidth("100%");
        reportTable.setDataSet(dataSetHandleToUse);

        // create a new detail row and add to the report
        RowHandle detailRow = (RowHandle) reportTable.getDetail()
            .get(0);
        int x = 0; // used to mark current column position

        // go through column list and create a new column binding,
        // otherwise data will not be populated into the report
        // Then add a new column to our row
        for (Iterator i = columnList.iterator(); i.hasNext();) {
          String columnName = (String) i.next();

          ComputedColumn computedColumn = StructureFactory
              .createComputedColumn();
          computedColumn.setName(columnName);
          computedColumn.setExpression("dataSetRow[\"" + columnName
              + "\"]");
          PropertyHandle computedSet = reportTable
              .getColumnBindings();
          reportTable.getColumnBindings().addItem(computedColumn);

          // add new data item and cell
          DataItemHandle data = reportDesign.getElementFactory()
              .newDataItem(columnName);
          data.setResultSetColumn(columnName);
View Full Code Here

Examples of org.eclipse.birt.report.model.api.TableHandle

      designFactory = designHandle.getElementFactory();

      buildDataSource();
      buildDataSet(cols, fromClause);

      TableHandle table = designFactory.newTableItem("table", cols.size());
      table.setWidth("100%");
      table.setDataSet(designHandle.findDataSet("ds"));

      PropertyHandle computedSet = table.getColumnBindings();
      ComputedColumn cs1 = null;

      for( int i = 0 ; i < cols.size() ; i++ ) {
        cs1 = StructureFactory.createComputedColumn();
        cs1.setName((String) cols.get(i));
        cs1.setExpression("dataSetRow[\"" + (String) cols.get(i) + "\"]");
        computedSet.addItem(cs1);
      }

      // table header
      RowHandle tableheader = (RowHandle) table.getHeader().get(0);

      for( int i = 0 ; i < cols.size() ; i++ ) {
        LabelHandle label1 = designFactory.newLabel((String) cols.get(i));
        label1.setText((String) cols.get(i));
        CellHandle cell = (CellHandle) tableheader.getCells().get(i);
        cell.getContent().add(label1);
      }

      // table detail
      RowHandle tabledetail = (RowHandle) table.getDetail().get(0);

      for( int i = 0 ; i < cols.size() ; i++ ) {
        CellHandle cell = (CellHandle) tabledetail.getCells().get(i);
        DataItemHandle data = designFactory.newDataItem("data_" + (String) cols.get(i));
        data.setResultSetColumn((String) cols.get(i));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.