일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- SQL
- django
- Excel
- numpy
- array
- Kotlin
- Python
- hive
- google apps script
- string
- PostgreSQL
- PANDAS
- GIT
- matplotlib
- Github
- 파이썬
- math
- Redshift
- gas
- Google Excel
- dataframe
- list
- Google Spreadsheet
- Tkinter
- Mac
- Java
- c#
- Apache
- PySpark
- Today
- Total
목록hive (43)
달나라 노트
Hive에서 table에 있는 column 등 table의 정보를 보고 싶으면 show create table을 이용하면 됩니다. Syntaxshow create table schema.table; show create table schema.table;-- ResultCREATE TABLE `test_schema.test_table` ( `id` bigint, `name` string, `price` bigint)ROQ FORMAT SERDE 'org.apache.hadoop.hive.ql.io.orc.OrcSerde'SRORED AS INPUTFORMAT 'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat'OUTPUTFORMA..
데이터를 다루다 보면 전체에 대한 백분위를 구할 때가 있습니다. 이럴 때에는 percentile이라는 유용한 함수를 사용할 수 있습니다. Syntax percentile(column, percent) - column 백분위를 구할 데이터가 있는 대상 column - percent 상위 몇%를 의미 Table = test_table col1 col2 a 1 a 2 a 3 b 1 b 6 b 7 c 1 c 2 d 2 d 2 d 4 d 1 위같은 table이 있다고 가정합시다. select col1 , percentile(col2, 0.5) as result_col from test_table -- group by col1 ; col1 result_col a 2 b 6 c 1.5 d 2 쿼리와 결과입니다. 결과..
split 함수는 특정 문자를 구분자로 하여 문자열을 나눠줍니다. Syntax split(text, delimiter) - text 구분자를 기준으로 나눌 대상 text - delimiter 구분자 select split('1234_5678_9101', '_') as list_split , split('1234_5678_9101', '_')[0] as split_element_0 , split('1234_5678_9101', '_')[1] as split_element_1 , split('1234_5678_9101', '_')[2] as split_element_2 ; -- Result ["1234", "5678", "9101"] 1234 5678 9101 - split('1234_5678_9101', ..
Hive에서 concat() 함수는 여러 문자열을 하나로 이어주는 역할을 합니다. Syntax concat(str1, str2, str3, ...) concat() 함수는 여러 개의 parameter를 받을 수 있습니다. 그리고 string type parameter를 모두 연결해서 str1str2str3... 의 string을 return합니다. select concat('abcde, '_', '@', 'xyz', '123', '%') ; -- Result abcde_@xyz% 위처럼 모든 문자열을 연결해줍니다. select concat('_', cast(123 as string), 'abc') ; -- Result _123abc concat() 함수에 들어가는 모든 parameter는 string t..