You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@carbondata.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/09/01 01:30:21 UTC
[jira] [Commented] (CARBONDATA-191) load data is null when quote
char is single and no '\n' being end.
[ https://issues.apache.org/jira/browse/CARBONDATA-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15453968#comment-15453968 ]
ASF GitHub Bot commented on CARBONDATA-191:
-------------------------------------------
Github user Jay357089 commented on a diff in the pull request:
https://github.com/apache/incubator-carbondata/pull/107#discussion_r77101924
--- Diff: integration/spark/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/TestLoadDataWithSingleQuotechar.scala ---
@@ -0,0 +1,60 @@
+/*
+ * 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.carbondata.integration.spark.testsuite.dataload
+
+import org.apache.spark.sql.{DataFrame, Row}
+import org.apache.spark.sql.common.util.CarbonHiveContext._
+import org.apache.spark.sql.common.util.QueryTest
+import org.scalatest.BeforeAndAfterAll
+
+/**
+ * Test Class for data loading when there is single quote in fact data
+ *
+ */
+class TestLoadDataWithSingleQuotechar extends QueryTest with BeforeAndAfterAll {
+ override def beforeAll {
+ sql("DROP TABLE IF EXISTS carbontable")
+ sql(
+ "CREATE TABLE carbontable (id Int, name String) STORED BY 'carbondata'")
+ }
+
+ test("test data loading with single quote char") {
+ try {
+ sql(
+ "LOAD DATA LOCAL INPATH './src/test/resources/dataWithSingleQuote.csv' INTO TABLE " +
+ "carbontable OPTIONS('DELIMITER'= ',')")
+ checkAnswer(
+ sql("SELECT * from carbontable"),
+ Seq(Row("Tom",1),
+ Row("Tony\n3,Lily",2),
+ Row("Games\"",4),
+ Row("prival\"\n6,\"hello\"",5)
+ )
--- End diff --
@gvramana for [CARBONDATA-191], this PR is OK, right? for other issue like multiline across blocks, multiline can be set and so on, we can track in another jira, yes?
> load data is null when quote char is single and no '\n' being end.
> ------------------------------------------------------------------
>
> Key: CARBONDATA-191
> URL: https://issues.apache.org/jira/browse/CARBONDATA-191
> Project: CarbonData
> Issue Type: Bug
> Reporter: Jay
> Priority: Minor
>
> when load data just like below,
> CREATE TABLE Priyal11 (id int,name string) STORED BY 'org.apache.carbondata.format';
> LOAD DATA inpath 'hdfs://hacluster/Priyal1/test34.csv' INTO table Priyal11 options ('DELIMITER'=',', 'QUOTECHAR'='\"', 'FILEHEADER'='id,name');
> and test34.csv is like below(note: there is no new line in the end of file.):
> 1,"priyal\"
> 2,"hello\"
> then query name's result is null. Actually, because of the existence of quote char. the expected result should be
> |prival"
> 2,"hello"|
> and if we add new line in the end of file, then query is right.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)