Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 487D7200BBE for ; Thu, 27 Oct 2016 17:13:00 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 4752C160AF6; Thu, 27 Oct 2016 15:13:00 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 89E7C160AE4 for ; Thu, 27 Oct 2016 17:12:59 +0200 (CEST) Received: (qmail 23633 invoked by uid 500); 27 Oct 2016 15:12:58 -0000 Mailing-List: contact issues-help@spark.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@spark.apache.org Received: (qmail 23618 invoked by uid 99); 27 Oct 2016 15:12:58 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Oct 2016 15:12:58 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 87E7C2C1F54 for ; Thu, 27 Oct 2016 15:12:58 +0000 (UTC) Date: Thu, 27 Oct 2016 15:12:58 +0000 (UTC) From: "Dongjoon Hyun (JIRA)" To: issues@spark.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (SPARK-18123) org.apache.spark.sql.execution.datasources.jdbc.JdbcUtils.saveTable the case senstivity issue MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 27 Oct 2016 15:13:00 -0000 [ https://issues.apache.org/jira/browse/SPARK-18123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15612167#comment-15612167 ] Dongjoon Hyun commented on SPARK-18123: --------------------------------------- Thank you. I'll make a PR to fix this. > org.apache.spark.sql.execution.datasources.jdbc.JdbcUtils.saveTable the case senstivity issue > ---------------------------------------------------------------------------------------------- > > Key: SPARK-18123 > URL: https://issues.apache.org/jira/browse/SPARK-18123 > Project: Spark > Issue Type: Bug > Components: SQL > Affects Versions: 2.0.1 > Reporter: Paul Wu > > Blindly quoting every field name for inserting is the issue (Line 110-119, https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JdbcUtils.scala). > /** > * Returns a PreparedStatement that inserts a row into table via conn. > */ > def insertStatement(conn: Connection, table: String, rddSchema: StructType, dialect: JdbcDialect) > : PreparedStatement = { > val columns = rddSchema.fields.map(x => dialect.quoteIdentifier(x.name)).mkString(",") > val placeholders = rddSchema.fields.map(_ => "?").mkString(",") > val sql = s"INSERT INTO $table ($columns) VALUES ($placeholders)" > conn.prepareStatement(sql) > } > This code causes the following issue (it does not happen to 1.6.x): > I have issue with the saveTable method in Spark 2.0/2.0.1. I tried to save a dataset to Oracle database, but the fields must be uppercase to succeed. This is not an expected behavior: If only the table names were quoted, this utility should concern the case sensitivity. The code below throws the exception: Caused by: java.sql.SQLSyntaxErrorException: ORA-00904: "DATETIME_gmt": invalid identifier. > String detailSQL ="select CAST('2016-09-25 17:00:00' AS TIMESTAMP) DATETIME_gmt, '1' NODEB"; > hc.sql("set spark.sql.caseSensitive=false"); > Dataset ds = hc.sql(detailSQL); > ds.show(); > org.apache.spark.sql.execution.datasources.jdbc.JdbcUtils.saveTable(ds, url, detailTable, p); -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org For additional commands, e-mail: issues-help@spark.apache.org