Repository: pingcap/tidb
File: pkg/executor/importer/import.go (Go)

Code before:
		Schema: e.DBName,
		Name:   e.Table.Meta().Name.O,
	}
	res := []mydump.FileInfo{}
	for _, f := range e.dataFiles {
		res = append(res, mydump.FileInfo{
			TableName: tbl,
			FileMeta:  *f,
		})
	}
	return res
}

// IsLocalSort returns true if we sort data on local disk.
func (p *Plan) IsLocalSort() bool {
	return p.CloudStorageURI == ""
}

// IsGlobalSort returns true if we sort data on global storage.
func (p *Plan) IsGlobalSort() bool {
	return !p.IsLocalSort()
}

// checkCSVOnlyOptions check all csc only options is default or not in plan when
// format is not csv. Skip check for not ImportInto plan and csv format.
func (p *Plan) checkCSVOnlyOptions() error {
	if !p.InImportInto || p.Format == DataFormatCSV {
		return nil
	}
	if *p.Charset != defaultCharacterSet {
		return exeerrors.ErrLoadDataUnsupportedOption.FastGenByArgs(characterSetOption, "non-CSV format")
	}
	defaultLineFieldsInfo := newDefaultLineFieldsInfo()
	if p.FieldsTerminatedBy != defaultLineFieldsInfo.FieldsTerminatedBy {
		return exeerrors.ErrLoadDataUnsupportedOption.FastGenByArgs(fieldsTerminatedByOption, "non-CSV format")
	}
	if p.FieldsEnclosedBy != defaultLineFieldsInfo.FieldsEnclosedBy {
		return exeerrors.ErrLoadDataUnsupportedOption.FastGenByArgs(fieldsEnclosedByOption, "non-CSV format")
	}
	if p.FieldsEscapedBy != defaultLineFieldsInfo.FieldsEscapedBy {
		return exeerrors.ErrLoadDataUnsupportedOption.FastGenByArgs(fieldsEscapedByOption, "non-CSV format")
	}
	if p.LinesTerminatedBy != defaultLineFieldsInfo.LinesTerminatedBy {
		return exeerrors.ErrLoadDataUnsupportedOption.FastGenByArgs(linesTerminatedByOption, "non-CSV format")
	}
	if len(p.FieldNullDef) != len(defaultFieldNullDef) || p.FieldNullDef[0] != defaultFieldNullDef[0] {
		return exeerrors.ErrLoadDataUnsupportedOption.FastGenByArgs(fieldsDefinedNullByOption, "non-CSV format")
	}
	if p.IgnoreLines != 0 {
		return exeerrors.ErrLoadDataUnsupportedOption.FastGenByArgs(skipRowsOption, "non-CSV format")
	}

Review comment (suggestion):
```suggestion
func (p *Plan) checkNonCSVFormatOptions() error {
```

Code after:
	return res
}

// IsLocalSort returns true if we sort data on local disk.
func (p *Plan) IsLocalSort() bool {
	return p.CloudStorageURI == ""
}

// IsGlobalSort returns true if we sort data on global storage.
func (p *Plan) IsGlobalSort() bool {
	return !p.IsLocalSort()
}

// non CSV format should not specify CSV only options, we check it again if the
// format is detected automatically.
func (p *Plan) checkNonCSVFormatOptions() error {
	for k := range csvOnlyOptions {
		if _, ok := p.specifiedOptions[k]; ok {
			return exeerrors.ErrLoadDataUnsupportedOption.FastGenByArgs(k, "non-CSV format")
		}
	}
	return nil
}

// CreateColAssignExprs creates the column assignment expressions using session context.
// RewriteAstExpr will write ast node in place(due to xxNode.Accept), but it doesn't change node content,
// so we sync it.
func (e *LoadDataController) CreateColAssignExprs(planCtx planctx.PlanContext) (
	_ []expression.Expression,
	_ []contextutil.SQLWarn,
	retErr error,
) {
	e.colAssignMu.Lock()
	defer e.colAssignMu.Unlock()
	res := make([]expression.Expression, 0, len(e.ColumnAssignments))
	allWarnings := []contextutil.SQLWarn{}
	for _, assign := range e.ColumnAssignments {
		newExpr, err := plannerutil.RewriteAstExprWithPlanCtx(planCtx, assign.Expr, nil, nil, false)
		// col assign expr warnings is static, we should generate it for each row processed.
		// so we save it and clear it here.
		allWarnings = append(allWarnings, planCtx.GetSessionVars().StmtCtx.GetWarnings()...)
		planCtx.GetSessionVars().StmtCtx.SetWarnings(nil)
		if err != nil {
			return nil, nil, err
		}
		res = append(res, newExpr)
	}
	return res, allWarnings, nil
}

// CreateColAssignSimpleExprs creates the column assignment expressions using `expression.BuildContext`.