Skip to content

antony@notes:~/data-platform$ cat "Apache-Spark.md"

Apache Spark

2023-02-19· data-platform ·資料科技平台

Apache Spark

:::spoiler 目錄 ( 點我可展開 )

[TOC]

:::


Spark 簡介

在 2014 年的資料排序基準競賽(Sort Benchmark Competition)中,Databricks 公司使用 Spark,在 207 台的叢集中,以 23 分鐘完成 100 TB 的資料排序,刷新了2013年由 Yahoo 創下的記錄 (在2,100台的叢集中使用MapReduce,花費了72分鐘完成)。

Spark 在資料處理速度上贏過MapReduce是因為他使用了「記憶體內運算技術」(In-Memory Computing)這項技術,現在的硬碟換裝成SSD之後,在速度上就不會差距那麼大,但可能還是差了兩三倍。


Spark 原創公司 - Databricks

  • 如同 Hadoop 的主導公司 Cloudera 一樣,專案內容開源,但花心思進行完整包裝成產品
  • Spark 是由 Databricks 所創立的,也是開源專案,也擁有自己的產品

    Spark的官網

spark 相關書籍:


Spark is Not a Programming Language

One thing to remember is that Spark is not a programming language like Python or Java. It is a general-purpose distributed data processing engine, suitable for use in a wide range of circumstances. It is particularly useful for big data processing both at scale and with high speed.


系統架構

  • RDD,資料處理引擎
    • 這顆引擎可以由 Spark Standalone 執行(Spark 內建),執行方式是 FIFO(First in First out),第一個程式執行完,第二個程式才能執行,Java 語言寫的,效能表現差
    • 這顆引擎的第二個選擇,Hadoop YARN,他的執行策略是 Fair(公平),也就是說會盡量平均分配運算資源,Java語言寫的,朋友最多; JVM 裡 heap 區的記憶體使用量,沒辦法做到要多少給多少。
    • 最後一個選擇,Mesos,他會用 thread 的方法,來執行 RDD 資料處理引擎,他全部用 C 語言寫的,代表運算速度快,資源運作的浪費率降的很低,但朋友較少,無法配合 pig 和 hive

資料處理引擎要運作必須寫程式進去,要執行時才會啟動,執行完畢才會關閉。

  • Spark SQL,第一個應用,將傳統 IT 的資料丟到 RDD 資料處理引擎,再丟到 hdfs 檔案系統,這時候 pig 與 hive 就可以上來就行分析
  • Streaming,處理資料串流( 高速、中速和慢速 ),物聯網的資料
  • MLlib,Machine learning ,推薦系統(其中一種應用)
  • GraphX,處理關係,系統面的最佳路徑,router a 跑到 router b 的最快路徑,物件與物件之間的關係

PySpark 設定檔

bigred@dta1:~/vmusdt$ cat /opt/spark-3.2.1-bin-hadoop3.2/conf/spark-defaults.conf
spark.master                    yarn      ## spark 用 yarn 來 run
spark.yarn.am.memory            512M      ## 相當於 mrappmaster
spark.executor.memory           512m      ## 真正在處理我們資料的 program,相當於 map 或 reduce,代表資料處理就是它在做
spark.driver.memory             512m      ## 內定會在 a1 機器上執行,將 spark 分析完的資料,輸出在 a1 的螢幕上,如果最後分析完的結果太大,可以把這個項目丟到後端的 hdfs 分散式檔案系統中處理。
spark.yarn.submit.waitAppCompletion false ## false ,可以不用等命令分析完,才能操作終端機

#Turns on logging for applications submitted from this machine
## Spark 運行的 log 檔儲存在 HDFS 檔案系統中的 /tmp/spark-events
spark.eventLog.enabled          true
## 指令執行回傳錯誤 log 放這個檔案裡
spark.eventLog.dir              hdfs://dtm1:8020/tmp/spark-events
## 指令執行回傳沒有錯誤 log 放這個檔案裡
spark.history.fs.logDirectory   hdfs://dtm1:8020/tmp/spark-events

這個設定檔來自~/vmusdt/hdp33/conf/spark-3.2.1-bin-hadoop3.2/,如有修改 spark-defult.xml ,改完後一樣要 dtconf 33 去分發

