code: def gen_row_based_json_file(
      row_file,
      str_pk,
      data_fields,
      float_vect,
      rows,
      dim,
      start_uid=0,
      err_type="",
      enable_dynamic_field=False,
      **kwargs,
  ):
      if err_type == DataErrorType.str_on_int_pk:
          str_pk = True
      if err_type in [
          DataErrorType.one_entity_wrong_dim,
          DataErrorType.str_on_vector_field,
      ]:
          wrong_dim = dim + 8  # add 8 to compatible with binary vectors
          wrong_row = kwargs.get("wrong_position", start_uid)
  
      with open(row_file, "w") as f:
          f.write("{")
          f.write("\n")
          f.write('"rows":[')
          f.write("\n")
          for i in range(rows):
              if i > 0:
                  f.write(",")
                  f.write("\n")
  
              # scalar fields
              f.write("{")
              for j in range(len(data_fields)):
                  data_field = data_fields[j]
                  if data_field == DataField.pk_field:
                      if str_pk:
                          line = '"uid":"' + str(gen_unique_str()) + '"'
                          f.write(line)
                          # f.write('"uid":"' + str(gen_unique_str()) + '"')
                      else:
                          if err_type == DataErrorType.float_on_int_pk:
                              f.write(
                                  '"uid":'
                                  + str(i + start_uid + random.random())
                                  + ""
                              )
                          else:
                              f.write(
                                  '"uid":' + str(i + start_uid) + ""
                              )
                  if data_field == DataField.int_field:
                      if DataField.pk_field in data_fields:
                          # if not auto_id, use the same value as pk to check the query results later
                          f.write(
                              '"int_scalar":' + str(i + start_uid) + ""
                          )
                      else:
                          line = (
                              '"int_scalar":'
                              + str(random.randint(-999999, 9999999))
                              + ""
                          )
                          f.write(line)
                  if data_field == DataField.float_field:
                      if err_type == DataErrorType.int_on_float_scalar:
                          f.write(
                              '"float_scalar":'
                              + str(random.randint(-999999, 9999999))
                              + ""
                          )
                      elif (
                          err_type == DataErrorType.str_on_float_scalar
                      ):
                          f.write(
                              '"float_scalar":"'
                              + str(gen_unique_str())
                              + '"'
                          )
                      else:
                          line = (
                              '"float_scalar":'
                              + str(random.random())
                              + ""
                          )
                          f.write(line)
                  if data_field == DataField.double_field:
                      if err_type == DataErrorType.int_on_float_scalar:
                          f.write(
                              '"double_scalar":'
                              + str(random.randint(-999999, 9999999))
                              + ""
                          )
                      elif (
                          err_type == DataErrorType.str_on_float_scalar
                      ):
                          f.write(
                              '"double_scalar":"'
                              + str(gen_unique_str())
                              + '"'
                          )
                      else:
                          line = (
                              '"double_scalar":'
                              + str(random.random())
                              + ""
                          )
                          f.write(line)
                  if data_field == DataField.string_field:
                      f.write(
                          '"string_scalar":"'
                          + str(gen_unique_str())
                          + '"'
                      )
                  if data_field == DataField.bool_field:
                      if err_type == DataErrorType.typo_on_bool:
                          f.write(
                              '"bool_scalar":'
                              + str(
                                  random.choice(
                                      [
                                          "True",
                                          "False",
                                          "TRUE",
                                          "FALSE",
                                          "0",
                                          "1",
                                      ]
                                  )
                              )
                              + ""
                          )
                      else:
                          f.write(
                              '"bool_scalar":'
                              + str(random.choice(["true", "false"]))
                              + ""
                          )
                  if data_field == DataField.json_field:
                      data = {
                          gen_unique_str(): random.randint(
                              -999999, 9999999
                          ),
                      }
                      f.write('"json":' + json.dumps(data) + "")
                  if data_field == DataField.array_bool_field:
                      if err_type == DataErrorType.empty_array_field:
                          f.write('"array_bool":[]')
                      elif (
                          err_type
                          == DataErrorType.mismatch_type_array_field
                      ):
                          f.write('"array_bool": "mistype"')
                      else:
                          f.write(
                              '"array_bool":['
                              + str(random.choice(["true", "false"]))
                              + ","
                              + str(random.choice(["true", "false"]))
                              + "]"
                          )
                  if data_field == DataField.array_int_field:
                      if err_type == DataErrorType.empty_array_field:
                          f.write('"array_int":[]')
                      elif (
                          err_type
                          == DataErrorType.mismatch_type_array_field
                      ):
                          f.write('"array_int": "mistype"')
                      else:
                          f.write(
                              '"array_int":['
                              + str(random.randint(-999999, 9999999))
                              + ","
                              + str(random.randint(-999999, 9999999))
                              + "]"
                          )
                  if data_field == DataField.array_float_field:
                      if err_type == DataErrorType.empty_array_field:
                          f.write('"array_float":[]')
                      elif (
                          err_type
                          == DataErrorType.mismatch_type_array_field
                      ):
                          f.write('"array_float": "mistype"')
                      else:
                          f.write(
                              '"array_float":['
                              + str(random.random())
                              + ","
                              + str(random.random())
                              + "]"
                          )
                  if data_field == DataField.array_string_field:
                      if err_type == DataErrorType.empty_array_field:
                          f.write('"array_string":[]')
                      elif (
                          err_type
                          == DataErrorType.mismatch_type_array_field
                      ):
                          f.write('"array_string": "mistype"')
                      else:
                          f.write(
                              '"array_string":["'
                              + str(gen_unique_str())
                              + '","'
                              + str(gen_unique_str())
                              + '"]'
                          )
  
                  if data_field == DataField.vec_field:
                      # vector field
                      if (
                          err_type == DataErrorType.one_entity_wrong_dim
                          and i == wrong_row
                      ):
                          vectors = (
                              gen_float_vectors(1, wrong_dim)
                              if float_vect
                              else gen_binary_vectors(
                                  1, (wrong_dim // 8)
                              )
                          )
                      elif (
                          err_type == DataErrorType.str_on_vector_field
                          and i == wrong_row
                      ):
                          vectors = (
                              gen_str_invalid_vectors(1, dim)
                              if float_vect
                              else gen_str_invalid_vectors(1, dim // 8)
                          )
                      else:
                          vectors = (
                              gen_float_vectors(1, dim)
                              if float_vect
                              else gen_binary_vectors(1, (dim // 8))
                          )
                      line = (
                          '"vectors":'
                          + ",".join(
                              str(x).replace("'", '"') for x in vectors
                          )
                          + ""
                      )
                      f.write(line)
                  # not write common for the last field
                  if j != len(data_fields) - 1:
                      f.write(",")
              if enable_dynamic_field:
                  d = {
                      str(i + start_uid): i + start_uid,
                      "name": fake.name(),
                      "address": fake.address(),
                  }
                  d_str = json.dumps(d)
                  d_str = d_str[1:-1]  # remove {}
                  f.write("," + d_str)
              f.write("}")
          f.write("\n")
          f.write("]")
          f.write("\n")
          f.write("}")
          f.write("\n")
  
imports: import copy
  import json
  import os
  import time
  import numpy
  import pandas
  import random
  from faker import Faker
  from sklearn import preprocessing
  from common.common_func import gen_unique_str
  from common.minio_comm import copy_files_to_minio
  from utils.util_log import test_log
label_desc: Use image node_id 6 for calling a global function with example usage: gen_row_based_json_file(row_file, str_pk, data_fields, float_vect, rows, dim, start_uid, err_type, enable_dynamic_field) without return types