aboutsummaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorWenchen Fan <cloud0fan@outlook.com>2015-08-20 13:51:54 -0700
committerReynold Xin <rxin@databricks.com>2015-08-20 13:51:54 -0700
commit907df2fce00d2cbc9fae371344f05f800e0d2726 (patch)
tree4417757433561779aeaf62e867a1dccf16ed6fd7 /sql
parent12de348332108f8c0c5bdad1d4cfac89b952b0f8 (diff)
downloadspark-907df2fce00d2cbc9fae371344f05f800e0d2726.tar.gz
spark-907df2fce00d2cbc9fae371344f05f800e0d2726.tar.bz2
spark-907df2fce00d2cbc9fae371344f05f800e0d2726.zip
[SQL] [MINOR] remove unnecessary class
This class is identical to `org.apache.spark.sql.execution.datasources.jdbc. DefaultSource` and is not needed. Author: Wenchen Fan <cloud0fan@outlook.com> Closes #8334 from cloud-fan/minor.
Diffstat (limited to 'sql')
-rw-r--r--sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DefaultSource.scala64
1 files changed, 0 insertions, 64 deletions
diff --git a/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DefaultSource.scala b/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DefaultSource.scala
deleted file mode 100644
index 6e4cc4de7f..0000000000
--- a/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DefaultSource.scala
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
-* 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.execution.datasources
-
-import java.util.Properties
-
-import org.apache.spark.sql.SQLContext
-import org.apache.spark.sql.execution.datasources.jdbc.{JDBCRelation, JDBCPartitioningInfo, DriverRegistry}
-import org.apache.spark.sql.sources.{BaseRelation, DataSourceRegister, RelationProvider}
-
-
-class DefaultSource extends RelationProvider with DataSourceRegister {
-
- override def shortName(): String = "jdbc"
-
- /** Returns a new base relation with the given parameters. */
- override def createRelation(
- sqlContext: SQLContext,
- parameters: Map[String, String]): BaseRelation = {
- val url = parameters.getOrElse("url", sys.error("Option 'url' not specified"))
- val driver = parameters.getOrElse("driver", null)
- val table = parameters.getOrElse("dbtable", sys.error("Option 'dbtable' not specified"))
- val partitionColumn = parameters.getOrElse("partitionColumn", null)
- val lowerBound = parameters.getOrElse("lowerBound", null)
- val upperBound = parameters.getOrElse("upperBound", null)
- val numPartitions = parameters.getOrElse("numPartitions", null)
-
- if (driver != null) DriverRegistry.register(driver)
-
- if (partitionColumn != null
- && (lowerBound == null || upperBound == null || numPartitions == null)) {
- sys.error("Partitioning incompletely specified")
- }
-
- val partitionInfo = if (partitionColumn == null) {
- null
- } else {
- JDBCPartitioningInfo(
- partitionColumn,
- lowerBound.toLong,
- upperBound.toLong,
- numPartitions.toInt)
- }
- val parts = JDBCRelation.columnPartition(partitionInfo)
- val properties = new Properties() // Additional properties that we will pass to getConnection
- parameters.foreach(kv => properties.setProperty(kv._1, kv._2))
- JDBCRelation(url, table, parts, properties)(sqlContext)
- }
-}