$ hdfs dfs -ls /tmp
Found 3 items
drwxrwxrwx   - bigred bigboss          0 2022-05-12 14:54 /tmp/hadoop-yarn
drwx-wx-wx   - bigred bigboss          0 2022-05-13 01:17 /tmp/hive
drwxrwxrwx   - bigred bigboss          0 2022-05-13 01:13 /tmp/spark-events

指定 pyspark 使用那個 python 版本

$ cat /opt/spark-3.2.1-bin-hadoop3.2/conf/spark-env.sh
export SPARK_LOG_DIR=/tmp 
## PYSPARK 要用的 Python 程式所在的目錄
export PYSPARK_PYTHON=/usr/bin/python3
## 這裡的 DRIVER 跟 spark.driver.memory 指的是相同的程式
export PYSPARK_DRIVER_PYTHON=/usr/bin/python3

啟動 pyspark

$ pyspark  --master yarn  --num-executors 1 --executor-memory 512m

:::spoiler output ( 點我 ) :

Python 3.8.10 (default, Mar 15 2022, 12:22:08)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
Setting default log level to "WARN".
To adjust logging level use sc.setLogLevel(newLevel). For SparkR, use setLogLevel(newLevel).
Welcome to
      ____              __
     / __/__  ___ _____/ /__
    _\ \/ _ \/ _ `/ __/  '_/
   /__ / .__/\_,_/_/ /_/\_\   version 3.2.1
      /_/

Using Python version 3.8.10 (default, Mar 15 2022 12:22:08)
Spark context Web UI available at http://dta1:4040
Spark context available as 'sc' (master = yarn, app id = application_1652367294907_0018).
SparkSession available as 'spark'.
>>>

:::

--master yarn--executor-memory 512m這兩個參數其實可以不用打,因為~/vmusdt/hdp33/conf/spark-3.2.1-bin-hadoop3.2/裡面有宣告過,如果命令與預設不一樣,以命令為主 --num-executors 1 ,不管資料量有多大,就是一支程式來跑 --executor-memory 512m ,一支程式最大用 512 m 記憶體,必須落在 YARN 的運算資源內

開另一個CMD,用bigred登入dta1

bigred@dta1:~$ who
bigred   tty1         2022-05-12 14:43
bigred   pts/0        2022-05-13 01:09 (120.96.143.13)
bigred   pts/1        2022-05-13 05:45 (120.96.143.13)
gbean    pts/2        2022-05-12 15:11 (120.96.143.13)

bigred@dta1:~$ hls
[dtm1]
3257 NameNode
3482 SecondaryNameNode

[dtm2]
3637 JobHistoryServer
3485 ResourceManager

[dtw1]
3104 DataNode
168976 ExecutorLauncher   ## 相當於 mrappmaster,用來啟動
3947 NodeManager

[dtw2]
3649 NodeManager
2890 DataNode

[dtw3]
## Executor 苦命人,因為上面有宣告Executor的數量:1
## CoarseGrained,代表會浪費一定的硬體資源,因 yarn 用的是 JVM ,heap 區要求的是一口價
170641 YarnCoarseGrainedExecutorBackend   
3780 NodeManager
3006 DataNode

==如果不給–num-executors 1,系統預設兩個==

到對應使用者的 ~/.bashrc 追加 alias 給予不同的運算資源配置

gbean@dta1:~$ nano .bashrc
...
alias pyspark='pyspark --num-executors 4 --executor-memory 512m'
...

登出再登入
gbean@dta1:~$ pyspark
Python 3.8.10 (default, Mar 15 2022, 12:22:08)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
Setting default log level to "WARN".
To adjust logging level use sc.setLogLevel(newLevel). For SparkR, use setLogLevel(newLevel).
Welcome to
      ____              __
     / __/__  ___ _____/ /__
    _\ \/ _ \/ _ `/ __/  '_/
   /__ / .__/\_,_/_/ /_/\_\   version 3.2.1
      /_/

Using Python version 3.8.10 (default, Mar 15 2022 12:22:08)
Spark context Web UI available at http://dta1:4040
Spark context available as 'sc' (master = yarn, app id = application_1652367294907_0022).
SparkSession available as 'spark'.
>>>

回到 bigred,下 hls 看有幾支 YarnCoarseGrainedExecutorBackend

bigred@dta1:~$ hls
[dtm1]
3257 NameNode
3482 SecondaryNameNode

[dtm2]
3637 JobHistoryServer
3485 ResourceManager

[dtw1]
181426 YarnCoarseGrainedExecutorBackend
3104 DataNode
3947 NodeManager

