You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: optimize_test.go
    path of file: ./repos/tidb/pkg/planner/cascades
    
    the code of the file until where you have to start completion: // Copyright 2018 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package cascades

import (
	"context"
	"math"
	"testing"

	"github.com/pingcap/tidb/pkg/domain"
	"github.com/pingcap/tidb/pkg/expression"
	"github.com/pingcap/tidb/pkg/infoschema"
	"g
    
func TestPreparePossibleProperties(t *testing.T) {
	p := parser.New()
	ctx := plannercore.MockContext()
	defer func() {
		domain.GetDomain(ctx).StatsHandle().Close()
	}()
	is := infoschema.MockInfoSchema([]*model.TableInfo{plannercore.MockSignedTable()})
	domain.GetDomain(ctx).MockInfoCacheAndLoadInfoSchema(is)
	optimizer := NewOptimizer()

	optimizer.ResetTransformationRules(map[memo.Operand][]Transformation{
		memo.OperandDataSource: {
			NewRuleEnumeratePaths(),
		},
	})
	defer func() {
		optimizer.ResetTransformationRules(DefaultRuleBatches...)
	}()

	stmt, err := p.ParseOneStmt("select f, sum(a) from t group by f", "", "")
	require.NoError(t, err)

	plan, err := plannercore.BuildLogicalPlanForTest(context.Background(), ctx, stmt, is)
	require.NoError(t, err)

	logic, ok := plan.(plannercore.LogicalPlan)
	require.True(t, ok)

	logic, err = optimizer.onPhasePreprocessing(ctx.GetPlanCtx(), logic)
	require.NoError(t, err)

	// collect the target columns: f, a
	ds, ok := logic.Children()[0].Children()[0].(*plannercore.DataSource)
	require.True(t, ok)

	var columnF, columnA *expression.Column
	for i, col := range ds.Columns {
		if col.Name.L == "f" {
			columnF = ds.Schema().Columns[i]
		} else if col.Name.L == "a" {
			columnA = ds.Schema().Columns[i]
		}
	}
	require.NotNil(t, columnF)
	require.NotNil(t, columnA)

	agg, ok := logic.Children()[0].(*plannercore.LogicalAggregation)
	require.True(t, ok)

	group := memo.Convert2Group(agg)
	require.NoError(t, optimizer.onPhaseExploration(ctx.GetPlanCtx(), group))

	// The memo looks like this:
	// Group#0 Schema:[Column#13,test.t.f]
	//   Aggregation_2 input:[Group#1], group by:test.t.f, funcs:sum(test.t.a), firstrow(test.t.f)
	// Group#1 Schema:[test.t.a,test.t.f]
	//   TiKVSingleGather_5 input:[Group#2], table:t
	//   TiKVSingleGather_9 input:[Group#3], table:t, index:f_g
	//   TiKVSingleGather_7 input:[Group#4], table:t, index:f
	// Group#2 Schema:[test.t.a,test.t.f]
	//   TableScan_4 table:t, pk col:test.t.a
	// Group#3 Schema:[test.t.a,test.t.f]
	//   IndexScan_8 table:t, index:f, g
	// Group#4 Schema:[test.t.a,test.t.f]
	//   IndexScan_6 table:t, index:f
	propMap := make(map[*memo.Group][][]*expression.Column)
	aggProp := preparePossibleProperties(group, propMap)
	// We only have one prop for Group0 : f
	require.Len(t, aggProp, 1)
	require.True(t, aggProp[0][0].EqualColumn(columnF))

	gatherGroup := group.Equivalents.Front().Value.(*memo.GroupExpr).Children[0]
	gatherProp, ok := propMap[gatherGroup]
	require.True(t, ok)
	// We have 2 props for Group1: [f], [a]
	require.Len(t, gatherProp, 2)
	for _, prop := range gatherProp {
		require.Len(t, prop, 1)
		require.True(t, prop[0].EqualColumn(columnA) || prop[0].EqualColumn(columnF))
	}
}