Comments (6)
I agree that all the methods in DataSet
should be compatible and work fine with empty DataSet.
The root cause for above issue mostly is in N.newEmptyDataSet(columnNames)
, not in DataSet
The implementation for newEmptyDataSet
looks like:
new RowDataSet(new ArrayList<>(columnNames), new ArrayList<List<Object>>());
This is wrong. it should be:
final List<List<Object>> columnList = new ArrayList<>(columnNames.size());
for (int i = 0, size = columnNames.size(); i < size; i++) {
columnList.add(new ArrayList<>(0));
}
return new RowDataSet(new ArrayList<String>(columnNames), columnList);
I will fix this issue in next release and add validation in DataSet to make sure sizes of column name list and column list are same.
I tested the join
with empty DataSet
not created by N.newEmptyDataSet
. it works fine.
final DataSet dataSet1 = N.newDataSet(N.asLinkedHashMap("ACCT_ID", N.asList("1", "2"), "ACCT_NM", N.asList(11, 12)));
final DataSet dataSet2 = N.newDataSet(N.asList("ACCT_ID_1", "ACCT_NM_1"), N.asList(N.asList("id1", "nm1")));
dataSet2.println();
dataSet2.clear();
dataSet2.println();
dataSet2.updateColumn("ACCT_ID_1", Fn.<String, Long> f(Long::valueOf));
dataSet1.innerJoin(dataSet2, N.asMap("ACCT_ID", "ACCT_ID_1")).println();
dataSet1.fullJoin(dataSet2, N.asMap("ACCT_ID", "ACCT_ID_1")).println();
please let me know if you have different use case/test scenarios for this issue.
from abacusutil.
Yah, you are right, this issue is occurring in case of creating dataSet using N.newEmptyDataSet.
else things works fine. will wait for the new release :)
Happy coding
can you please brief list of few useful classes/interfaces in abacus -> like i saw you used Fn that too has some good functions.
from abacusutil.
@landawn when I can get version 1.7.8 on maven ?
from abacusutil.
@infinite-sahil It's available now.
And as you may or will know, There are couple of alternatives for (Try.Function<String, Object, RuntimeException>) Long::valueOf
, :
-
cast by com.landawn.abacus.util.function.Function:
(Function<String, Object>) Long::valueOf
-
use:
(String val) -> Long.valueOf(val)
-
Fn.<String, Long> f(Long::valueOf)
-
use or add new utility method. for example:
Fn.parseLong()
, which just added in 1.7.8 release.
from abacusutil.
By the way, if you're interested in Functional Programming, you could have a look at the section Functional Programming
in this project main page
from abacusutil.
Thank you @landawn .
I verified it and its working perfectly fine.
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
- 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.