Skip to content

Instantly share code, notes, and snippets.

@1ambda
Created January 8, 2022 02:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 1ambda/3fc7bf406e3f5c753614961c3e37d82c to your computer and use it in GitHub Desktop.
Save 1ambda/3fc7bf406e3f5c753614961c3e37d82c to your computer and use it in GitHub Desktop.
spark
.read // 데이터를 읽어옵니다.
.format("jdbc") // "jdbc" 뿐 아니라 "kafka" 등 다양한 Format 을 사용할 수 있습니다
.join(...) // 다른 데이터와 Join (병합) 합니다.
.where(...) // 데이터 Row 필터링하거나
.selectExpr(...) // 필요한 Column 만 선택합니다.
repartition(5, "col1") // 얼마나 / 어떤 기준으로 분산해 처리할지를 정의합니다
.groupBy(...) // 집계 연산을 수행합니다
.agg(...)
repartition(...) // 얼마나 / 어떤 기준으로 분산해 저장할지를 정의합니다.
.write
.format("kafka") // 데이터를 Parquet Format
.option(...) // 원하는 옵션을 주어
.save(...) // 저장합니다.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment