Coder Social home page Coder Social logo

index out of range error about pgfutter HOT 8 OPEN

JonasRSV avatar JonasRSV commented on September 15, 2024 7
index out of range error

from pgfutter.

Comments (8)

fei0x avatar fei0x commented on September 15, 2024 4

Are you guys still looking for a fix? I can help!

Yes, still seeing this, thank you!

In linux, for some reason, for some files, you need to have windows style line breaks for it to work.

My file had no issues on csvLint except the line-break warning.

You can use the unix2dos command to convert the file first, then it worked for me.

from pgfutter.

ryuvsken avatar ryuvsken commented on September 15, 2024 2

change to this code
https://github.com/lukasmartinelli/pgfutter/blob/master/csv.go#L100

		for i, col := range record {
			cols[i] = strings.Replace(col, "\x00", "", -1)
			// bytes.Trim(b, "\x00")
			// cols[i] = col
		}

to

		for idx, col := range record {
			cols[idx] = strings.Replace(col, "\x00", "", -1)
			// bytes.Trim(b, "\x00")
			// cols[i] = col
		}

from pgfutter.

raginjason avatar raginjason commented on September 15, 2024

What version of pgfutter? I ask because I had a similar panic on v1.2, but when I built from source it ran fine. There have been a few fixes since v1.2 that may have addressed your issue.

from pgfutter.

melcha avatar melcha commented on September 15, 2024

I got the same error with a 4MB file, version v1.2.

The problem was that the CSV file was malformed, a few rows had extra columns. I discovered this by validating the CSV file here https://csvlint.io/, the output was very helpful.

Screenshot 2020-08-05 at 13 45 34

from pgfutter.

shmsr avatar shmsr commented on September 15, 2024

Are you guys still looking for a fix? I can help!

from pgfutter.

wisefool769 avatar wisefool769 commented on September 15, 2024

Are you guys still looking for a fix? I can help!

Yes, still seeing this, thank you!

from pgfutter.

waynegraham avatar waynegraham commented on September 15, 2024

Can confirm that running my CSV that was having the index out of range issue through unix2dos resolved this for macOS.

from pgfutter.

raindog308 avatar raindog308 commented on September 15, 2024

Thank you@waynegraham

Can also confirm that running unix2dos on 18GB of tab-delimited files fixed this issue on Linux 👍

This issue isn't 100% consistent. Some files worked as-is (with Unix line breaks), some did not. After running unix2dos on all, they all worked.

from pgfutter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.