MCPcopy Create free account
hub / github.com/apache/calcite / scan

Method scan

core/src/main/java/org/apache/calcite/tools/RelBuilder.java:1787–1807  ·  view source on GitHub ↗

Creates a TableScan of the table with a given name. Throws if the table does not exist. Returns this builder. @param tableNames Name of table (can optionally be qualified)

(Iterable<String> tableNames)

Source from the content-addressed store, hash-verified

1785 * @param tableNames Name of table (can optionally be qualified)
1786 */
1787 public RelBuilder scan(Iterable<String> tableNames) {
1788 final List<String> names = ImmutableList.copyOf(tableNames);
1789 requireNonNull(relOptSchema, "relOptSchema");
1790 final RelOptTable relOptTable = relOptSchema.getTableForMember(names);
1791 if (relOptTable == null) {
1792 throw RESOURCE.tableNotFound(String.join(".", names)).ex();
1793 }
1794 final RelNode scan =
1795 struct.scanFactory.createScan(
1796 ViewExpanders.toRelContext(viewExpander, cluster),
1797 relOptTable);
1798 push(scan);
1799 rename(relOptTable.getRowType().getFieldNames());
1800
1801 // When the node is not a TableScan but from expansion,
1802 // we need to explicitly add the alias.
1803 if (!(scan instanceof TableScan)) {
1804 as(Util.last(ImmutableList.copyOf(tableNames)));
1805 }
1806 return this;
1807 }
1808
1809 /** Creates a {@link TableScan} of the table
1810 * with a given name.

Calls 13

toRelContextMethod · 0.95
pushMethod · 0.95
renameMethod · 0.95
getRowTypeMethod · 0.95
asMethod · 0.95
lastMethod · 0.95
tableNotFoundMethod · 0.80
copyOfMethod · 0.65
getTableForMemberMethod · 0.65
joinMethod · 0.65
createScanMethod · 0.65
getFieldNamesMethod · 0.65