Comments (7)
It's a bug. The root cause is the JSONParserImpl class isn't initialized successfully due to the cycling dependence between it and class N. It's fixed in version 1.0.5. please download the new version and let me know if you have further questions.
Thank you for reporting the issue and I hope you will enjoy using the library.
from abacusutil.
Hi there
Thank you for the respond and fix, but found the new error is thrown as below. At least it is not the same so i can see i will be able to use your software soon :-)
Oct 29, 2017 12:15:06 PM com.landawn.abacus.logging.JDKLogger log
INFO: Initialized with JDK Logger
Exception in thread "main" java.lang.ArrayStoreException: java.util.ArrayList
at com.landawn.abacus.parser.JSONParserImpl.readArray(Unknown Source)
at com.landawn.abacus.parser.JSONParserImpl.readString(Unknown Source)
at com.landawn.abacus.parser.JSONParserImpl.readString(Unknown Source)
at com.landawn.abacus.parser.AbstractJSONParser.readString(Unknown Source)
at com.landawn.abacus.util.CSVUtil.loadCSV(CSVUtil.java:195)
at com.landawn.abacus.util.CSVUtil.loadCSV(CSVUtil.java:134)
at com.landawn.abacus.util.CSVUtil.loadCSV(CSVUtil.java:100)
at com.landawn.abacus.util.CSVUtil.loadCSV(CSVUtil.java:80)
at com.landawn.abacus.util.CSVUtil.loadCSV(CSVUtil.java:76)
at com.landawn.abacus.util.CSVUtil.loadCSV(CSVUtil.java:72)
at util.ActIDActNameSrcIpTime.TestAbacus.main(TestAbacus.java:20)
from abacusutil.
Could you please show me your test code and couple of lines of the sample CSV file? so i can find out the root cause?
from abacusutil.
from abacusutil.
Thanks! i didn't find the attached CSV file you used for test for some reason. Can you please check it for me or upload it again if it's missed?
from abacusutil.
from abacusutil.
I still didn't see the attached CSV file you used for test. but anyway, if you want to continue to give it a try. Here are my suggestions:
If the column values in the CSV files are quoted with "
or '
except type: number
or boolean
. For example 001.csv
:
first_name, last_name, number
"tom", "cruise", 1
"tom", "hanks", 2
The simplest way to load it to DataSet
is:
File csv001 = new File("./001.csv");
DataSet ds001 = CSVUtil.loadCSV(csv001);
ds001.println();
If the column values in the CSV file are not quoted with with "
or '
for some reason. For example:
first_name, last_name, number
tom, cruise, 1
tom, hanks, 2
You can try Apache Commons CSV
try (CSVParser csvParser = CSVParser.parse(csv001, Charsets.UTF_8, CSVFormat.DEFAULT)) {
DataSet ds002 = Stream.of(csvParser.iterator()).map(e -> Iterators.toList(e.iterator()))
.headAndTail().map((h, t) -> t.toDataSet(h.get()));
ds002.println();
}
Or you can also manually parse the CSV file(This could be the fastest way):
String delimiter = ", "; // which could be ',', Tab spaces or any string used to delimit the values in the CSV.
DataSet ds003 = Stream.of(csv001)
.call(s -> s.map(e -> N.splitPreserveAllTokens(e, delimiter))
.headAndTail().map((h, t) -> t.toDataSet(Arrays.asList(h.get()))));
ds003.println();
// or:
try (LineIterator iter = IOUtil.iterate(csv001)) {
ds003 = Stream.of(iter)
.map(e -> N.splitPreserveAllTokens(e, delimiter))
.headAndTail().map((h, t) -> t.toDataSet(Arrays.asList(h.get())));
}
from abacusutil.
Related Issues (20)
- Dataset - Column names should be case insensitive HOT 3
- DataSet - serialize/deserialize HOT 2
- Empty dataset with column headers HOT 3
- Can we have better commit messages ? HOT 1
- Software License Issue: Says Apache contains "GPL2 with classpath exception" HOT 2
- Sql Server is not working with JdbcUtil HOT 3
- IN clause value in SQLExecutor HOT 3
- SQLExecutor IN clause support HOT 1
- Grouping on the basis of one column in dataset and then sorting HOT 5
- Question: JSON to DataSet conversion HOT 4
- IndexOutOfBoundsException comes in case of empty dataset HOT 6
- Question: thoughts behind this api HOT 2
- Question/Issue: Batch insert HOT 5
- SQLExecutor: with in clause accepting list of values HOT 13
- Batch inserts are extremely slow HOT 3
- Postgres SQL cast syntax confuses Abacus SQLExecutor HOT 2
- test attached HOT 1
- Fulljoin usage example HOT 8
- SQLExecutor - Named parameter support HOT 3
- SQLExecutor - WITH clause or CTE support HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from abacusutil.