[42/50] [abbrv] carbondata git commit: [CARBONDATA-2617] Invalid tuple-id and block id getting formed for Non partition table

2018-06-21 Thread jackylk
[CARBONDATA-2617] Invalid tuple-id and block id getting formed for Non 
partition table

Problem
Invalid tuple and block id getting formed for non partition table

Analysis
While creating a partition table a segment file was written in the Metadata 
folder under table structure. This was introduced during
development of partition table feature. At that time segment file was written 
only for partition table and it was used to distinguish between
parition and non partition table in the code. But later the code was modified 
to write the segment file for both parititon and non partition
table and the code to distinguish partition and non partition table was not 
modified which is causing this incorrect formation of block and tuple id.

Fix
Modify the logic to distinguish partitioned and non partitioned table and the 
same has been handled in this PR.

This closes #2385


Project: http://git-wip-us.apache.org/repos/asf/carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/carbondata/commit/0e1d550e
Tree: http://git-wip-us.apache.org/repos/asf/carbondata/tree/0e1d550e
Diff: http://git-wip-us.apache.org/repos/asf/carbondata/diff/0e1d550e

Branch: refs/heads/carbonstore
Commit: 0e1d550e8dacba798e9ffbdda25c4388e8933632
Parents: dc53dee
Author: rahul 
Authored: Tue Jun 19 19:23:26 2018 +0530
Committer: manishgupta88 
Committed: Wed Jun 20 16:37:23 2018 +0530

--
 .../core/mutate/CarbonUpdateUtil.java   |  4 +-
 .../executor/impl/AbstractQueryExecutor.java|  4 +-
 .../SegmentUpdateStatusManager.java | 20 ++---
 .../apache/carbondata/core/util/CarbonUtil.java |  4 +-
 .../iud/DeleteCarbonTableTestCase.scala | 83 
 .../command/mutation/DeleteExecution.scala  |  6 +-
 6 files changed, 100 insertions(+), 21 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/carbondata/blob/0e1d550e/core/src/main/java/org/apache/carbondata/core/mutate/CarbonUpdateUtil.java
