scala2.11知识总结 1

来源:互联网 发布:数据化管理pdf下载 编辑:程序博客网 时间:2024/06/05 00:12
object _22 {  def main(args: Array[String]): Unit = {    val _22 = new Tuple22(1, 2, 3, 4, 5, 6, 7, 8, 9, 10      , 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22)    print(_22)//    Error:(19, 16) Implementation restriction: case classes cannot have more than 22 parameters.//    case class Tuple23(i1: Int, i2: Int, i3: Int, i4: Int, i5: Int, i6: Int, i7: Int, i8: Int, i9: Int, i10: Int, i11: Int, i12: Int, i13: Int, i14: Int, i15: Int, i16: Int, i17: Int, i18: Int, i19: Int, i20: Int, i21: Int, i22: Int, i23: Int) {    case class Tuple23(i1: Int, i2: Int, i3: Int, i4: Int, i5: Int, i6: Int, i7: Int, i8: Int, i9: Int, i10: Int, i11: Int, i12: Int, i13: Int, i14: Int, i15: Int, i16: Int, i17: Int, i18: Int, i19: Int, i20: Int, i21: Int, i22: Int, i23: Int) {    }    val _23 = new Tuple23(1, 2, 3, 4, 5, 6, 7, 8, 9, 10      , 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23)    print(_23)  }}
如上程序在scala2.10.4下会报错,因为版本原因,scala限制对象的属性最多为22个,也可自定义对象 extends Product23 
在scala2.11 中貌似取消了1~22的限定 现在spark可以直接重数据库中读取大于22列的数据了,做下笔记!!
 
原创粉丝点击