Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create BufferedCsvReader to Handle Large CSV Files #29487

Open
Tracked by #29482
fabrizzio-dotCMS opened this issue Aug 7, 2024 · 0 comments
Open
Tracked by #29482

Create BufferedCsvReader to Handle Large CSV Files #29487

fabrizzio-dotCMS opened this issue Aug 7, 2024 · 0 comments

Comments

@fabrizzio-dotCMS
Copy link
Contributor

fabrizzio-dotCMS commented Aug 7, 2024

Parent Issue

#29482

Task

As a developer, I need to create a new version of the CsvReader component with improved memory management. It can be called BufferedCsvReader
This new component should be able to read a specified number of rows at a time and indicate if there are more rows to read, preventing the entire file from being loaded into memory at once. Consider creating an interface to swap implementations so the new component can seamlessly replace the old one

Consider that the actual CvsReader is created using this code:

Reader reader = new InputStreamReader(new ByteArrayInputStream(bytes),Charset.forName("UTF-8")); 

Consider replacing it with this:

// Save the incoming file into a temp location then.. 
String filePath = "path/to/your/large/file.txt";
int bufferSize = 8192; 
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(filePath), Charset.forName("UTF-8")), bufferSize)) {
            String line;
            while ((line = reader.readLine()) != null) {
                // Process each line as it is read
                System.out.println(line);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }

Proposed Objective

Core Features

Proposed Priority

Priority 2 - Important

Acceptance Criteria

  1. BufferedCsvReader: Implement a new BufferedCsvReader component that can read a specified number of rows from a CSV file at a time.
  2. Memory Efficiency: Verify that the component does not load the entire file into memory.

External Links... Slack Conversations, Support Tickets, Figma Designs, etc.

No response

Assumptions & Initiation Needs

No response

Quality Assurance Notes & Workarounds

No response

Sub-Tasks & Estimates

No response

@fabrizzio-dotCMS fabrizzio-dotCMS changed the title Create PaginatedCsvReader to Handle Large CSV Files Create BufferedCsvReader to Handle Large CSV Files Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: New
Development

No branches or pull requests

1 participant