--
diff --git 
a/core/src/main/java/org/apache/carbondata/core/mutate/CarbonUpdateUtil.java 
b/core/src/main/java/org/apache/carbondata/core/mutate/CarbonUpdateUtil.java
index 40d498c..8627bdb 100644
--- a/core/src/main/java/org/apache/carbondata/core/mutate/CarbonUpdateUtil.java
+++ b/core/src/main/java/org/apache/carbondata/core/mutate/CarbonUpdateUtil.java
@@ -81,10 +81,10 @@ public class CarbonUpdateUtil {
   /**
* Returns block path from tuple id
*/
-  public static String getTableBlockPath(String tid, String tablePath, boolean 
isSegmentFile) {
+  public static String getTableBlockPath(String tid, String tablePath, boolean 
isPartitionTable) {
 String partField = getRequiredFieldFromTID(tid, TupleIdEnum.PART_ID);
 // If it has segment file then partfield can be appended directly to table 
path
-if (isSegmentFile) {
+if (isPartitionTable) {
   return tablePath + CarbonCommonConstants.FILE_SEPARATOR + 
partField.replace("#", "/");
 }
 String part = CarbonTablePath.addPartPrefix(partField);

http://git-wip-us.apache.org/repos/asf/carbondata/blob/0e1d550e/core/src/main/java/org/apache/carbondata/core/scan/executor/impl/AbstractQueryExecutor.java
--
diff --git 
a/core/src/main/java/org/apache/carbondata/core/scan/executor/impl/AbstractQueryExecutor.java
 
b/core/src/main/java/org/apache/carbondata/core/scan/executor/impl/AbstractQueryExecutor.java
index 2bbe75c..f365045 100644
--- 
a/core/src/main/java/org/apache/carbondata/core/scan/executor/impl/AbstractQueryExecutor.java
+++ 
b/core/src/main/java/org/apache/carbondata/core/scan/executor/impl/AbstractQueryExecutor.java
@@ -296,8 +296,8 @@ public abstract class AbstractQueryExecutor implements 
QueryExecutor {
 String blockId = CarbonUtil
 .getBlockId(queryModel.getAbsoluteTableIdentifier(), filePath, 
segment.getSegmentNo(),
 queryModel.getTable().getTableInfo().isTransactionalTable(),
-segment.getSegmentFileName() != null);
-if (segment.getSegmentFileName() != null) {
+queryModel.getTable().isHivePartitionTable());
+if (queryModel.getTable().isHivePartitionTable()) {
   
blockExecutionInfo.setBlockId(CarbonTablePath.getShortBlockIdForPartitionTable(blockId));
 } else {
   blockExecutionInfo.setBlockId(CarbonTablePath.getShortBlockId(blockId));

http://git-wip-us.apache.org/repos/asf/carbondata/blob/0e1d550e/core/src/main/java/org/apache/carbondata/core/statusmanager/SegmentUpdateStatusManager.java
--
diff --git 
a/core/src/main/java/org/apache/carbondata/core/statusmanager/SegmentUpdateStatusManager.java
 
b/core/src/main/java/org/apache/carbondata/core/statusmanager/SegmentUpdateStatusManager.java
index 

carbondata git commit: [CARBONDATA-2617] Invalid tuple-id and block id getting formed for Non partition table

2018-06-20 Thread manishgupta88
Repository: carbondata
Updated Branches:
  refs/heads/master dc53dee24 -> 0e1d550e8


[CARBONDATA-2617] Invalid tuple-id and block id getting formed for Non 
partition table

Problem
Invalid tuple and block id getting formed for non partition table

Analysis
While creating a partition table a segment file was written in the Metadata 
folder under table structure. This was introduced during
development of partition table feature. At that time segment file was written 
only for partition table and it was used to distinguish between
parition and non partition table in the code. But later the code was modified 
to write the segment file for both parititon and non partition
table and the code to distinguish partition and non partition table was not 
modified which is causing this incorrect formation of block and tuple id.

Fix
Modify the logic to distinguish partitioned and non partitioned table and the 
same has been handled in this PR.

This closes #2385


Project: http://git-wip-us.apache.org/repos/asf/carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/carbondata/commit/0e1d550e
Tree: http://git-wip-us.apache.org/repos/asf/carbondata/tree/0e1d550e
Diff: http://git-wip-us.apache.org/repos/asf/carbondata/diff/0e1d550e

Branch: refs/heads/master
Commit: 0e1d550e8dacba798e9ffbdda25c4388e8933632
Parents: dc53dee
Author: rahul 
Authored: Tue Jun 19 19:23:26 2018 +0530
Committer: manishgupta88 
Committed: Wed Jun 20 16:37:23 2018 +0530

--
 .../core/mutate/CarbonUpdateUtil.java   |  4 +-
 .../executor/impl/AbstractQueryExecutor.java|  4 +-
 .../SegmentUpdateStatusManager.java | 20 ++---
 .../apache/carbondata/core/util/CarbonUtil.java |  4 +-
 .../iud/DeleteCarbonTableTestCase.scala | 83 
 .../command/mutation/DeleteExecution.scala  |  6 +-
 6 files changed, 100 insertions(+), 21 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/carbondata/blob/0e1d550e/core/src/main/java/org/apache/carbondata/core/mutate/CarbonUpdateUtil.java
--
diff --git 
a/core/src/main/java/org/apache/carbondata/core/mutate/CarbonUpdateUtil.java 
b/core/src/main/java/org/apache/carbondata/core/mutate/CarbonUpdateUtil.java
index 40d498c..8627bdb 100644
--- a/core/src/main/java/org/apache/carbondata/core/mutate/CarbonUpdateUtil.java
+++ b/core/src/main/java/org/apache/carbondata/core/mutate/CarbonUpdateUtil.java
@@ -81,10 +81,10 @@ public class CarbonUpdateUtil {
   /**
* Returns block path from tuple id
*/
-  public static String getTableBlockPath(String tid, String tablePath, boolean 
isSegmentFile) {
+  public static String getTableBlockPath(String tid, String tablePath, boolean 
isPartitionTable) {
 String partField = getRequiredFieldFromTID(tid, TupleIdEnum.PART_ID);
 // If it has segment file then partfield can be appended directly to table 
path
-if (isSegmentFile) {
+if (isPartitionTable) {
   return tablePath + CarbonCommonConstants.FILE_SEPARATOR + 
partField.replace("#", "/");
 }
 String part = CarbonTablePath.addPartPrefix(partField);

http://git-wip-us.apache.org/repos/asf/carbondata/blob/0e1d550e/core/src/main/java/org/apache/carbondata/core/scan/executor/impl/AbstractQueryExecutor.java
--
diff --git 
a/core/src/main/java/org/apache/carbondata/core/scan/executor/impl/AbstractQueryExecutor.java
 
b/core/src/main/java/org/apache/carbondata/core/scan/executor/impl/AbstractQueryExecutor.java
index 2bbe75c..f365045 100644
--- 
a/core/src/main/java/org/apache/carbondata/core/scan/executor/impl/AbstractQueryExecutor.java
+++ 
b/core/src/main/java/org/apache/carbondata/core/scan/executor/impl/AbstractQueryExecutor.java
@@ -296,8 +296,8 @@ public abstract class AbstractQueryExecutor implements 
QueryExecutor {
 String blockId = CarbonUtil
 .getBlockId(queryModel.getAbsoluteTableIdentifier(), filePath, 
segment.getSegmentNo(),
 queryModel.getTable().getTableInfo().isTransactionalTable(),
-segment.getSegmentFileName() != null);
-if (segment.getSegmentFileName() != null) {
+queryModel.getTable().isHivePartitionTable());
+if (queryModel.getTable().isHivePartitionTable()) {
   
blockExecutionInfo.setBlockId(CarbonTablePath.getShortBlockIdForPartitionTable(blockId));
 } else {
   blockExecutionInfo.setBlockId(CarbonTablePath.getShortBlockId(blockId));

http://git-wip-us.apache.org/repos/asf/carbondata/blob/0e1d550e/core/src/main/java/org/apache/carbondata/core/statusmanager/SegmentUpdateStatusManager.java
--
diff --git 
a/core/src/main/java/org/apache/carbondata/core/statusmanager/SegmentUpdateStatusManager.java