diff --git a/sql/core/src/main/scala/org/apache/spark/sql/jdbc/ApacheDrillDialect.scala b/sql/core/src/main/scala/org/apache/spark/sql/jdbc/ApacheDrillDialect.scala new file mode 100644 index 000000000000..12b7b37c5161 --- /dev/null +++ b/sql/core/src/main/scala/org/apache/spark/sql/jdbc/ApacheDrillDialect.scala @@ -0,0 +1,28 @@ +/* + * 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.jdbc + + +private case object ApacheDrillDialect extends JdbcDialect { + + override def canHandle(url : String): Boolean = url.startsWith("jdbc:drill") + + override def quoteIdentifier(colName: String): String = { + s"`$colName`" + } +} diff --git a/sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala b/sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala index 7c38ed68c041..a47eec2201a3 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala @@ -200,6 +200,7 @@ object JdbcDialects { registerDialect(DerbyDialect) registerDialect(OracleDialect) registerDialect(TeradataDialect) + registerDialect(ApacheDrillDialect) /** * Fetch the JdbcDialect class corresponding to a given database url.