Github user liancheng commented on a diff in the pull request:
https://github.com/apache/spark/pull/3269#discussion_r20587290
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/parquet/newParquet.scala ---
@@ -0,0 +1,291 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.spark.sql.parquet
+
+import java.util.{List => JList}
+
+import org.apache.hadoop.fs.{FileStatus, FileSystem, Path}
+import org.apache.hadoop.conf.{Configurable, Configuration}
+import org.apache.hadoop.io.Writable
+import org.apache.hadoop.mapreduce.{JobContext, InputSplit, Job}
+
+import parquet.hadoop.ParquetInputFormat
+import parquet.hadoop.util.ContextUtil
+
+import org.apache.spark.annotation.DeveloperApi
+import org.apache.spark.{Partition => SparkPartition, Logging}
+import org.apache.spark.rdd.{NewHadoopPartition, RDD}
+
+import org.apache.spark.sql.{SQLConf, Row, SQLContext}
+import org.apache.spark.sql.catalyst.expressions.{SpecificMutableRow, And,
Expression, Attribute}
+import org.apache.spark.sql.catalyst.types.{IntegerType, StructField,
StructType}
+import org.apache.spark.sql.sources._
+
+import scala.collection.JavaConversions._
+
+/**
+ * Allows creation of parquet based tables using the syntax
+ * `CREATE TABLE ... USING org.apache.spark.sql.parquet`. Currently the
only option required
+ * is `path`, which is should be the location of a collection of,
optionally partitioned,
+ * parquet files.
+ */
+class DefaultSource extends RelationProvider {
+ /** Returns a new base relation with the given parameters. */
+ override def createRelation(
+ sqlContext: SQLContext,
+ parameters: Map[String, String]): BaseRelation = {
+ val path =
+ parameters.getOrElse("path", sys.error("'path' must be specifed for
parquet tables."))
+
+ ParquetRelation2(path)(sqlContext)
+ }
+}
+
+private[parquet] case class Partition(partitionValues: Map[String, Any],
files: Seq[FileStatus])
+
+/**
+ * An alternative to [[ParquetRelation]] that plugs in using the data
sources API. This class is
+ * currently not intended as a full replacement of the parquet support in
Spark SQL though it is
+ * likely that it will eventually subsume the existing physical plan
implementation.
+ *
+ * Compared with the current implementation, this class has the following
notable differences:
+ *
+ * Partitioning: Partitions are auto discovered and must be in the form of
directories `key=value/`
+ * located at `path`. Currently only a single partitioning column is
supported and it must
+ * be an integer. This class supports both fully self-describing data,
which contains the partition
+ * key, and data where the partition key is only present in the folder
structure. The presence
+ * of the partitioning key in the data is also auto-detected.
--- End diff --
Should also mention null partition value is not supported yet.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]