org.teiid.metadata.Table.getCardinality()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(102)

本文整理了Java中org.teiid.metadata.Table.getCardinality()方法的一些代码示例,展示了Table.getCardinality()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table.getCardinality()方法的具体详情如下:
包路径:org.teiid.metadata.Table
类名称:Table
方法名:getCardinality

Table.getCardinality介绍

暂无

代码示例

代码示例来源:origin: org.jboss.teiid/teiid-engine

@Override
  public void fillRow(List<Object> row, Table table,
      VDBMetaData v, TransformationMetadata metadata,
      CommandContext cc, SimpleIterator<Table> iter) {
    row.add(v.getName());
    row.add(table.getParent().getName());
    row.add(table.getName());
    row.add(table.getTableType().toString());
    row.add(table.getNameInSource());
    row.add(table.isPhysical());
    row.add(table.supportsUpdate());
    row.add(table.getUUID());
    row.add(table.getCardinality());
    row.add(table.getAnnotation());
    row.add(table.isSystem());
    row.add(table.isMaterialized());
    row.add(table.getParent().getUUID());
  }
});

代码示例来源:origin: org.teiid/teiid-engine

private String buildTableOptions(Table table) {
  StringBuilder options = new StringBuilder();
  addCommonOptions(options, table);
  
  if (table.isMaterialized()) {
    addOption(options, MATERIALIZED, table.isMaterialized());
    if (table.getMaterializedTable() != null) {
      addOption(options, MATERIALIZED_TABLE, table.getMaterializedTable().getName());
    }
  }
  if (table.supportsUpdate()) {
    addOption(options, UPDATABLE, table.supportsUpdate());
  }
  if (table.getCardinality() != -1) {
    if (table.getCardinality() != table.getCardinalityAsFloat()) {
      addOption(options, CARDINALITY, (long)table.getCardinalityAsFloat());
    } else {
      addOption(options, CARDINALITY, table.getCardinality());
    }
  }
  if (!table.getProperties().isEmpty()) {
    for (String key:table.getProperties().keySet()) {
      addOption(options, key, table.getProperty(key, false));
    }
  }
  return options.toString();
}

代码示例来源:origin: teiid/teiid

@Override
  public void fillRow(List<Object> row, Table table,
      VDBMetaData v, TransformationMetadata metadata,
      CommandContext cc, SimpleIterator<Table> iter) {
    row.add(v.getName());
    row.add(table.getParent().getName());
    row.add(table.getName());
    row.add(table.getTableType().toString());
    row.add(table.getNameInSource());
    row.add(table.isPhysical());
    row.add(table.supportsUpdate());
    row.add(table.getUUID());
    row.add(table.getCardinality());
    row.add(table.getAnnotation());
    row.add(table.isSystem());
    row.add(table.isMaterialized());
    row.add(table.getParent().getUUID());
  }
});

代码示例来源:origin: teiid/teiid

private String buildTableOptions(Table table) {
  StringBuilder options = new StringBuilder();
  addCommonOptions(options, table);
  
  if (table.isMaterialized()) {
    addOption(options, MATERIALIZED, table.isMaterialized());
    if (table.getMaterializedTable() != null) {
      addOption(options, MATERIALIZED_TABLE, table.getMaterializedTable().getName());
    }
  }
  if (table.supportsUpdate()) {
    addOption(options, UPDATABLE, table.supportsUpdate());
  }
  if (table.getCardinality() != -1) {
    if (table.getCardinality() != table.getCardinalityAsFloat()) {
      addOption(options, CARDINALITY, (long)table.getCardinalityAsFloat());
    } else {
      addOption(options, CARDINALITY, table.getCardinality());
    }
  }
  if (!table.getProperties().isEmpty()) {
    for (String key:table.getProperties().keySet()) {
      addOption(options, key, table.getProperty(key, false));
    }
  }
  return options.toString();
}

代码示例来源:origin: org.teiid/teiid-engine

@Override
  public void fillRow(List<Object> row, Table table,
      VDBMetaData v, TransformationMetadata metadata,
      CommandContext cc, SimpleIterator<Table> iter) {
    row.add(v.getName());
    row.add(table.getParent().getName());
    row.add(table.getName());
    row.add(table.getTableType().toString());
    row.add(table.getNameInSource());
    row.add(table.isPhysical());
    row.add(table.supportsUpdate());
    row.add(table.getUUID());
    row.add(table.getCardinality());
    row.add(table.getAnnotation());
    row.add(table.isSystem());
    row.add(table.isMaterialized());
    row.add(table.getParent().getUUID());
  }
});

代码示例来源:origin: org.jboss.teiid/teiid-engine

private String buildTableOptions(Table table) {
  StringBuilder options = new StringBuilder();
  addCommonOptions(options, table);
  
  if (table.isMaterialized()) {
    addOption(options, MATERIALIZED, table.isMaterialized());
    if (table.getMaterializedTable() != null) {
      addOption(options, MATERIALIZED_TABLE, table.getMaterializedTable().getName());
    }
  }
  if (table.supportsUpdate()) {
    addOption(options, UPDATABLE, table.supportsUpdate());
  }
  if (table.getCardinality() != -1) {
    if (table.getCardinality() != table.getCardinalityAsFloat()) {
      addOption(options, CARDINALITY, (long)table.getCardinalityAsFloat());
    } else {
      addOption(options, CARDINALITY, table.getCardinality());
    }
  }
  if (!table.getProperties().isEmpty()) {
    for (String key:table.getProperties().keySet()) {
      addOption(options, key, table.getProperty(key, false));
    }
  }
  return options.toString();
}

