본문 바로가기

Data Engineering

(8)
[Hive] ALTER TABLE PARTITION SET LOCATION 이 안되는 현상 Hive는 메타스토어상 테이블의 location을 바꾼다고 해서 테이블에 속한 partition의 location까지 바뀌진 않는다. 그래서 location을 수동으로 바꿔주거나 cascade 옵션을 줘서 변경해야한다. partition의 location을 바꾸려면 아래와 같은 명령어를 사용해야한다. ALTER TABLE [db_name].[table_name] PARTITION ([partition]=[value]) SET LOCATION [new_location] 그런데 이런 에러가 뜨면서 실패했다. FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. Unable to alter partition. al..
hadoop distcp에서 queue 지정하기 hadoop distcp -Dmapred.job.queue.name=
vim-scala plugin vim-scala 플러그인이 계속 적용이 안돼서 검색하다보니 vim8로 업그레이드하면 된다는 글을 발견해서 해결. https://github.com/derekwyatt/vim-scala/issues/75 Can't get it work with Vundle · Issue #75 · derekwyatt/vim-scala Hi, This is probably some silly mistake that I am making, but I'm trying to install the plugin with Vundle: https://github.com/katcipis/my.vim/blob/master/vimrc#L73 And no magic happens :-(. I ... github.com
가변 파라미터(variable arguments)를 받는 메소드 스칼라로 가변적인 개수의 파라미터를 받는 메소드 만들기 & 사용하기 메소드를 선언할 때는 파라미터 타입 뒤에 * 문자를 붙인다. scala> def printAll(args: String*) = args.foreach(println) scala> printAll("hello") hello scala> printAll("hello", "world", "!") hello world ! 메소드를 사용할 때는 위의 예시처럼 하나하나 직접 넘겨도 되지만 보통 List, Array와 같은 Iterable 타입의 변수를 넘긴다. 하지만 그냥 Iterable을 넘기면 컴파일 에러가 난다. scala> val l = List("hello", "world") scala> printAll(l) :28: error: type..
Dataframe에 새로운 칼럼 추가하기 Dataframe에 새로운 칼럼 추가하기 withColumn 메서드를 사용한다. // def withColumn(colName: String,col: org.apache.spark.sql.Column): org.apache.spark.sql.DataFrame val df = List((1, 2),(4, 8)).toDF("col1", "col2") +----+----+ |col1|col2| +----+----+ | 1| 2| | 4| 8| +----+----+ // 1. 특정 값으로 채워진 칼럼 추가 // literal 함수를 사용한다. literal은 프로그래밍 언어의 리터럴 값을 스파크가 이해할 수 있는 값으로 변화한다. // org.apche.spark.sql.functions.lit df.withC..
Akka를 알아보자 Akka Actor 는 message passing을 통해 커뮤니케이션하는 entity다. - 당연하지만, 액터모델에서 message는 first-class citizen 이다. - Event-driven model: asynchronous 하게 메세지를 전달하기 때문에 스레드를 블락하지 않아도 된다. - Akka Actor 는 state와 behavior을 가진다. Akka Props을 사용해서 configuration을 명시한다. ActorSystem.actorOf (or ActorContext) 메소드에 Props[원하는_액터_클래스]를 전달해서 액터를 생성한다. Akka Actor에 Asynchronously 하게 메세지를 전달하는 방법으로는 tell과 ask가 있다. Tell Patern act..
HDFS Architecture Guide HDFS(Hadoop Distributed File System): distributed file system to run on commodity hardware. 1. Assumptions & Goals - In case of some server failures, data can still be accessed. - Should be able to work with various Hadoop Ecosystem Applications, some having streaming features - High Throughput of data - Can read/write large datasets, in TB 2. Blocks - A file replicated by replication factors an..
Presto SQL에서 유용하게 쓸만한 쿼리들 partition 조회하기 SELECT * FROM catalog.schema."table$partitions" 여기서 특정 조건에 맞는 파티션만 보고싶으면 WHERE 절에 명시해주면 된다.