Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[poc][multistage][feature] function registry unification #12163

Closed
wants to merge 4 commits into from

Conversation

walterddr
Copy link
Contributor

@walterddr walterddr commented Dec 15, 2023

working POC for a unified function registry. (extended version from #12144)

@walterddr walterddr force-pushed the poc_function_reg_full branch 2 times, most recently from f15c394 to 5f65e91 Compare December 18, 2023 17:04
@codecov-commenter
Copy link

codecov-commenter commented Dec 18, 2023

Codecov Report

Attention: 55 lines in your changes are missing coverage. Please review.

Comparison is base (d1cc17c) 61.53% compared to head (89c8335) 61.52%.
Report is 2 commits behind head on master.

Files Patch % Lines
...not/common/function/sql/PinotFunctionRegistry.java 58.13% 32 Missing and 4 partials ⚠️
.../pinot/common/function/sql/PinotOperatorTable.java 56.00% 9 Missing and 2 partials ⚠️
...apache/pinot/common/function/FunctionRegistry.java 85.71% 1 Missing and 3 partials ⚠️
.../common/function/registry/PinotScalarFunction.java 73.33% 4 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #12163      +/-   ##
============================================
- Coverage     61.53%   61.52%   -0.01%     
- Complexity      207     1152     +945     
============================================
  Files          2416     2422       +6     
  Lines        131177   131512     +335     
  Branches      20245    20302      +57     
============================================
+ Hits          80717    80912     +195     
- Misses        44570    44679     +109     
- Partials       5890     5921      +31     
Flag Coverage Δ
custom-integration1 <0.01% <0.00%> (-0.01%) ⬇️
integration <0.01% <0.00%> (-0.01%) ⬇️
integration1 <0.01% <0.00%> (-0.01%) ⬇️
integration2 0.00% <0.00%> (ø)
java-11 61.46% <64.51%> (-0.03%) ⬇️
java-21 61.39% <64.51%> (-0.01%) ⬇️
skip-bytebuffers-false 61.48% <64.51%> (-0.04%) ⬇️
skip-bytebuffers-true 61.37% <64.51%> (-0.01%) ⬇️
temurin 61.52% <64.51%> (-0.01%) ⬇️
unittests 61.51% <64.51%> (-0.01%) ⬇️
unittests1 46.64% <64.51%> (+0.01%) ⬆️
unittests2 27.64% <0.00%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Rong Rong added 4 commits January 4, 2024 07:55
1. FunctionRegistry keeps the old FUNCTION_INFO_MAP only
2. moved Calcite Catalog-based schema.Function registry to its own package; along with a SqlOperator based PinotOperatorTable
3. both CatalogReader and OperatorTable utilizes ground truth function from PinotFunctionRegistry --> will be default once deprecate FunctionRegistry
4. PinotFunctionRegistry provides argument-type based lookup via the same method SqlValidator utilize to lookup routine (and lookup operator overload)
5. clean up multi-stage engine side accordingly
@walterddr walterddr marked this pull request as ready for review January 4, 2024 23:00
@walterddr walterddr changed the title [POC] function registry unification [multistage][feature] function registry unification Jan 4, 2024
@@ -38,19 +42,14 @@

/**
* Registry for scalar functions.
* <p>TODO: Merge FunctionRegistry and FunctionDefinitionRegistry to provide one single registry for all functions.
*/
public class FunctionRegistry {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to reviewer: this class will be maintain until

  1. all Transform/Scalar functions are unified
  2. all legacy, arg-count based function resolution logics are deprecated

LOGGER.info("Initialized FunctionRegistry with {} functions: {} in {}ms", FUNCTION_MAP.map().size(),
FUNCTION_MAP.map().keySet(), System.currentTimeMillis() - startTimeMs);

// REGISTER OPERATORS
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to reviewer:
this part will be maintain until all Transform function are registered in scalar form via PinotScalarFunction

return argTypes.stream().map(type -> toRelType(typeFactory, type)).collect(Collectors.toList());
}

private static RelDataType toRelType(RelDataTypeFactory typeFactory, DataSchema.ColumnDataType dataType) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to reviewer:
this and several other type conversion utils should be unified, we will follow up in separate PRs



/**
* Temporary implementation of all dynamic arg/return type inference operators.
Copy link
Contributor Author

@walterddr walterddr Jan 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to reviewer:
This will be maintained until all operators can be merged into catalog

import org.apache.pinot.common.function.FunctionRegistry;


public class PinotSqlStdOperatorTable extends SqlStdOperatorTable {
Copy link
Contributor Author

@walterddr walterddr Jan 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to reviewer:
this class now only handles overries against SqlStdOperatorTable. it doesn't handle ANY Pinot special operators/functions

@walterddr walterddr force-pushed the poc_function_reg_full branch from 5f65e91 to 89c8335 Compare January 5, 2024 17:39
@walterddr walterddr changed the title [multistage][feature] function registry unification [poc][multistage][feature] function registry unification Jan 5, 2024
@walterddr walterddr marked this pull request as draft January 5, 2024 19:01
@walterddr
Copy link
Contributor Author

closing in favor of #12229

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants