比较CSV中的列与JAVA中数据库表中的列

比较CSV中的列与JAVA中数据库表中的列,java,csv,compare,database-table,Java,Csv,Compare,Database Table,我有一个有44列的CSV和一个有21列的表。需要检查CSV中的列以及和数据库表中的列和数据匹配的数据 我已经创建了2个带有main的class-one,我在其中读取了CSV文件并将值存储在键值对中。 我有另一个类,我在其中执行select查询以获得结果。 现在,我被困在如何根据列及其数据比较这两件事上了 预期:csv中包含数据的列数不应与数据库表中的列数匹配 //MAIN类-其中CSV被读取并存储在key=value对中 public static void main(String[] arg

我有一个有44列的CSV和一个有21列的表。需要检查CSV中的列以及和数据库表中的列和数据匹配的数据

我已经创建了2个带有main的class-one,我在其中读取了CSV文件并将值存储在键值对中。 我有另一个类,我在其中执行select查询以获得结果。 现在,我被困在如何根据列及其数据比较这两件事上了

预期:csv中包含数据的列数不应与数据库表中的列数匹配

//MAIN类-其中CSV被读取并存储在key=value对中

 public static void main(String[] args) throws JSchException {
      CassandraConnection c=new CassandraConnection();
    Session session = null;
       try {
             session = jsch.getSession(user, host, port);
         } catch (JSchException e) {
                // TODO Auto-generated catch block
           e.printStackTrace();
         }
       //Session to connect with FTP//
       InputStream stream = null;
       try {
           stream = sftpChannel.get("file path");
           System.out.println("File read");
       } catch (SftpException e1) {
                // TODO Auto-generated catch block
               e1.printStackTrace();
       }
       try {
           BufferedReader br = new BufferedReader(new            
            InputStreamReader(stream));
            Iterable<CSVRecord> records = 
            CSVFormat.DEFAULT.withFirstRecordAsHeader()                                                                        
             .withIgnoreEmptyLines(true).withDelimiter(',').withTrim()                                                                      
             .parse(br);
             System.out.println("Printing records having COLUMN 4 > 0");
             java.util.List<Map<String, String>> finResult = 
             StreamSupport.stream(records.spliterator(), 
             false).filter(csvRecord -> 
             Integer.parseInt(csvRecord.get("COLUMN 4"))>0).map(csvRecord 
             -> 
         csvRecord.toMap().entrySet().stream().collect(Collectors.toMap(e 
         -> e.getKey(),e -> e.getValue()))).collect(Collectors.toList());
         size = finResult.size();
         System.out.println(size);
         for (Map<String, String> map : finResult) {
         System.out.println(finResult);
    }
    br.close();
 }             
 catch (IOException io) {
  System.out.println("Exception occurred during reading file from SFTP 
  server due to " + io.getMessage());
  io.getMessage();
} catch (Exception e) {
System.out.println("Exception occurred during reading file from SFTP 
server due to " + e.getMessage());
e.getMessage(); }}}

公共类CassandraConnection{public int CassandraConn{/*String cqlStatement=select*from table COLUMN 4>0,date=currentdate;对于行:session.executeqlstatement{System.out.printlnrow.toString;}/*com.datastax.driver.core.ResultSet result=session.executeselect*from table COLUMN 4>0和date=currentdate;int numberofu rows\u Source=result.all.size;System.out.println Casandra暂存表中的行数为:+numberofu rows\u Source;return numberofu rows\u Source;}}公共类CassandraConnection{public int CassandraConn{/*String cqlStatement=select*自表列4>0且日期=currentdate;对于行:session.executeqlstatement{System.out.printlnrow.toString;}/*com.datastax.driver.core.ResultSet result=session.executeselect*from table COLUMN 4>0和date=currentdate;int numberofu rows\u Source=result.all.size;System.out.println Casandra暂存表中的行数为:+numberofu rows\u Source;返回numberofu rows\u Source;}