Package org.apache.calcite.profile
Class ProfilerImpl.Run
- java.lang.Object
-
- org.apache.calcite.profile.ProfilerImpl.Run
-
- Enclosing class:
- ProfilerImpl
class ProfilerImpl.Run extends java.lang.Object
A run of the profiler.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<Profiler.Column>
columns
(package private) java.util.Map<ImmutableBitSet,Profiler.Distribution>
distributions
(package private) java.util.Queue<ProfilerImpl.Space>
doneQueue
Combinations of columns that we have computed but whose successors have not yet been computed.(package private) java.util.List<Profiler.FunctionalDependency>
functionalDependencies
private java.util.List<ImmutableBitSet>
keyOrdinalLists
(package private) PartiallyOrderedSet<ImmutableBitSet>
keyPoset
(package private) PartiallyOrderedSet<ProfilerImpl.Space>
results
(package private) java.util.Set<ImmutableBitSet>
resultSet
Column ordinals that have ever been placed onspaceQueue
.private int
rowCount
(package private) java.util.List<ProfilerImpl.Space>
singletonSpaces
List of spaces that have one column.(package private) java.util.Deque<ImmutableBitSet>
spaceQueue
Combinations of columns that we will compute next pass.(package private) ProfilerImpl.SurpriseQueue
surprises
(package private) java.util.List<Profiler.Unique>
uniques
-
Constructor Summary
Constructors Constructor Description Run(java.util.List<Profiler.Column> columns, java.util.Collection<ImmutableBitSet> initialGroups)
Creates a Run.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private double
cardinality(double rowCount, ImmutableBitSet columns)
Estimates the cardinality of a collection of columns represented bycolumnOrdinals
, drawing on existing distributions.private boolean
containsKey(ImmutableBitSet ordinals)
private double
expectedCardinality(double rowCount, ImmutableBitSet columns)
Estimates the cardinality of a collection of columns represented bycolumnOrdinals
, drawing on existing distributions.(package private) java.util.List<ProfilerImpl.Space>
nextBatch(int pass)
Populatesspaces
with the next batch.(package private) void
pass(int pass, java.util.List<ProfilerImpl.Space> spaces, java.lang.Iterable<java.util.List<java.lang.Comparable>> rows)
(package private) Profiler.Profile
profile(java.lang.Iterable<java.util.List<java.lang.Comparable>> rows)
private com.google.common.collect.ImmutableSortedSet<Profiler.Column>
toColumns(java.lang.Iterable<java.lang.Integer> ordinals)
-
-
-
Field Detail
-
columns
private final java.util.List<Profiler.Column> columns
-
keyPoset
final PartiallyOrderedSet<ImmutableBitSet> keyPoset
-
distributions
final java.util.Map<ImmutableBitSet,Profiler.Distribution> distributions
-
singletonSpaces
final java.util.List<ProfilerImpl.Space> singletonSpaces
List of spaces that have one column.
-
doneQueue
final java.util.Queue<ProfilerImpl.Space> doneQueue
Combinations of columns that we have computed but whose successors have not yet been computed. We may add some of those successors tospaceQueue
.
-
surprises
final ProfilerImpl.SurpriseQueue surprises
-
spaceQueue
final java.util.Deque<ImmutableBitSet> spaceQueue
Combinations of columns that we will compute next pass.
-
uniques
final java.util.List<Profiler.Unique> uniques
-
functionalDependencies
final java.util.List<Profiler.FunctionalDependency> functionalDependencies
-
resultSet
final java.util.Set<ImmutableBitSet> resultSet
Column ordinals that have ever been placed onspaceQueue
. Ensures that we do not calculate the same combination more than once, even though we generate a column set from multiple parents.
-
results
final PartiallyOrderedSet<ProfilerImpl.Space> results
-
keyOrdinalLists
private final java.util.List<ImmutableBitSet> keyOrdinalLists
-
rowCount
private int rowCount
-
-
Constructor Detail
-
Run
Run(java.util.List<Profiler.Column> columns, java.util.Collection<ImmutableBitSet> initialGroups)
Creates a Run.- Parameters:
columns
- List of columnsinitialGroups
- List of combinations of columns that should be profiled early, because they may be interesting
-
-
Method Detail
-
profile
Profiler.Profile profile(java.lang.Iterable<java.util.List<java.lang.Comparable>> rows)
-
nextBatch
java.util.List<ProfilerImpl.Space> nextBatch(int pass)
Populatesspaces
with the next batch. Returns an empty list if done.
-
containsKey
private boolean containsKey(ImmutableBitSet ordinals)
-
pass
void pass(int pass, java.util.List<ProfilerImpl.Space> spaces, java.lang.Iterable<java.util.List<java.lang.Comparable>> rows)
-
cardinality
private double cardinality(double rowCount, ImmutableBitSet columns)
Estimates the cardinality of a collection of columns represented bycolumnOrdinals
, drawing on existing distributions.
-
expectedCardinality
private double expectedCardinality(double rowCount, ImmutableBitSet columns)
Estimates the cardinality of a collection of columns represented bycolumnOrdinals
, drawing on existing distributions. Does not look in the distribution map for this column set.
-
toColumns
private com.google.common.collect.ImmutableSortedSet<Profiler.Column> toColumns(java.lang.Iterable<java.lang.Integer> ordinals)
-
-