apache / doris-spark-connector

Spark Connector for Apache Doris
https://doris.apache.org/
Apache License 2.0
74 stars 90 forks source link

[fix] Fix data duplication issue when retrying #201

Closed gnehil closed 2 months ago

gnehil commented 2 months ago

Proposed changes

Issue Number: close #xxx

Problem Summary:

After loading retry is enabled, the batch needs to be cached by adding the next object of the iterator to the ArrayBuffer. Since the memory of the next object is reused, objects with the same memory address are added to the array multiple times. , so when retrying to traverse the buffer, all the objects read are the last objects obtained by the iterator. Fix: copy the next object of the iterator and save the copy in the buffer.

Checklist(Required)

  1. Does it affect the original behavior: (Yes/No/I Don't know)
  2. Has unit tests been added: (Yes/No/No Need)
  3. Has document been added or modified: (Yes/No/No Need)
  4. Does it need to update dependencies: (Yes/No)
  5. Are there any changes that cannot be rolled back: (Yes/No)

Further comments

If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...