// Clone copies the total schema.
970302
func (s Schema) Clone() Schema {
	result := NewSchema(make([]*Column, 0, s.Len()))
	keys := make([]KeyInfo, 0, len(s.Keys))
	for _, col := range s.Columns {
		newCol := *col
		result.Append(&newCol)
	}
	for _, key := range s.Keys {
		keys = append(keys, key.Clone())
	}
	result.SetUniqueKeys(keys)
	return result
}
1098645
func (c *HealthCheck) Clone() *HealthCheck {
	clone := new(HealthCheck)
	*clone = *c
	return clone
}
996220
func (n *Node) Clone() *Node {
	var c Node
	c.Copy(n)
	return &c
}
1153761
func (fs *FilteringSource) Clone() Source {
	return &FilteringSource{
		Source: fs.Source.Clone(),
		Filter: fs.Filter,
	}
}
1219751
func (e *EntityDefinition) Clone() *EntityDefinition {
	newEd := &EntityDefinition{
		Name: e.Name,
		Key:  e.Key.Clone(),
		ETL:  e.ETL,
	}

	if e.Columns != nil {
		newEd.Columns = make([]*ColumnDefinition, len(e.Columns))
		for i, col := range e.Columns {
			newEd.Columns[i] = col.Clone()
		}
	}

	if e.Indexes != nil {
		newEd.Indexes = make(map[string]*IndexDefinition)
		if e.Indexes == nil {
			newEd.Indexes = nil
		}
		for k, index := range e.Indexes {
			newEd.Indexes[k] = index.Clone()
		}
	}

	return newEd
}
1032906
func (k internalKey) clone() internalKey {
	x := make(internalKey, len(k))
	copy(x, k)
	return x
}
553492
func (s *Layer) Clone() Middleware {
	mw := New()
	mw.parent = s.parent
	s.mtx.Lock()
	mw.stack = append([]plugin.Plugin(nil), s.stack...)
	s.mtx.Unlock()
	return mw
}
550672
func (h *Host) Clone() *Host {
	var c Host
	c.Copy(h)
	return &c
}
253940
func (bv Values) Clone() Values {
	if n := len(bv); n > 0 {
		values := make(Values, n, n)
		copy(values, bv)
		return values
	}

	return NewValues()
}
322930
func (tp *TranslationProvider) Clone(d *deps.Deps) error {
	d.Translate = tp.t.Func(d.Language.Lang)

	return nil
}
1360837
func (t *Table) clone() *Table {
	tt := &Table{outputMode: t.outputMode, Style: t.Style, title: t.title}
	if t.headers != nil {
		tt.headers = make([]interface{}, len(t.headers))
		copy(tt.headers, t.headers)
	}
	if t.elements != nil {
		tt.elements = make([]Element, len(t.elements))
		copy(tt.elements, t.elements)
	}
	return tt
}
1301674
func (rules Rules) Clone() Rules {
	rulesCopy := make(Rules)

	for pattern, targetIDSet := range rules {
		rulesCopy[pattern] = targetIDSet.Clone()
	}

	return rulesCopy
}
142192
func (cd *ColumnDefinition) Clone() *ColumnDefinition {
	// TODO: clone tag
	return &ColumnDefinition{
		Name: cd.Name,
		Type: cd.Type,
	}
}
787606
func (r *RootFS) Clone() *RootFS {
	newRoot := NewRootFS()
	newRoot.Type = r.Type
	newRoot.DiffIDs = make([]layer.DiffID, len(r.DiffIDs))
	copy(newRoot.DiffIDs, r.DiffIDs)
	return newRoot
}
883383
func (c *Container) Clone() *Container {
	vj := *c
	if vj.next != nil {
		vj.next = vj.next.Clone()
	}
	return &vj
}
402718
func (s *SelectStatement) Clone() *SelectStatement {
	clone := *s
	clone.Fields = make(Fields, 0, len(s.Fields))
	clone.Dimensions = make(Dimensions, 0, len(s.Dimensions))
	clone.Sources = cloneSources(s.Sources)
	clone.SortFields = make(SortFields, 0, len(s.SortFields))
	clone.Condition = CloneExpr(s.Condition)

	if s.Target != nil {
		clone.Target = &Target{
			Measurement: &Measurement{
				Database:        s.Target.Measurement.Database,
				RetentionPolicy: s.Target.Measurement.RetentionPolicy,
				Name:            s.Target.Measurement.Name,
				Regex:           CloneRegexLiteral(s.Target.Measurement.Regex),
			},
		}
	}
	for _, f := range s.Fields {
		clone.Fields = append(clone.Fields, &Field{Expr: CloneExpr(f.Expr), Alias: f.Alias})
	}
	for _, d := range s.Dimensions {
		clone.Dimensions = append(clone.Dimensions, &Dimension{Expr: CloneExpr(d.Expr)})
	}
	for _, f := range s.SortFields {
		clone.SortFields = append(clone.SortFields, &SortField{Name: f.Name, Ascending: f.Ascending})
	}
	return &clone
}
1085600
func (mp MultiPolygon) Clone() MultiPolygon {
	if mp == nil {
		return nil
	}

	nmp := make(MultiPolygon, 0, len(mp))
	for _, p := range mp {
		nmp = append(nmp, p.Clone())
	}

	return nmp
}