May. 21st, 2015
total idiocy
May. 21st, 2015 12:08 pmno time to investigate right now
In short, a map has 7 entries, but at some moment it returns a list of just 6 entries; results depends god knows from what.
val meta = conn.createStatement().executeQuery(s"select * from $table limit 1").getMetaData
val allNames = 1 to meta.getColumnCount map (i => meta.getColumnName(i) ->(meta.getColumnType(i), meta.getColumnDisplaySize(i))) toMap
val filteredContent: TraversableOnce[String Map String] = content map (_.filterKeys(allNames.keySet.contains))
def dataHasColumn(name: String) = {
filteredContent.forall(_.contains(name))
}
val goodNames = allNames.filterKeys(dataHasColumn)
val gnset = goodNames.toSet
val nt2 = goodNames.toList // TODO(vlad): investigate this horrible bug (patient_sec is the table)
val namesAndTypes: List[(String, (Int, Int))] = gnset.toList
if (nt2.length > namesAndTypes.length) nt2 else namesAndTypes
In short, a map has 7 entries, but at some moment it returns a list of just 6 entries; results depends god knows from what.