代码示例来源:origin: org.teiid.connectors/translator-jdbc

if (tableInfo.table.getCardinality() == Table.UNKNOWN_CARDINALITY) {
  getTableStatistics(conn, tableInfo.catalog, tableInfo.schema, tableInfo.name, tableInfo.table);

代码示例来源:origin: org.teiid/teiid-olingo

if (table.getCardinality() != -1) {
  addIntAnnotation(entityType, "teiid.CARDINALITY", table.getCardinality());

代码示例来源:origin: teiid/teiid

@Test
public void testAlterTableAddOptions() throws Exception {
  String ddl = "CREATE FOREIGN TABLE G1( e1 integer, e2 varchar, e3 date);" +
      "ALTER FOREIGN TABLE G1 OPTIONS(ADD CARDINALITY 12);" +
      "ALTER FOREIGN TABLE G1 OPTIONS(ADD FOO 'BAR');";
  Schema s = helpParse(ddl, "model").getSchema();
  Map<String, Table> tableMap = s.getTables();    
  
  assertTrue("Table not found", tableMap.containsKey("G1"));
  Table table = tableMap.get("G1");
  assertEquals(12, table.getCardinality());
  assertEquals("BAR", table.getProperty("FOO", false));
}

代码示例来源:origin: teiid/teiid

@Test
public void testAlterTableModifyOptions() throws Exception {
  String ddl = "CREATE FOREIGN TABLE G1( e1 integer, e2 varchar, e3 date) OPTIONS(CARDINALITY 12, FOO 'BAR');" +
      "ALTER FOREIGN TABLE G1 OPTIONS(SET CARDINALITY 24);" +
      "ALTER FOREIGN TABLE G1 OPTIONS(SET FOO 'BARBAR');";
  Schema s = helpParse(ddl, "model").getSchema();
  Map<String, Table> tableMap = s.getTables();    
  
  assertTrue("Table not found", tableMap.containsKey("G1"));
  Table table = tableMap.get("G1");
  assertEquals(24, table.getCardinality());
  assertEquals("BARBAR", table.getProperty("FOO", false));
}

代码示例来源:origin: teiid/teiid

@Test
public void testAlterTableDropOptions() throws Exception {
  String ddl = "CREATE FOREIGN TABLE G1( e1 integer, e2 varchar, e3 date) OPTIONS(CARDINALITY 12, FOO 'BAR');" +
      "ALTER FOREIGN TABLE G1 OPTIONS(DROP CARDINALITY);" +
      "ALTER FOREIGN TABLE G1 OPTIONS(DROP FOO);";
  Schema s = helpParse(ddl, "model").getSchema();
  Map<String, Table> tableMap = s.getTables();    
  
  assertTrue("Table not found", tableMap.containsKey("G1"));
  Table table = tableMap.get("G1");
  assertEquals(-1, table.getCardinality());
  assertNull(table.getProperty("FOO", false));
}

代码示例来源:origin: teiid/teiid

@Test
public void testView() throws Exception {
  String ddl = "CREATE View G1( e1 integer, e2 varchar) OPTIONS (CARDINALITY 12) AS select e1, e2 from foo.bar";
  Schema s = helpParse(ddl, "model").getSchema();
  Map<String, Table> tableMap = s.getTables();    
  
  Table table = tableMap.get("G1");
  
  assertEquals("SELECT e1, e2 FROM foo.bar", table.getSelectTransformation());
  assertEquals(12, table.getCardinality());
}

代码示例来源:origin: teiid/teiid

@Test
public void testAlterTableAddColumnOptions() throws Exception {
  String ddl = "CREATE FOREIGN TABLE G1( e1 integer, e2 varchar, e3 date);" +
      "ALTER FOREIGN TABLE G1 OPTIONS(ADD CARDINALITY 12);" +
      "ALTER FOREIGN TABLE G1 ALTER COLUMN e1 OPTIONS(ADD NULL_VALUE_COUNT 12);" +
      "ALTER FOREIGN TABLE G1 ALTER COLUMN e1 OPTIONS(ADD FOO 'BAR');";
  Schema s = helpParse(ddl, "model").getSchema();
  Map<String, Table> tableMap = s.getTables();    
  
  assertTrue("Table not found", tableMap.containsKey("G1"));
  Table table = tableMap.get("G1");
  assertEquals(12, table.getCardinality());
  Column c = table.getColumnByName("e1");
  assertNotNull(c);
  
  assertEquals("BAR", c.getProperty("FOO", false));
  assertEquals(12, c.getNullValues());
}

代码示例来源:origin: teiid/teiid

assertFalse(table.isDeletePlanEnabled());
assertEquals("uuid2", table.getUUID());
assertEquals(12, table.getCardinality());
assertTrue(table.supportsUpdate());
assertEquals("BAR", table.getProperties().get("FOO"));

相关文章

微信公众号

最新文章

更多