You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@carbondata.apache.org by GitBox <gi...@apache.org> on 2019/10/11 14:16:11 UTC

[GitHub] [carbondata] ravipesala commented on a change in pull request #3392: [CARBONDATA-3516] Supporting mixed formats in carbon

ravipesala commented on a change in pull request #3392: [CARBONDATA-3516] Supporting mixed formats in carbon
URL: https://github.com/apache/carbondata/pull/3392#discussion_r334013300
 
 

 ##########
 File path: integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/addsegment/AddSegmentTestCase.scala
 ##########
 @@ -258,6 +258,207 @@ class AddSegmentTestCase extends QueryTest with BeforeAndAfterAll {
     FileFactory.deleteAllFilesOfDir(new File(newPath))
   }
 
+  test("Test added segment with different format") {
+    sql("drop table if exists addsegment1")
+    sql("drop table if exists addsegment2")
+    sql(
+      """
+        | CREATE TABLE addsegment1 (empname String, designation String, doj Timestamp,
+        |  workgroupcategory int, workgroupcategoryname String, deptno int, deptname String,
+        |  projectcode int, projectjoindate Timestamp, projectenddate Date,attendance int,
+        |  utilization int,salary int, empno int)
+        | STORED BY 'org.apache.carbondata.format'
+      """.stripMargin)
+
+    sql(s"""LOAD DATA local inpath '$resourcesPath/data.csv' INTO TABLE addsegment1 OPTIONS('DELIMITER'= ',', 'QUOTECHAR'= '"')""")
+
+    sql(
+      """
+        | CREATE TABLE addsegment2 (empname String, designation String, doj Timestamp,
+        |  workgroupcategory int, workgroupcategoryname String, deptno int, deptname String,
+        |  projectcode int, projectjoindate Timestamp, projectenddate Date,attendance int,
+        |  utilization int,salary int, empno int) using parquet
+      """.stripMargin)
+
+    sql(s"""insert into addsegment2 select * from addsegment1""")
+
+    sql("select * from addsegment2").show()
+    val table = sqlContext.sparkSession.sessionState.catalog.getTableMetadata(TableIdentifier( "addsegment2"))
+    val path = table.location.getPath
+    val newPath = storeLocation + "/" + "addsegtest"
+    FileFactory.deleteAllFilesOfDir(new File(newPath))
+    copy(path, newPath)
+    checkAnswer(sql("select count(*) from addsegment1"), Seq(Row(10)))
+
+    sql(s"alter table addsegment1 add segment options('path'='$newPath', 'format'='parquet')").show()
 
 Review comment:
   handled

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services