@@ -45,23 +45,15 @@ type MemTable interface {
4545
4646// Table represents an in-memory database table.
4747type Table struct {
48- name string
49-
50- // Schema and related info
51- data * TableData
52- // ignoreSessionData is used to ignore session data for versioned tables (smoke tests only), unused otherwise
48+ data * TableData
49+ db * BaseDatabase
50+ name string
51+ projection []string
52+ projectedSchema sql.Schema
53+ columns []int
54+ filters []sql.Expression
5355 ignoreSessionData bool
54-
55- // Projection info and settings
56- pkIndexesEnabled bool
57- projection []string
58- projectedSchema sql.Schema
59- columns []int
60-
61- // filters is used for primary index scans with an index lookup
62- filters []sql.Expression
63-
64- db * BaseDatabase
56+ pkIndexesEnabled bool
6557}
6658
6759var _ sql.Table = (* Table )(nil )
@@ -301,16 +293,16 @@ func (i rangePartitionIter) Next(ctx *sql.Context) (sql.Partition, error) {
301293
302294// indexScanPartitionIter is a partition iterator that returns a single partition for an index scan
303295type indexScanPartitionIter struct {
304- once sync.Once
305296 index * Index
306297 ranges sql.Expression
307298 lookup sql.IndexLookup
299+ once sync.Once
308300}
309301
310302type indexScanPartition struct {
311303 index * Index
312- lookup sql.IndexLookup
313304 ranges sql.Expression
305+ lookup sql.IndexLookup
314306}
315307
316308func (i indexScanPartition ) Key () []byte {
@@ -414,17 +406,18 @@ func (t *Table) PartitionCount(ctx *sql.Context) (int64, error) {
414406}
415407
416408type indexScanRowIter struct {
417- i int
409+ index * Index
410+ ranges sql.Expression
411+ lookup sql.IndexLookup
412+ indexRows []sql.Row
413+
418414 incrementFunc func ()
419- index * Index
420- lookup sql.IndexLookup
421- ranges sql.Expression
422415 primaryRows map [string ][]sql.Row
423- indexRows []sql.Row
424416
425417 columns []int
426- numColumns int
427418 virtualCols []int
419+ i int
420+ numColumns int
428421}
429422
430423func newIndexScanRowIter (
@@ -677,13 +670,12 @@ func (p *partitionIter) Next(*sql.Context) (sql.Partition, error) {
677670func (p * partitionIter ) Close (* sql.Context ) error { return nil }
678671
679672type tableIter struct {
673+ indexValues sql.IndexValueIter
674+ rows []sql.Row
675+ filters []sql.Expression
680676 columns []int
681677 virtualCols []int
682678 numColumns int
683-
684- rows []sql.Row
685- filters []sql.Expression
686- indexValues sql.IndexValueIter
687679 pos int
688680}
689681
@@ -2240,8 +2232,8 @@ func (t *Table) CreatePrimaryKey(ctx *sql.Context, columns []sql.IndexColumn) er
22402232}
22412233
22422234type pkfield struct {
2243- i int
22442235 c * sql.Column
2236+ i int
22452237}
22462238
22472239type partitionRow struct {
@@ -2250,11 +2242,11 @@ type partitionRow struct {
22502242}
22512243
22522244type partitionssort struct {
2253- pk [] pkfield
2245+ ctx * sql. Context
22542246 ps map [string ][]sql.Row
2255- allRows []partitionRow
22562247 indexes map [indexName ][]sql.Row
2257- ctx * sql.Context
2248+ pk []pkfield
2249+ allRows []partitionRow
22582250}
22592251
22602252func (ps partitionssort ) Len () int {
0 commit comments