@Override public void visit(RelNode node, int ordinal, RelNode parent) { if (node instanceof TableScan) { TableScan ts = (TableScan) node; tablesUsed.add(((RelOptHiveTable) ts.getTable()).getHiveTableMD().getFullyQualifiedName()); } super.visit(node, ordinal, parent); } }.go(plan);
@Override public RelNode convert(RelNode rel) { final TableScan scan = (TableScan) rel; int parallelismHint = DEFAULT_PARALLELISM_HINT; final ParallelTable parallelTable = scan.getTable().unwrap(ParallelTable.class); if (parallelTable != null && parallelTable.parallelismHint() != null) { parallelismHint = parallelTable.parallelismHint(); } final Table table = scan.getTable().unwrap(Table.class); switch (table.getJdbcTableType()) { case STREAM: return new StreamsStreamScanRel(scan.getCluster(), scan.getTraitSet().replace(StreamsLogicalConvention.INSTANCE), scan.getTable(), parallelismHint); default: throw new IllegalArgumentException(String.format("Unsupported table type: %s", table.getJdbcTableType())); } } }
private void fetchColStats(RelNode key, TableScan tableAccessRel, ImmutableBitSet fieldsUsed, Set<RelDataTypeField> extraFields) { final List<Integer> iRefSet = Lists.newArrayList(); if (key instanceof Project) { final Project project = (Project) key; for (RexNode rx : project.getChildExps()) { iRefSet.addAll(HiveCalciteUtil.getInputRefs(rx)); } } else { final int fieldCount = tableAccessRel.getRowType().getFieldCount(); if (fieldsUsed.equals(ImmutableBitSet.range(fieldCount)) && extraFields.isEmpty()) { // get all cols iRefSet.addAll(ImmutableBitSet.range(fieldCount).asList()); } } //Remove any virtual cols if (tableAccessRel instanceof HiveTableScan) { iRefSet.removeAll(((HiveTableScan)tableAccessRel).getVirtualCols()); } if (!iRefSet.isEmpty()) { final RelOptTable table = tableAccessRel.getTable(); if (table instanceof RelOptHiveTable) { ((RelOptHiveTable) table).getColStat(iRefSet, true); LOG.debug("Got col stats for {} in {}", iRefSet, tableAccessRel.getTable().getQualifiedName()); } } }
((RelOptHiveTable)tableScan.getTable()).getHiveTableMD().getFullyQualifiedName(); final ValidWriteIdList tableCurrentTxnList = currentTxnList.getTableValidWriteIdList(tableQName); int rowIDPos = tableScan.getTable().getRowType().getField( VirtualColumn.ROWID.getName(), false, false).getIndex(); RexNode rowIDFieldAccess = rexBuilder.makeFieldAccess( rexBuilder.makeInputRef(tableScan.getTable().getRowType().getFieldList().get(rowIDPos).getType(), rowIDPos), 0);
@Override public RelNode visit(TableScan scan) { if (scan instanceof HiveTableScan) { HiveTableScan hiveScan = (HiveTableScan) scan; RelOptHiveTable relOptHiveTable = (RelOptHiveTable) hiveScan.getTable(); Table tab = relOptHiveTable.getHiveTableMD(); if (tab.isTemporary()) { fail(tab.getTableName() + " is a temporary table"); } if (tab.getTableType() == TableType.EXTERNAL_TABLE) { fail(tab.getFullyQualifiedName() + " is an external table"); } return scan; } // TableScan of a non-Hive table - don't support for materializations. fail(scan.getTable().getQualifiedName() + " is a table scan of a non-Hive table."); return scan; }
@Override public RelNode visit(TableScan scan) { if (tables.contains(scan.getTable().getQualifiedName())) { used.value = true; } return scan; } @Override
/** * TableScan table reference. */ public Set<RelTableRef> getTableReferences(TableScan rel, RelMetadataQuery mq) { return ImmutableSet.of(RelTableRef.of(rel.getTable(), 0)); }
private void handleFinalTableScan(TableScan tableScan) { RelOptTableImpl relOptTable = ((RelOptTableImpl) tableScan.getTable()); List<String> tableAlias = createTableAlias(relOptTable.getNames()); rootNodeSchemas.put(this.relNode, new AbstractMap.SimpleEntry<>(tableAlias.get(0), tableScan.getTable())); }
@Override public RelNode visit(final TableScan scan) { builder.add(scan.getTable().getQualifiedName()); return super.visit(scan); }
public static boolean test(TableScan scan) { // We can only push filters into a FilterableTable or // ProjectableFilterableTable. final RelOptTable table = scan.getTable(); return table.unwrap(FilterableTable.class) != null || table.unwrap(ProjectableFilterableTable.class) != null; }
TableRef tableRef(TableScan scan) { final TableRef r = tableRefs.get(scan.getId()); if (r != null) { return r; } final LatticeTable t = space.register(scan.getTable()); final TableRef r2 = new TableRef(t, tableRefs.size()); tableRefs.put(scan.getId(), r2); return r2; }
/** @see #dispatch */ public Result visit(TableScan e) { final SqlIdentifier identifier = new SqlIdentifier(e.getTable().getQualifiedName(), SqlParserPos.ZERO); return result(identifier, ImmutableList.of(Clause.FROM), e, null); }
/** @see #dispatch */ public Result visit(TableScan e) { final SqlIdentifier identifier = new SqlIdentifier(e.getTable().getQualifiedName(), SqlParserPos.ZERO); return result(identifier, ImmutableList.of(Clause.FROM), e, null); }
public ImmutableList<RelCollation> collations(EnumerableMergeJoin join, RelMetadataQuery mq) { // In general a join is not sorted. But a merge join preserves the sort // order of the left and right sides. return ImmutableList.copyOf( RelMdCollation.mergeJoin(mq, join.getLeft(), join.getRight(), join.getLeftKeys(), join.getRightKeys())); }
public ImmutableList<RelCollation> collations(EnumerableMergeJoin join, RelMetadataQuery mq) { // In general a join is not sorted. But a merge join preserves the sort // order of the left and right sides. return ImmutableList.copyOf( RelMdCollation.mergeJoin(mq, join.getLeft(), join.getRight(), join.getLeftKeys(), join.getRightKeys())); }
@Override public RelNode visit(TableScan tableScan) { List<String> tablePath = tableScan.getTable().getQualifiedName(); final AccelerationSettings settings = reflectionSettings.getReflectionSettings(new NamespaceKey(tablePath)); refreshField.value = settings.getRefreshField(); return tableScan; } });
@Override public RelNode visit(TableScan tableScan) { List<String> tablePath = tableScan.getTable().getQualifiedName(); final AccelerationSettings settings = reflectionSettings.getReflectionSettings(new NamespaceKey(tablePath)); isIncremental = settings.getMethod() == RefreshMethod.INCREMENTAL; return tableScan; }
@Override public RelNode visit(TableScan scan) { schemas[0] = scan.getTable().getRelOptSchema(); return super.visit(scan); } });