[dtw2]
3649 NodeManager
2890 DataNode
181544 YarnCoarseGrainedExecutorBackend

[dtw3]
183523 YarnCoarseGrainedExecutorBackend
183446 ExecutorLauncher
3780 NodeManager
183557 YarnCoarseGrainedExecutorBackend
3006 DataNode

pyspark 交談模式 - Pi Estimation

# Spark 的路口,宣告後面的程式會用 YARN 來 run
>>> print(sc)
<SparkContext master=yarn appName=PySparkShell>

一般測試時才會使用,在外面做案子較常使用交付模式

將以下程式段, 複製到 pyspark 交談模式

from random import *

def sample(p):
   x, y = random(), random()
   return 1 if x*x + y*y < 1 else 0

count = sc.parallelize(range(0,100000000)).map(sample).reduce(lambda a, b: a + b)

print ("Pi is roughly",(4.0 * count / 100000000))



Pi is roughly 3.14146024

>>> quit()
  • count = sc.parallelize(range(0,100000000)).map(sample).reduce(lambda a, b: a + b) ,這段程式會在 YarnCoarseGrainedExecutorBackend 跑
  • sc.parallelize,spark 的 function,負責產生 100000 筆資料

以交付模式執行 Python 應用程式 

$ echo $'from pyspark import SparkConf
from pyspark import SparkContext

