way for developing distributed analytics platform with Apache Spark) ~Apache Spark導入時のメイン言語の選定のはなし~ (Talk about selecting main language in Apache Spark)
processing Big-Data in memory at high speed with distributed environment. ▪ Scala製で、JVM上で動作する Implemented by Scala and Run on Java Vertual Machine. ▪ CSVなどの構造データはもちろん、テキストなどの非構造データも扱える Dealing Not only Structured Data (ex. CSV), but also Non-Structured Data (ex. Text) ▪ 使用可能な言語はScala, Python, Java, R等 Write applications in Scala, Python(2 or 3), Java, R and more. ▪ Scala, Pythonはインタラクティブシェルが用意されている Provided Interactive Shell for Scala and Python. ▪ PySparkとはApache Spark のPython向けAPI PySpark Is Apache Spark API for Python. ▪ Python2のEOL(2020/1/1)以降のリリースで、Python2のサポート打ち切り Python2 support will be dropped in a future release after Python2 EOL (2020/01/01).
collapsed if use Python Standard Logging package. ⇒ Spark付属のLog4Jを使うようにする(コードは右参照) Use Log4J bundled in Apache Spark. (Code is shown in the right) ▪ カラム名に浮動小数点を含むと何故かDataFrameでの集計時にエラーで落ちる Summary process fails because of irregular column name (ex. includes float number.) ⇒ 集計前に、Temp_N(N=0,1,2,..) などの無難なカラム名にリネームしておく。 Rename irregular column name before summary process. ▪ 膨大な数のカラム(10,000カラム程度)に対するDataFrameのリネーム処理がハングアウトする。 Hung out Renaming Huge Amount of columns (ex. 10k columns) in DataFrame. ⇒ DataFrame生成前に、元データのファイルのカラム文字列を直接編集でリネームしておく。 Edit Directory Column Strings in Data Source File before create DataFrame. conf = SparkConf().setAppName(“Summary”) sc = SparkContext(conf=conf) log4j_logger = sc._jvm.org.apache.log4j logging = log4j_logger.LogManager.getLogger(__name__) logging.info(“Start Summarize Process”) PySparkにおけるLog4Jによるログ出力コード Code for logging in PySpark using Log4J.