Java 中对多文件关联计算
【问题】
Hello I want to use 10 Csv files in my Java Program. Are there any options to build relations between the individual Csv files ? For example if I have a csv file with postal codes and another one with postal code and Names of the cities how can I connect these two ? And what are packages/classes I can work with csv in Java ? Thanks for your answers !
【回答】
多文件关联计算可以用集算器辅助实现,脚本简单易懂,SPL 如下:
A |
|
1 |
=file("D:/sOrder.csv").import@ct(OrderID,SellerId,Amount) |
2 |
=file("D:/emp.csv").import@ct(Eid,Name) |
3 |
>A1.switch(SellerId,A2:Eid) |
4 |
=A1.new(OrderID,SellerId.Eid,SellerId.Name,Amount) |
A1:读取订单信息
A2:读取雇员信息
A3:将 A1 中的 SellerId 切换为指引字段
A4:按关联记录获取最终结果
集算器不仅可以进行关联计算,还可以通过 JDBC 与 JAVA 集成,参考《Java 如何调用 SPL 脚本》。