摘要: 1、scala的主构造器和辅助构造器,scale可以有多个辅助的构造器,但是只能有一个主构造器 package com.itstar.scala.test/** * 定义学生类并且使用了主构造器 * Scala里面只有一个主构造器,可以有多个辅助构造器 * @param stuName * @par 阅读全文
posted @ 2019-11-08 22:54 newtest00 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 1、scala的嵌套类也成为内部类 package com.itstar.scala.testimport scala.collection.mutable.ArrayBufferclass Student2 { private var stuName:String = "Tom" private 阅读全文
posted @ 2019-11-08 22:29 newtest00 阅读(278) 评论(0) 推荐(0) 编辑
摘要: 1、类的定义方法 package com.itstar.scala.testclass Student1 { private var stuId:Int = 0 private var stuName:String = "Jack" private var stuAge:Int = 22 priva 阅读全文
posted @ 2019-11-08 22:00 newtest00 阅读(1098) 评论(0) 推荐(0) 编辑
摘要: 1、读取本地文本文件 1.1、通过mkString方法读取文件 package com.itstar.scala.testimport scala.io.Source._object day110801 { def main(args: Array[String]): Unit = { val rf 阅读全文
posted @ 2019-11-08 21:26 newtest00 阅读(635) 评论(0) 推荐(0) 编辑
摘要: 1、定义Map 1.1、定义不可变的Map也就是immutable scala> val m = Map("Tom" -> 55,"Jak" -> 56,"Jim" -> 66)m: scala.collection.immutable.Map[String,Int] = Map(Tom -> 55 阅读全文
posted @ 2019-11-08 20:55 newtest00 阅读(2369) 评论(0) 推荐(0) 编辑
摘要: 1、tuple元组,里面可以包含各种类型的元素 scala> val t = Tuple3(1,2.03,"Tom")t: (Int, Double, String) = (1,2.03,Tom) //这种定义方式需要提前固定元素的个数,有点麻烦 scala> val t = (1,2.03,"To 阅读全文
posted @ 2019-11-08 20:08 newtest00 阅读(243) 评论(0) 推荐(0) 编辑
摘要: 1、定长数组Array scala> val a = new Array[Int](10)a: Array[Int] = Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Int类型的数组的默认值是0 scala> val a = new Array[String](10)a: 阅读全文
posted @ 2019-11-08 19:52 newtest00 阅读(587) 评论(0) 推荐(0) 编辑
摘要: 1、在MySQL中新建表stu,插入一些数据 2、将MySQL表的stu中的数据导入到hive中 [root@bigdata113 ~]# sqoop import --connect jdbc:mysql://bigdata113:3306/mysqlhdfs --username root -- 阅读全文
posted @ 2019-10-06 14:39 newtest00 阅读(1496) 评论(0) 推荐(0) 编辑
摘要: 1、在MySQL中创建表student 2、在MySQL中创建表student4 3、在hive中创建表student3 hive (default)> create table student3(id int,name string,sex string) > row format delimit 阅读全文
posted @ 2019-10-05 17:18 newtest00 阅读(338) 评论(0) 推荐(0) 编辑
摘要: 1、创建一张普通表加载数据 hive (default)> create table person(id int,name string,location string) > row format delimited fields terminated by '\t';OKTime taken: 0 阅读全文
posted @ 2019-10-04 12:24 newtest00 阅读(1216) 评论(0) 推荐(0) 编辑