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: connector.go
    path of file: ./repos/aresdb/client
    
    the code of the file until where you have to start completion: //  Copyright (c) 2017-2018 Uber Technologies, 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 client

import (
	"bytes"
	"fmt"
	"net/
    
func (u *UpsertBatchBuilderImpl) prepareEnumCases(isEnumArrayCol bool, tableName, columnName string, colIndex, columnID int, rows []Row, abandonRows map[int]struct{}, caseInsensitive bool, disableAutoExpand bool) error {
	enumCaseSet := make(map[string]struct{})
	for rowIndex, row := range rows {
		if _, exist := abandonRows[rowIndex]; exist {
			continue
		}
		value := row[colIndex]

		if value == nil {
			continue
		}

		abandonRow := false
		if enumCase, ok := value.(string); ok {
			if len(enumCase) > defaultStringEnumLength {
				abandonRow = true
				u.logger.With(
					"name", "prepareEnumCases",
					"error", "Enum string value is too long",
					"table", tableName,
					"columnID", columnID,
					"value", value).Debug("Enum string value is too long")
				u.metricScope.Tagged(map[string]string{"table": tableName, "columnID": strconv.Itoa(columnID)}).
					Counter("abandoned_rows_long_string").Inc(1)
			} else {
				if isEnumArrayCol {
					arrVal := make([]interface{}, 0)
					if err := json.Unmarshal([]byte(enumCase), &arrVal); err != nil {
						abandonRow = true
						u.logger.With(
							"name", "prepareEnumCases",
							"error", "Fail to unmarshal enum array value",
							"table", tableName,
							"columnID", columnID,
							"value", value).Debug("Fail to unmarshal enum array value")
						u.metricScope.Tagged(map[string]string{"table": tableName, "columnID": strconv.Itoa(columnID)}).
							Counter("abandoned_rows_enum_array_parse_error").Inc(1)
					} else {
						for _, val := range arrVal {
							if val != nil {
								item, ok := val.(string)
								if !ok {
									abandonRow = true
									u.logger.With(
										"name", "prepareEnumCases",
										"error", "Enum array value should be string",
										"table", tableName,
										"columnID", columnID,
										"value", value).Debug("Enum array value is not string")
									break
								}
								if caseInsensitive {
									item = strings.ToLower(item)
								}
								enumCaseSet[item] = struct{}{}
							}
						}
					}
				} else {
					if caseInsensitive {
						enumCase = strings.ToLower(enumCase)
					}
					enumCaseSet[enumCase] = struct{}{}
				}
			}
		} else {
			abandonRow = true
			u.logger.With(
				"name", "prepareEnumCases",
				"error", "Enum value should be string",
				"table", tableName,
				"columnID", columnID,
				"value", value).Debug("Enum value is not string")

		}
		if abandonRow {
			u.metricScope.Tagged(map[string]string{"table": tableName, "columnID": strconv.Itoa(columnID)}).
				Counter("abandoned_rows").Inc(1)
			abandonRows[rowIndex] = struct{}{}
		}
	}

	if len(enumCaseSet) > 0 {
		enumCases := make([]string, 0, len(enumCaseSet))
		for enumCase := range enumCaseSet {
			enumCases = append(enumCases, enumCase)
		}
		err := u.schemaHandler.PrepareEnumCases(tableName, columnName, enumCases)
		if err != nil {
			return err
		}
	}
	return nil
}