public boolean isFilterPushed() { try { return filter != null || getTableMetadata().getSplitRatio() < 1.0d; }catch(Exception ex) { throw Throwables.propagate(ex); } }
@Override public double estimateRowCount(RelMetadataQuery mq) { try{ return getFilterReduction() * table.getRowCount() * tableMetadata.getSplitRatio() * observedRowcountAdjustment; }catch(NamespaceException ex){ throw Throwables.propagate(ex); } }
@Override public boolean matches(RelOptRuleCall call) { final ScanRelBase scan = call.rel(1); if (scan.getPluginId().getType().equals(pluginType)) { try { if(scan.getTableMetadata().getSplitRatio() == 1.0d){ final List<String> partitionColumns = scan.getTableMetadata().getReadDefinition().getPartitionColumnsList(); return partitionColumns != null && !partitionColumns.isEmpty(); } } catch (NamespaceException e) { logger.warn("Unable to calculate split.", e); return false; } } return false; }
@Override public boolean matches(RelOptRuleCall call) { final ScanRelBase scan = call.rel(2); if (scan.getPluginId().getType().equals(pluginType)) { try { if(scan.getTableMetadata().getSplitRatio() == 1.0d){ final List<String> partitionColumns = scan.getTableMetadata().getReadDefinition().getPartitionColumnsList(); return partitionColumns != null && !partitionColumns.isEmpty(); } } catch (NamespaceException e) { logger.warn("Unable to calculate split.", e); return false; } } return false; }
private Prel newScan(RelDataType rowType, double rowCount, double splitRatio) throws Exception { TableMetadata metadata = Mockito.mock(TableMetadata.class); when(metadata.getName()).thenReturn(new NamespaceKey(ImmutableList.of("sys", "version"))); when(metadata.getSchema()).thenReturn(SystemTable.VERSION.getSchema()); when(metadata.getSplitRatio()).thenReturn(splitRatio); StoragePluginId pluginId = new StoragePluginId(new SourceConfig().setConfig(new SystemPluginConf().toBytesString()), new SystemPluginConf(), SourceCapabilities.NONE); when(metadata.getStoragePluginId()).thenReturn(pluginId); List<SchemaPath> columns = FluentIterable.from(SystemTable.VERSION.getSchema()).transform(input -> SchemaPath.getSimplePath(input.getName())).toList(); final RelOptTable relOptTable = Mockito.mock(RelOptTable.class); when(relOptTable.getRowCount()).thenReturn(rowCount); return new SystemScanPrel(cluster, traits, relOptTable, metadata, columns, 1.0d, rowType); }