sanjeet006py commented on code in PR #2574:
URL: https://github.com/apache/phoenix/pull/2574#discussion_r3786490451


##########
phoenix-core-server/src/main/java/org/apache/phoenix/hbase/index/IndexRegionObserver.java:
##########
@@ -1770,18 +1768,10 @@ private void 
extractLiteralTTLForInternalScan(MiniBatchOperationInProgress<Mutat
     if (ttlBytes == null) {
       return;
     }
-    // Disambiguate literal vs conditional by the proto discriminator alone 
(hasLiteral()), the same
-    // field TTLExpressionFactory.createFromProto keys on, without 
materializing the compiled
-    // conditional Expression tree just to test its type. This keeps the 
conditional path's cost
-    // unchanged: a conditional _TTL is left in place and only 
updateMutationsForConditionalTTL
-    // deserializes it (per expiring row, as before).
-    if (!PTableProtos.TTLExpression.parseFrom(ttlBytes).hasLiteral()) {
-      // Conditional TTL: leave the attribute in place for 
updateMutationsForConditionalTTL.
-      return;
-    }
-    context.literalTTLForInternalScan = ttlBytes;
-    for (int i = 0; i < miniBatchOp.size(); i++) {
-      
miniBatchOp.getOperation(i).setAttribute(BaseScannerRegionObserverConstants.TTL,
 null);
+    CompiledTTLExpression ttlExpr = TTLExpressionFactory.create(ttlBytes);
+    context.ttlExpressionForBatch = ttlExpr;
+    if (context.isLiteralTTL()) {
+      context.literalTTLForInternalScan = ttlBytes;

Review Comment:
   Ideally no. But instead of reserializiing TTL Expression (which we have 
already extracted) for literal TTL, I thought why not store that also as bytes. 
Literal TTL in bytes form doesn't add much overhead. 



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to