@@ -541,10 +541,9 @@ func (ip *IngestProcessor) shouldAlterColumns(table *chLib.Table, attrsMap map[s
541541func (ip * IngestProcessor ) GenerateIngestContent (table * chLib.Table ,
542542 data types.JSON ,
543543 inValidJson types.JSON ,
544- config * chLib.ChTableConfig ,
545544 encodings map [schema.FieldEncodingKey ]schema.EncodedFieldName ) ([]string , types.JSON , []NonSchemaField , error ) {
546545
547- if len (config .Attributes ) == 0 {
546+ if len (table . Config .Attributes ) == 0 {
548547 return nil , data , nil , nil
549548 }
550549
@@ -555,10 +554,10 @@ func (ip *IngestProcessor) GenerateIngestContent(table *chLib.Table,
555554 }
556555
557556 // check attributes precondition
558- if len (config .Attributes ) <= 0 {
557+ if len (table . Config .Attributes ) <= 0 {
559558 return nil , nil , nil , fmt .Errorf ("no attributes config, but received non-schema fields: %s" , mDiff )
560559 }
561- attrsMap , _ := BuildAttrsMap (mDiff , config )
560+ attrsMap , _ := BuildAttrsMap (mDiff , table . Config )
562561
563562 // generateNewColumns is called on original attributes map
564563 // before adding invalid fields to it
@@ -708,7 +707,6 @@ func (ip *IngestProcessor) processInsertQuery(ctx context.Context,
708707 if table == nil {
709708 return nil , fmt .Errorf ("table %s not found" , tableName )
710709 }
711- tableConfig = table .Config
712710 var jsonsReadyForInsertion []string
713711 var alterCmd []string
714712 var validatedJsons []types.JSON
@@ -719,7 +717,7 @@ func (ip *IngestProcessor) processInsertQuery(ctx context.Context,
719717 }
720718 for i , preprocessedJson := range validatedJsons {
721719 alter , onlySchemaFields , nonSchemaFields , err := ip .GenerateIngestContent (table , preprocessedJson ,
722- invalidJsons [i ], tableConfig , encodings )
720+ invalidJsons [i ], encodings )
723721
724722 if err != nil {
725723 return nil , fmt .Errorf ("error BuildInsertJson, tablename: '%s' : %v" , table .Name , err )
0 commit comments