You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@carbondata.apache.org by Jay357089 <gi...@git.apache.org> on 2016/08/29 14:59:11 UTC

[GitHub] incubator-carbondata pull request #107: [WIP]quotechar is single without new...

GitHub user Jay357089 opened a pull request:

    https://github.com/apache/incubator-carbondata/pull/107

    [WIP]quotechar is single without newLine

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/Jay357089/incubator-carbondata quoteNewline

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-carbondata/pull/107.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #107
    
----
commit bf97e735a0e619e78e47611c1095939d6c6b92eb
Author: Jay357089 <li...@huawei.com>
Date:   2016-08-29T14:55:22Z

    quotechar and newLine

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata pull request #107: [CARBONDATA-191]Fix bug when quote c...

Posted by Jay357089 <gi...@git.apache.org>.
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?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata pull request #107: [CARBONDATA-191]Fix bug when quote c...

Posted by Jay357089 <gi...@git.apache.org>.
Github user Jay357089 commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/107#discussion_r76949708
  
    --- 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 --
    
    ## i create hive hive table and load, just like below.
    
    CREATE TABLE hiveTable(id int, name string)
    ROW FORMAT
    SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde'
    WITH SERDEPROPERTIES (
       "separatorChar" = ",",
       "quoteChar"     = "\"",
       "escapeChar"    = "\\"
    )  
    STORED AS TEXTFILE;
    
    ## and find that when data is like below, 
    1,Tom
    2,"Lily"
    ##  that query can get the correct result,
     +-----+-------+--+
    | id  | name  |
    +-----+-------+--+
    | 1   | Tom   |
    | 2   | Lily  |
    +-----+-------+--+
    ## but if data is like below
    1,Tom
    2,"Tony
    3,Lily"
    ## query result is like below
    +-----+-------+--+
    | id  | name  |
    +-----+-------+--+
    | 1   | Tom   |
    | 2   | NULL  |
    | 3   | NULL  |
    +-----+-------+--+
    ## while carbon query is like below
    +--------------+-----+--+
    |     name     | id  |
    +--------------+-----+--+
    | Tom          | 1   |
    | Tony
    3,Lily  | 2   |
    +--------------+-----+--+
    
    so, now we can see that, hive can support quote char, but can not support multiline, while carbon can support both, this is the difference, and i think that carbon's query result is right, no need to keep same with hive.
    ## so, what we should only concern about is what i raise in [CARBONDATA-191].
    @gvramana @manishgupta88 what is ur opionion?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata pull request #107: [CARBONDATA-191]Fix bug when quote c...

Posted by manishgupta88 <gi...@git.apache.org>.
Github user manishgupta88 commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/107#discussion_r76787331
  
    --- 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 --
    
    @Jay357089 ...Please perform the below mentioned activities.
    1. Can you test the same scenario with same set of data in spark and hive to check their behavior and paste the result screenshot here.
    2. What about cases when instead of default escape character (\), some other escape character is given (like @, ^, /, etc)? Test with some other escape characters in carbon, spark and hive and verify that behavior is same everywhere and paste the snapshots here.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata pull request #107: [CARBONDATA-191]Fix bug when quote c...

Posted by gvramana <gi...@git.apache.org>.
Github user gvramana commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/107#discussion_r77038851
  
    --- 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 --
    
    1) previous version we were supporting multiline=true/false option in data load, but after moving to univocity parser, that option is discontinued and defaulted to multiline=true
    2) What happens if this multiline is split across blocks, as textinputformat will skip first line of current block and will read one extra new line of next block. It might end up reading, same line twice. - can be checked once and can be tracked as separate issue.
    3) future we can support option to set multiline=false for univocity parser, similar to hive.So this behavior of carbon is fine.
    4) I think multiline+parse till quote+delimiter as expected behaviour needs to be mentioned in IDG document.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata pull request #107: [CARBONDATA-191]Fix bug when quote c...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-carbondata/pull/107


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---