# 宣告等等的程式由YARN做執行
conf = SparkConf()
conf.setAppName(\'spark-basic\')
sc = SparkContext(conf=conf)        ## sc代表python的物件變數,全名是SparkContext,
                                       Context中文為“路口”,
                                       意即Spark資料在處理的路口(YARN)

# 由YarnCoarseGrainedExecutorBackend執行
# 從 0-1,000 取十個值,除與二求餘數,並將前10個運算結果
# 開頭sc代表,等等後台的YARN在執行時,會幫我們產生1000筆資料(數字),經過mod取餘數,
  最後取出前10個運算結果
# print 印出最後的結果
def mod(x):
    import numpy as np
    return (x, np.mod(x, 2))

rdd = sc.parallelize(range(1000)).map(mod).take(10)
print (rdd)' > spark-basic.py


[註] 上式的 $ 會將 \' 轉換成  '


$ spark-submit  --master yarn  --driver-memory  512m   --executor-memory  512m  spark-basic.py 2>/dev/null
ModuleNotFoundError: No module named 'numpy'

補充:numpy 重點觀念:每一種語言環境安裝好以後,不代表可以使用全部功能,部分功能需要額外安裝套件才能使用

$ ssh dta1 'sudo apt install python3-numpy'
$ ssh dtw1 'sudo apt install python3-numpy'
$ ssh dtw2 'sudo apt install python3-numpy'
$ ssh dtw3 'sudo apt install python3-numpy'

rbean@dta1:~$ spark-submit  --master yarn  --driver-memory  512m   --executor-memory  512m  spark-basic.py
[(0, 0), (1, 1), (2, 0), (3, 1), (4, 0), (5, 1), (6, 0), (7, 1), (8, 0), (9, 1)]

Spark on YARN 客戶端佈署模式

Client Machine是在我們的dta1,當我們在client端下達指令(spark-submit)時,會有一個程式叫driver,他會一直在前端的機器跑,還會去找Resource Manager,然後Resource Manager馬上去找Application Master,完了後,會管理後端的Executor做管理和分析,Executor會把執行完的結果,透過網路傳給driver,讓driver顯示出來。


Spark Excution Model

  • Cluster Manager | Resource Manager
  • 我們可以設定一個 Executor 使用多少個 CPU ,Executor 會請多個 Task 幫我們對 Partition (資料區塊) 做處理
  • Executor 可以請多少個 Task 做事,由資源限制上做決定
  • Task 也可以做資源上的限制

檢視 YARN 運作資訊

在 rbean 終端機執行以下命令

## 把rnage改成20000,take改成20
rbean@dta1:~$ nano spark-basic.py

from pyspark import SparkConf
from pyspark import SparkContext

conf = SparkConf()
conf.setAppName('spark-basic')
sc = SparkContext(conf=conf)

def mod(x):
    import numpy as np
    return (x, np.mod(x, 2))

rdd = sc.parallelize(range(20000)).map(mod).take(20)
print (rdd)

在 bigred 終端機執行以下命令

bigred@dta1:~$ which hls
/opt/bin/hls

## 讓hls也抓得到dta1的主機
bigred@dta1:~$ sudo nano /opt/bin/hls
#!/bin/bash

nn="dtm1"
rs="dtm2"
w=$(cat /etc/hosts | grep -e ' dtw[0-9]' | cut -d' ' -f2)

nc -w 1 -z $nn 8020 &>/dev/null
[ "$?" != 0 ] && echo "pls start HDFS first or fomathdfs" && exit 1

for n in $nn $rs $w dta1     ## 新增dta1
do
   nc -w 1 -z $n 22 &>/dev/null
   if [ "$?" == "0" ]; then
      j=$(ssh -q bigred@$n sudo jps 2>/dev/null | grep -v Jps)
      if [ "$j" != "" ]; then
         echo -e "[$n]\n$j"
         echo ""
      fi
   fi
done

在 rbean 終端機執行以下命令

rbean@dta1:~$ spark-submit  --master yarn  --driver-memory  512m   --executor-memory  512m  spark-basic.py 2>/dev/null
[(0, 0), (1, 1), (2, 0), (3, 1), (4, 0), (5, 1), (6, 0), (7, 1), (8, 0), (9, 1), (10, 0), (11, 1), (12, 0), (13, 1), (14, 0), (15, 1), (16, 0), (17, 1), (18, 0), (19, 1)]

在 bigred 終端機執行以下命令

bigred@dta1:~$ hls
[dtm1]
159402 SecondaryNameNode
159037 NameNode

[dtm2]
1828 ResourceManager
1966 JobHistoryServer

[dtw1]
159299 NodeManager
159094 DataNode
164372 ExecutorLauncher   ## (就是 ApplicationMaster)
164538 YarnCoarseGrainedExecutorBackend

[dtw2]
7973 YarnCoarseGrainedExecutorBackend
1943 DataNode
2152 NodeManager

[dtw3]
2067 NodeManager
1861 DataNode

[dta1]
162115 SparkSubmit    ## (內含 Driver)

Spark on YARN 叢集佈署模式

把pyspark要執行的程式都往後台丟,所以我的Spark-submit的命令往後送

  1. YARN 是由 dtm2、dtw1、dtw2、dtw3 所組成
  2. 其中 resource manager 是在 dtm2 上執行 其餘程式會在 dtw1、2、3 上面執行

傳統的大型主機系統會使用的運作架構

實作cluster mode

將spark.yarn.submit.waitAppCompletion改成false,如果以後要等待就改成true

bigred@dta1:~$ nano vmusdt/hdp33/conf/spark-3.2.1-bin-hadoop3.2/spark-defaults.conf
spark.master                    yarn
spark.yarn.am.memory            512M
spark.executor.memory           512m
spark.driver.memory             512m
spark.yarn.submit.waitAppCompletion false

#Turns on logging for applications submitted from this machine
spark.eventLog.enabled          true
spark.eventLog.dir              hdfs://dtm1:8020/tmp/spark-events
spark.history.fs.logDirectory   hdfs://dtm1:8020/tmp/spark-events

如果原本是true,就要重新部署設定檔

bigred@dta1:~$ dtconf 33

上載資料集

## 下載老師的網站裡的talks.txt檔
bigred@dta1:~$ wget "http://www.oc99.org/dt/dataset/talks.txt" &>/dev/null

## 檢查
bigred@dta1:~$ dir talks.txt
-rw-rw-r-- 1 bigred bigred 1.6M Apr  2  2015 talks.txt

bigred@dta1:~$ cat talks.txt | head -n 10
The Project Gutenberg EBook of Ulysses, by James Joyce

This eBook is for the use of anyone anywhere at no cost and with
almost no restrictions whatsoever.  You may copy it, give it away or
re-use it under the terms of the Project Gutenberg License included
with this eBook or online at www.gutenberg.org


Title: Ulysses

## 將talks.txt 上傳到hdfs檔案系統中
bigred@dta1:~$ hdfs dfs -put -f talks.txt mydataset/

## 檢查
bigred@dta1:~$ hdfs dfs -ls mydataset
Found 1 items
-rw-r--r--   2 bigred bigboss    1573044 2022-05-16 02:43 mydataset/talks.txt

撰寫 wordcount.py 程式

bigred@dta1:~$ nano wordcount.py
from pyspark import SparkConf, SparkContext

conf = SparkConf()
conf.setAppName('wordcount')
sc = SparkContext(conf=conf)  ## 指到YARN的RDD資料處理引擎

## textFile 指定要讀取的檔案,檔案會被丟到 excutor 所在的機器
## flatMap 將每個字用空格做切割,相當於linux的cut,(Map程式會做擷取和過濾)
words = sc.textFile("/user/bigred/mydataset/talks.txt").flatMap(lambda line: line.split(" "))

# count the occurrence of each word
## 只要出現一個字就會就會在字後面寫, 1
## reduce程式會將同樣的字後面出現幾個1,把它加總起來
wordCounts = words.map(lambda word: (word, 1)).reduceByKey(lambda a,b:a+b)

## 最後的結果回存在/user/bigred/mydataset/wordcount的目錄裡面
## 如果將wordcount改成wordcount.txt,系統也會把它當作目錄的名字
wordCounts.saveAsTextFile("/user/bigred/mydataset/wordcount")

==資料科技平台,只要講資料處理引擎,最後的結果會存在一個資料夾裡面==


使用叢集佈署模式, 執行 wordcount.py

只要動用到cluster mode,通常都會把結果儲存到Hdfs檔案系統中

bigred@dta1:~$ spark-submit --deploy-mode cluster wordcount.py

bigred@dta1:~$ yarn application -list
WARNING: YARN_LOG_DIR has been replaced by HADOOP_LOG_DIR. Using value of YARN_LOG_DIR.
Total number of applications (application-types: [], states: [SUBMITTED, ACCEPTED, RUNNING] and tags: []):1
                Application-Id      Application-Name        Application-Type          User           Queue                   State         Final-State             Progress                        Tracking-URL
application_1652665976731_0011          wordcount.py                   SPARK        bigred      root.bigred                RUNNING           UNDEFINED                  10%                   http://dtw3:33687

## pig的cat可以把目錄裡面的所有檔案內容都顯示出來
bigred@dta1:~$ pig -e "cat mydataset/wordcount" 2>/dev/null | head -n 4
("Doyle's", 3)
('cockles', 5)
('periwinkles.', 1)
('Then', 130)

RDD Partition

運作架構

client 在dta1 ,執行的命令叫做spark-submit

cluster Manager就是resource manager

系統預設兩個Excutor,每個Excuter最多可以用多少記憶體和多少CPU? 遵照 yarn-site.xml 配置,最多 1CPU/896MB 記憶體

Excuter的數量由我們決定,每個Excuter裡面可以執行多個Task,一個 Block 會由一個 task 來處理,一個Task要用一個Core,有幾個Task就會需要幾個Core。

我們目前的配置,每個 Executor 只會跑一個 task 因為上限是 1 CPU

更改上限2cpu

bigred@dta1:~$ nano vmusdt/hdp33/conf/hadoop-3.3.2/yarn-site.xml
    <name>yarn.scheduler.minimum-allocation-vcores</name>
    <value>1</value>
  </property>
  <property>
    <name>yarn.scheduler.maximum-allocation-vcores</name>
    <value>2</value>     ## 天花板改成2
  </property>
  
bigred@dta1:~$ stopyarn ; stophdfs
dtw1: Node Manager stoped
dtw2: Node Manager stoped
dtw3: Node Manager stoped
dtm2: Job History Server stoped
dtm2: Resource Manager stoped
dtw1: Data Node stoped
dtw2: Data Node stoped
dtw3: Data Node stoped
dtm1: Secondary Name Node stoped
dtm1: Name Node stoped

bigred@dta1:~$ dtconf 33

bigred@dta1:~$ starthdfs ; startyarn

檢測 YARN 運算單元的記憶體資源

未更改cpu上限為2,就叫系統跑兩個Task的話,系統會罵你 系統會需要我們要的1024mb + 384mb的記憶體

bigred@dta1:~$ spark-submit --master yarn  --executor-memory  1024m /opt/spark-3.2.1-bin-hadoop3.2/examples/src/main/python/pi.py 10
java.lang.IllegalArgumentException: Required executor memory (1024 MB), offHeap memory (0) MB, overhead (384 MB), and PySpark memory (0 MB) is above the max threshold (896 MB) of this cluster!

指定 Executor 數量及 Executor Memory 大小

系統規定Excuter的記憶體大小最少要有為450mb

bigred@dta1:~$ spark-submit --num-executors 1 --executor-memory 384m --master yarn /opt/spark-3.2.1-bin-hadoop3.2/examples/src/main/python/pi.py 10
Error initializing SparkContext.
java.lang.IllegalArgumentException: Executor memory 402653184 must be at least 471859200. Please increase executor memory using the --executor-memory option or spark.executor.memory in Spark configuration.

再次執行 pi.py

使用系統預設Excuter的記憶體大小 spark-defaults.conf使用的是預設的512MB,加上YARN設置的底線384MB

bigred@dta1:~$ spark-submit --num-executors 1  /opt/spark-3.2.1-bin-hadoop3.2/examples/src/main/python/pi.py 500
Pi is roughly 3.135280

CPU 硬體規格

邏輯處理器:8,代表是硬體規格,超執行緒 Hyper-Threading : 8 只要是Java的程式,軟體上有啟動thread,在硬體上就會去飆超執行緒

VMware 在核心上使用的是Core還是HT?


我們在實體電腦上的CPU硬體規格為4C 8HT,當我們建立3台虛擬機它的cpu設定為2C時,除了3台加起來用了6C以外,還有剩的是作業系統的服務會需要用到一整顆CPU。

我們將3台虛擬機器設定為2顆cpu,事實上真正在系統裡面,他無法用到2顆核心的所有時間,因為還有一大堆的服務在使用,所以要讓我們的虛擬電腦在使用CPU上接近兩顆,代表作業系統裡面的服務越少越好。


YARN的單一台機器CPU總量設為8核,每一支程式只能跑1核,YARN在一台機器會跑8個程式出來,每個程式會去分虛擬機器設定的2核的時間,虛擬機器設定的2核又會去分實體機器那顆CPU的時間,代表YARN所分到的時間會很少,這時候就要看CPU的規格,如果夠強,就可以在同樣的時間跑處理更多的運算。

3台虛擬機器分時8個HT,不見得會完整使用到其中的6個HT,要看程式怎麼寫。

Spark的一個Executor設定CPU上限兩核,代表在一台虛擬機器可以同時跑4個Executor,

  • 提問:Executor總共可以處理的資料量有多大?

    答:設定一支程式可以使用 2CPU(代表每隻 Executor 可以跑兩個 task) 一台虛擬機一次跑四隻 Executor 等於有八隻 task(使用到 yarn CPU 配置的上限) 三台都跑滿等於有 24 隻 task,同時處理 24 筆資料 假設資料量皆為最大值:128MB * 24 = 3072MB 等於同時可以處理 3GB 的資料量 但還需要考量配置的程式數量,有沒有影響單支程式的性能


設定CPU為以下圖的規格

bigred@dta1:~$ nano vmusdt/hdp33/conf/hadoop-3.3.2/yarn-site.xml
    <name>yarn.nodemanager.resource.cpu-vcores</name>
    <value>4</value>
  </property>
    <name>yarn.scheduler.minimum-allocation-vcores</name>
    <value>1</value>
  </property>
  <property>
    <name>yarn.scheduler.maximum-allocation-vcores</name>
    <value>2</value>
  </property>



bigred@dta1:~$ stopyarn

bigred@dta1:~$ dtconf 33

bigred@dta1:~$ startyarn
dtm2: Resource Manager started
dtm2: Job History Server started
dtw1: Node Manager started
dtw2: Node Manager started
dtw3: Node Manager started

bigred@dta1:~$ curl -s http://dtm2:8088/ws/v1/cluster/metrics | jq | grep -E "totalMB|totalVirtualCores"
    "totalMB": 24576,
    "totalVirtualCores": 12,

pyspark --num-executors 1 --executor-cores 2
Python 3.8.10 (default, Mar 15 2022, 12:22:08)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
Setting default log level to "WARN".
To adjust logging level use sc.setLogLevel(newLevel). For SparkR, use setLogLevel(newLevel).
Welcome to
      ____              __
     / __/__  ___ _____/ /__
    _\ \/ _ \/ _ `/ __/  '_/
   /__ / .__/\_,_/_/ /_/\_\   version 3.2.1
      /_/

Using Python version 3.8.10 (default, Mar 15 2022 12:22:08)
Spark context Web UI available at http://dta1:4040
Spark context available as 'sc' (master = yarn, app id = application_1652682234623_0001).
SparkSession available as 'spark'.
>>>
tags: 資料科技平台