liyuheng55555 opened a new pull request, #9236: URL: https://github.com/apache/iotdb/pull/9236
ExpressionAnalyzer is the class in charge of handling expressions. Each method in this class has different ability, such as searchSourceExpressions() finds out which sources the expression contains, removeWildcardInExpression() remove * from expression, and so on. There were some redundant logic in ExpressionAnalyzer's methods. To make it easier to add new kinds of expressions, it's necessary to simplify. After analyze the similarity between these methods, I believe the visitor pattern is a good way to make it simple. The same logic can be contained in superclass-visitor, and the difference can be implemented by subclass-visitor's override. Finally, I restructure 11 methods in ExpressionAnalyzer, meantime add 11 new visitor. Here is their relationship: |old method|new visitor as replacement| |:--:|:--:| |searchSourceExpressions|CollectSourceExpressionsVisitor| |searchAggregationExpressions|CollectAggregationExpressionsVisitor| |removeWildcardInExpression|RemoveWildcardInExpressionVisitor| |removeWildcardInFilter|RemoveWildcardInFilterVisitor| |replaceRawPathWithGroupedPath|ReplaceRawPathWithGroupedPathVisitor| |concatDeviceAndRemoveWildcard|ConcatDeviceAndRemoveWildcardVisitor| |removeWildcardInFilterByDevice|RemoveWildcardInFilterByDeviceVisitor| |removeAliasFromExpression|RemoveAliasFromExpressionVisitor| |getMeasurementExpression|GetMeasurementExpressionVisitor| |bindTypeForTimeSeriesOperand|BindTypeForTimeSeriesOperandVisitor| |concatExpressionWithSuffixPaths|ConcatExpressionWithSuffixPathsVisitor| -- 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]
