You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/01/17 03:20:38 UTC

[GitHub] [pulsar] gaoran10 opened a new issue #9224: [Pulsar SQL] More optimized points in PR #8422

gaoran10 opened a new issue #9224:
URL: https://github.com/apache/pulsar/issues/9224


   # Motivation
   
   The #8422 made a refactor for the Pulsar SQL, it's a major change. There are some points that could be considered to optimize.
   
   ## 1. PulsarRowDecoderFactory
   
   The various decoder factories could be initialized at the Pulsar SQL beginning, one time is enough and they could be reused.
   
   Refer to the method `private PulsarRowDecoderFactory createDecoderFactory(SchemaInfo schemaInfo)`  of the class `PulsarDispatchingRowDecoderFactory`.
   
   ## 2. PulsarRowDecoderFactory
   
   It seems that the multi-version schema decoder cache could be added and the decoders could be reused.
   
   Refer to the method `PulsarRowDecoder createRowDecoder(TopicName topicName, SchemaInfo schemaInfo,
                                         Set<DecoderColumnHandle> columns)` in class `PulsarRowDecoderFactory`.
   
   ```
   // PulsarRecordCursor.java
   PulsarRowDecoder keyDecoder = decoderFactory.createRowDecoder(topicName,
                       schemaInfo,
                       columnHandles.stream()
                               .filter(col -> !col.isInternal())
                               .filter(col -> PulsarColumnHandle.HandleKeyValueType.KEY
                                       .equals(col.getHandleKeyValueType()))
                               .collect(toImmutableSet()));
   ```
   
   ## 3. Internal Column decode optimize
   
   The `switch-case` is more efficient than `if-else` and the PulsarInternalColumn could be changed to an enum.
   
   ```
   // PulsarRecordCursor.java
   for (DecoderColumnHandle columnHandle : columnHandles) {
               if (columnHandle.isInternal()) {
                   if (PulsarInternalColumn.PARTITION.getName().equals(columnHandle.getName())) {
                       currentRowValuesMap.put(columnHandle, longValueProvider(this.partition));
                   } else if (PulsarInternalColumn.EVENT_TIME.getName().equals(columnHandle.getName())) {
                      ...
               }
           }
   ```
   
   


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



[GitHub] [pulsar] codelipenghui commented on issue #9224: [Pulsar SQL] Some optimized points in PR 8422

Posted by GitBox <gi...@apache.org>.
codelipenghui commented on issue #9224:
URL: https://github.com/apache/pulsar/issues/9224#issuecomment-1058894122


   The issue had no activity for 30 days, mark with Stale label.


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] complone commented on issue #9224: [Pulsar SQL] Some optimized points in PR 8422

Posted by GitBox <gi...@apache.org>.
complone commented on issue #9224:
URL: https://github.com/apache/pulsar/issues/9224#issuecomment-966694148


   I want to fix this issues.


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] complone edited a comment on issue #9224: [Pulsar SQL] Some optimized points in PR 8422

Posted by GitBox <gi...@apache.org>.
complone edited a comment on issue #9224:
URL: https://github.com/apache/pulsar/issues/9224#issuecomment-966694148


   @codelipenghui I want to fix this issues.


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org