aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorgatorsmile <gatorsmile@gmail.com>2016-05-04 18:47:27 -0700
committerYin Huai <yhuai@databricks.com>2016-05-04 18:47:27 -0700
commitef55e46c9225ddceebeaf19398519cbe651c1728 (patch)
treeac9e67ee7b122ba41468e3ca3fa1455cd44d389d /core
parent8fb1463d6a832f187f323d97635e5bec1e93c6f3 (diff)
downloadspark-ef55e46c9225ddceebeaf19398519cbe651c1728.tar.gz
spark-ef55e46c9225ddceebeaf19398519cbe651c1728.tar.bz2
spark-ef55e46c9225ddceebeaf19398519cbe651c1728.zip
[SPARK-14993][SQL] Fix Partition Discovery Inconsistency when Input is a Path to Parquet File
#### What changes were proposed in this pull request? When we load a dataset, if we set the path to ```/path/a=1```, we will not take `a` as the partitioning column. However, if we set the path to ```/path/a=1/file.parquet```, we take `a` as the partitioning column and it shows up in the schema. This PR is to fix the behavior inconsistency issue. The base path contains a set of paths that are considered as the base dirs of the input datasets. The partitioning discovery logic will make sure it will stop when it reaches any base path. By default, the paths of the dataset provided by users will be base paths. Below are three typical cases, **Case 1**```sqlContext.read.parquet("/path/something=true/")```: the base path will be `/path/something=true/`, and the returned DataFrame will not contain a column of `something`. **Case 2**```sqlContext.read.parquet("/path/something=true/a.parquet")```: the base path will be still `/path/something=true/`, and the returned DataFrame will also not contain a column of `something`. **Case 3**```sqlContext.read.parquet("/path/")```: the base path will be `/path/`, and the returned DataFrame will have the column of `something`. Users also can override the basePath by setting `basePath` in the options to pass the new base path to the data source. For example, ```sqlContext.read.option("basePath", "/path/").parquet("/path/something=true/")```, and the returned DataFrame will have the column of `something`. The related PRs: - https://github.com/apache/spark/pull/9651 - https://github.com/apache/spark/pull/10211 #### How was this patch tested? Added a couple of test cases Author: gatorsmile <gatorsmile@gmail.com> Author: xiaoli <lixiao1983@gmail.com> Author: Xiao Li <xiaoli@Xiaos-MacBook-Pro.local> Closes #12828 from gatorsmile/readPartitionedTable.
Diffstat (limited to 'core')
0 files changed, 0 insertions, 0 deletions