Github user kushalsaha commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1641#discussion_r156994717
--- Diff:
integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/allqueries/InsertIntoCarbonTableTestCase.scala
---
@@ -276,6 +281,121 @@ class InsertIntoCarbonTableTestCase extends QueryTest
with BeforeAndAfterAll {
}
sql("LOAD DATA INPATH '" + resourcesPath + "/100_olap.csv' overwrite
INTO table TCarbonSourceOverwrite options ('DELIMITER'=',', 'QUOTECHAR'='\',
'FILEHEADER'='imei,deviceInformationId,MAC,deviceColor,device_backColor,modelId,marketName,AMSize,ROMSize,CUPAudit,CPIClocked,series,productionDate,bomCode,internalModels,deliveryTime,channelsId,channelsName,deliveryAreaId,deliveryCountry,deliveryProvince,deliveryCity,deliveryDistrict,deliveryStreet,oxSingleNumber,ActiveCheckTime,ActiveAreaId,ActiveCountry,ActiveProvince,Activecity,ActiveDistrict,ActiveStreet,ActiveOperatorId,Active_releaseId,Active_EMUIVersion,Active_operaSysVersion,Active_BacVerNumber,Active_BacFlashVer,Active_webUIVersion,Active_webUITypeCarrVer,Active_webTypeDataVerNumber,Active_operatorsVersion,Active_phonePADPartitionedVersions,Latest_YEAR,Latest_MONTH,Latest_DAY,Latest_HOUR,Latest_areaId,Latest_country,Latest_province,Latest_city,Latest_district,Latest_street,Latest_releaseId,Latest_EMUIVersion,Latest_operaS
ysVersion,Latest_BacVerNumber,Latest_BacFlashVer,Latest_webUIVersion,Latest_webUITypeCarrVer,Latest_webTypeDataVerNumber,Latest_operatorsVersion,Latest_phonePADPartitionedVersions,Latest_operatorId,gamePointDescription,gamePointId,contractNumber')")
assert(rowCount == sql("select imei from
TCarbonSourceOverwrite").count())
+
+ }
+
+ test("insert overwrite in group by scenario with t1 no record and t2 no
record") {
+
queryExecution("overwriteTable1_noRecord.csv","overwriteTable2_noRecord.csv")
+ sql ("insert overwrite table OverwriteTable_t2 select
id,name,sum(salary) as TotalSalary,'98' as age from OverwriteTable_t1 group by
id,name,salary")
+ val exists_t1 = checkSegment("OverwriteTable_t1")
+ val exists_t2 = checkSegment("OverwriteTable_t2")
+ assert(!exists_t1)
+ assert(!exists_t2)
+ assert(sql("select * from OverwriteTable_t1").count() == sql("select *
from OverwriteTable_t2").count())
+ checkAnswer(sql("select * from OverwriteTable_t2"),
+ Seq())
+ checkAnswer(sql("select * from OverwriteTable_t1"),
+ sql("select * from OverwriteTable_t2"))
+ }
+
+
+ test("insert overwrite in group by scenario with t1 no record and t2
some record") {
+
queryExecution("overwriteTable1_noRecord.csv","overwriteTable2_someRecord.csv")
+ sql ("insert overwrite table OverwriteTable_t2 select
id,name,sum(salary) as TotalSalary,'98' as age from OverwriteTable_t1 group by
id,name,salary")
--- End diff --
only insert overwrite query is kept in the testcases as we handled two
different scenario 1) IN GROUP BY CASE
2) WITHOUT GROUP BY CASE if we refactor so one extra method need to be
written where again same code will exists
---