924060929 commented on PR #14882:
URL: https://github.com/apache/doris/pull/14882#issuecomment-1341091932

   > @924060929 PTAL, Can this be easily compatible with Nereids?
   
   hello @ByteYue , Would you like to add this new feature for nereids planner?
   
   for this feature, you can add this classes
   - interface InformationSchemaRelation extends Plan
   - LogicalProcsTable: extends LogicalRelation implement 
InformationSchemaRelation
     - in the constructor set the qualifier name and table name to the 
LogicalRelation
     - provide empty constructor and the constructor provide 
`Optional<GroupExpression> groupExpression, LogicalProperties logicalProperties`
     - override toString, equals, hashCode, accept, withGroupExpression, 
withLogicalProperties like `LogicalOlapScan`
   - PhysicalProcsTable: extends PhysicalRelation implement 
InformationSchemaRelation
     - in the constructor set the qualifier name and table name to the 
LogicalRelation
     - provide constructor that provide `LogicalProperties` and another 
constructor provide `Optional<GroupExpression> groupExpression, 
LogicalProperties logicalProperties,  PhysicalProperties physicalProperties, 
StatsDeriveResult statsDeriveResult`
     - override toString, equals, hashCode, accept, withGroupExpression, 
withLogicalProperties, withPhysicalPropertiesAndStats like `PhysicalOlapScan`
   - create a `LogicalProcsTableToPhysicalProcsTable` rule like 
`LogicalOlapScanToPhysicalOlapScan`
   
   modify:
   - PlanVisitor: add visitor method for the LogicalProcsTable and 
PhysicalProcsTable
   - BindRelation: create and return LogicalProcsTable if query the 
information_schema.procs
   - RuleSet: add the `LogicalProcsTableToPhysicalProcsTable` to the 
`IMPLEMENTATION_RULES`
   - PhysicalPlanTranslator: add visitPhysicalProcsTable method to translate to 
the Node like OlapScanNode
   
   
   after complete this work, you can display the plan tree
   ```sql
   SET enable_vectorized_engine=true;
   SET enable_nereids_planner=true;
   SET enable_fallback_to_original_planner=false;
   explain physical plan select * from information_schema.procs;
   ``` 
   ```
   
+----------------------------------------------------------------------------------------------------------------+
   | Explain String                                                             
                                    |
   
+----------------------------------------------------------------------------------------------------------------+
   | PhysicalDistribute ( distributionSpec=DistributionSpecGather, 
stats=(rows=1, width=1, penalty=0.0) )           |
   | +--PhysicalProcsTable ( ) ) |
   
+----------------------------------------------------------------------------------------------------------------+
   ```
   
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to