@@ -66,6 +66,14 @@ public static String getRequiredFieldFromTID(String Tid, int index) {
6666 return Tid .split (CarbonCommonConstants .FILE_SEPARATOR )[index ];
6767 }
6868
69+ /**
70+ * returns required filed from tuple id
71+ *
72+ */
73+ public static String getRequiredFieldFromTID (String [] Tid , int index ) {
74+ return Tid [index ];
75+ }
76+
6977 /**
7078 * returns required filed from tuple id
7179 *
@@ -77,6 +85,17 @@ public static String getRequiredFieldFromTID(String Tid, TupleIdEnum tid) {
7785 return Tid .split ("/" )[tid .getTupleIdIndex ()];
7886 }
7987
88+ /**
89+ * returns required filed from tuple id
90+ *
91+ * @param Tid
92+ * @param tid
93+ * @return
94+ */
95+ public static String getRequiredFieldFromTID (String [] Tid , TupleIdEnum tid ) {
96+ return Tid [tid .getTupleIdIndex ()];
97+ }
98+
8099 /**
81100 * returns segment along with block id
82101 * @param Tid
@@ -123,6 +142,28 @@ public static String getTableBlockPath(String tid, String tablePath, boolean isS
123142 + CarbonCommonConstants .FILE_SEPARATOR + segment ;
124143 }
125144
145+ /**
146+ * Returns block path from tuple id
147+ */
148+ public static String getTableBlockPath (String [] tid , String tablePath , boolean isStandardTable ,
149+ boolean isPartitionTable ) {
150+ String partField = "0" ;
151+ // If it has segment file then part field can be appended directly to table path
152+ if (!isStandardTable ) {
153+ if (isPartitionTable ) {
154+ partField = getRequiredFieldFromTID (tid , TupleIdEnum .PARTITION_PART_ID );
155+ return tablePath + CarbonCommonConstants .FILE_SEPARATOR + partField .replace ("#" , "/" );
156+ } else {
157+ return tablePath ;
158+ }
159+ }
160+ String part = CarbonTablePath .addPartPrefix (partField );
161+ String segment =
162+ CarbonTablePath .addSegmentPrefix (getRequiredFieldFromTID (tid , TupleIdEnum .SEGMENT_ID ));
163+ return CarbonTablePath .getFactDir (tablePath ) + CarbonCommonConstants .FILE_SEPARATOR + part
164+ + CarbonCommonConstants .FILE_SEPARATOR + segment ;
165+ }
166+
126167 /**
127168 * returns delete delta file path
128169 *
0 commit comments