How to retrieve the column having datatype as “list” from the table of Cassandra?

前端 未结 2 1144
天涯浪人
天涯浪人 2021-01-18 21:49

I am using Scala to connect with Cassandra and applying my queries in it, I have created a simple table in Cassandra which has two columns row_id and row_values. row_id has

相关标签:
2条回答
  • 2021-01-18 21:59

    Try to add class to getList method:

    row.getList("row_values", classOf[String])
    
    0 讨论(0)
  • 2021-01-18 22:05

    Quick elaboration: You specify the java class. e.g.,

    val driverDerivedRow = MyRow(row.getString("s"), 
        row.getInt("i"), 
        row.getList("l", classOf[java.lang.Long])
        .asScala.toList.map(Long.unbox)
    
    0 讨论(0)
提交回复
热议问题