1. 1Š Cloudera, Inc. All rights reserved.
Apache Arrow and Python in
context
Wes McKinney @wesmckinn
Data Science Summit 2016-07-12
2. 2Š Cloudera, Inc. All rights reserved.
Me
⢠Data Science Tools at Cloudera
⢠Creator of pandas
⢠Wrote Python for Data Analysis 2012 (2nd ed coming 2017)
⢠Open source projects
⢠Python {pandas, Ibis, statsmodels}
⢠Apache {Arrow, Parquet, Kudu (incubating)}
⢠Mostly work in Python and Cython/C/C++
3. 3Š Cloudera, Inc. All rights reserved.
WrangleConf - July 28 in San Francisco
http://wrangleconf.com
Storytelling from real-world data science
work (and BBQ, of course)
4. 4Š Cloudera, Inc. All rights reserved.
Python + Big Data: The State of things
⢠See âPython and Apache Hadoop: A State of the Unionâ from February 17
⢠Areas where much more work needed
⢠Binary file format read/write support (e.g. Parquet files)
⢠File system libraries (HDFS, S3, etc.)
⢠Client drivers (Spark, Hive, Impala, Kudu)
⢠Compute system integration (Spark, Impala, etc.)
5. 5Š Cloudera, Inc. All rights reserved.
Apache
Arrow
Many slides here from my joint talk with Jacques Nadeau, VP Apache Arrow
6. 6Š Cloudera, Inc. All rights reserved.
Arrow in a Slide
⢠New Top-level Apache Software Foundation project
⢠Announced Feb 17, 2016
⢠Focused on Columnar In-Memory Analytics
1. 10-100x speedup on many workloads
2. Common data layer enables companies to choose best of
breed systems
3. Designed to work with any programming language
4. Support for both relational and complex data as-is
⢠Developers from 13+ major open source projects involved
Calcite
Cassandra
Deeplearning4j
Drill
Hadoop
HBase
Ibis
Impala
Kudu
Pandas
Parquet
Phoenix
Spark
Storm
R
7. 7Š Cloudera, Inc. All rights reserved.
High Performance Sharing & Interchange
Today With Arrow
⢠Each system has its own internal
memory format
⢠70-80% CPU wasted on serialization
and deserialization
⢠Similar functionality implemented in
multiple projects
⢠All systems utilize the same memory
format
⢠No overhead for cross-system
communication
⢠Projects can share functionality (eg,
Parquet-to-Arrow reader)
8. 8Š Cloudera, Inc. All rights reserved.
Apache Arrow: What is it?
⢠http://arrow.apache.org
⢠Specification matters more than Implementation
⢠A standardized in-memory representation for columnar data
⢠Enables
⢠Suitable for implementing high-performance analytics in-memory (think like
âpandas internalsâ)
⢠Cheap data interchange amongst systems, little or no serialization
⢠Flexible support for complex JSON-like data
⢠Targets: Impala, Kudu, Parquet, Spark
9. 9Š Cloudera, Inc. All rights reserved.
Focus on CPU Efficiency
Traditional
Memory Buffer
Arrow
Memory Buffer
â˘Cache Locality
â˘Super-scalar & vectorized
operation
â˘Minimal Structure Overhead
â˘Constant value access
⢠With minimal structure overhead
â˘Operate directly on columnar
compressed data
10. 10Š Cloudera, Inc. All rights reserved.
Example: Feather File Format for Python and R
â˘Problem: fast, language-
agnostic binary data frame
file format
â˘Written by Wes McKinney
(Python) Hadley Wickham (R)
â˘Read speeds close to disk IO
performance
11. 11Š Cloudera, Inc. All rights reserved.
Real World Example: Feather File Format for Python
and R
library(feather)
path <- "my_data.feather"
write_feather(df, path)
df <- read_feather(path)
import feather
path = 'my_data.feather'
feather.write_dataframe(df, path)
df = feather.read_dataframe(path)
R Python
12. 12Š Cloudera, Inc. All rights reserved.
In progress: Parquet on HDFS for pandas users
pandas
pyarrow
libarrow libarrow_io
Parquet files in
HDFS / filesystems
Arrow-Parquet
adapter
Native libhdfs, other
filesystem interfaces
C++ libraries
Python + C
extensions
Data structures
parquet-cpp
Raw filesystem
interface
Python wrapper
classes
13. 13Š Cloudera, Inc. All rights reserved.
Language Bindings
⢠Target Languages
⢠Java (beta)
⢠CPP (underway)
⢠Python & Pandas (underway)
⢠R
⢠Julia
⢠Initial Focus
⢠Read a structure
⢠Write a structure
⢠Manage Memory
14. 14Š Cloudera, Inc. All rights reserved.
RPC & IPC: Moving Data Between Systems
RPC
⢠Avoid Serialization & Deserialization
⢠Layer TBD: Focused on supporting vectored io
⢠Scatter/gather reads/writes against socket
IPC
⢠Alpha implementation using memory mapped files
⢠Moving data between Python and Drill
⢠Working on shared allocation approach
⢠Shared reference counting and well-defined ownership semantics
15. 15Š Cloudera, Inc. All rights reserved.
Executing data science languages in the compute layer
16. 16Š Cloudera, Inc. All rights reserved.
Real World Example: Python With Spark, Drill, Impala
17. 17Š Cloudera, Inc. All rights reserved.
Whatâs on the horizon
⢠Parquet for Python & C++
⢠Using Arrow as intermediary
⢠IPC Implementation + Java/C++ interop
⢠Spark, Drill Integration
⢠Faster UDFs, Storage interfaces
18. 18Š Cloudera, Inc. All rights reserved.
Get Involved
⢠Join the community
⢠dev@arrow.apache.org
⢠Slack: https://apachearrowslackin.herokuapp.com/
⢠http://arrow.apache.org
⢠@ApacheArrow
19. 19Š Cloudera, Inc. All rights reserved.
Thank you
Wes McKinney @wesmckinn
Views are my own