-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Make ConnectorExpression JSON serializable #11447
Make ConnectorExpression JSON serializable #11447
Conversation
71f2104
to
e7b4e6c
Compare
import io.trino.spi.type.Type; | ||
|
||
import java.util.List; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't you need to enumerate known subclasses as in
trino/core/trino-main/src/main/java/io/trino/sql/planner/plan/PlanNode.java
Lines 28 to 69 in 36ff8b5
@JsonSubTypes({ | |
@JsonSubTypes.Type(value = OutputNode.class, name = "output"), | |
@JsonSubTypes.Type(value = ProjectNode.class, name = "project"), | |
@JsonSubTypes.Type(value = TableScanNode.class, name = "tablescan"), | |
@JsonSubTypes.Type(value = ValuesNode.class, name = "values"), | |
@JsonSubTypes.Type(value = AggregationNode.class, name = "aggregation"), | |
@JsonSubTypes.Type(value = MarkDistinctNode.class, name = "markDistinct"), | |
@JsonSubTypes.Type(value = FilterNode.class, name = "filter"), | |
@JsonSubTypes.Type(value = WindowNode.class, name = "window"), | |
@JsonSubTypes.Type(value = RowNumberNode.class, name = "rowNumber"), | |
@JsonSubTypes.Type(value = TopNRankingNode.class, name = "topnRanking"), | |
@JsonSubTypes.Type(value = LimitNode.class, name = "limit"), | |
@JsonSubTypes.Type(value = DistinctLimitNode.class, name = "distinctlimit"), | |
@JsonSubTypes.Type(value = TopNNode.class, name = "topn"), | |
@JsonSubTypes.Type(value = SampleNode.class, name = "sample"), | |
@JsonSubTypes.Type(value = SortNode.class, name = "sort"), | |
@JsonSubTypes.Type(value = RemoteSourceNode.class, name = "remoteSource"), | |
@JsonSubTypes.Type(value = JoinNode.class, name = "join"), | |
@JsonSubTypes.Type(value = SemiJoinNode.class, name = "semijoin"), | |
@JsonSubTypes.Type(value = SpatialJoinNode.class, name = "spatialjoin"), | |
@JsonSubTypes.Type(value = IndexJoinNode.class, name = "indexjoin"), | |
@JsonSubTypes.Type(value = IndexSourceNode.class, name = "indexsource"), | |
@JsonSubTypes.Type(value = RefreshMaterializedViewNode.class, name = "refreshmaterializedview"), | |
@JsonSubTypes.Type(value = TableWriterNode.class, name = "tablewriter"), | |
@JsonSubTypes.Type(value = DeleteNode.class, name = "delete"), | |
@JsonSubTypes.Type(value = UpdateNode.class, name = "update"), | |
@JsonSubTypes.Type(value = TableExecuteNode.class, name = "tableExecute"), | |
@JsonSubTypes.Type(value = TableDeleteNode.class, name = "tableDelete"), | |
@JsonSubTypes.Type(value = TableFinishNode.class, name = "tablecommit"), | |
@JsonSubTypes.Type(value = UnnestNode.class, name = "unnest"), | |
@JsonSubTypes.Type(value = ExchangeNode.class, name = "exchange"), | |
@JsonSubTypes.Type(value = UnionNode.class, name = "union"), | |
@JsonSubTypes.Type(value = IntersectNode.class, name = "intersect"), | |
@JsonSubTypes.Type(value = EnforceSingleRowNode.class, name = "scalar"), | |
@JsonSubTypes.Type(value = GroupIdNode.class, name = "groupid"), | |
@JsonSubTypes.Type(value = ExplainAnalyzeNode.class, name = "explainAnalyze"), | |
@JsonSubTypes.Type(value = ApplyNode.class, name = "apply"), | |
@JsonSubTypes.Type(value = AssignUniqueId.class, name = "assignUniqueId"), | |
@JsonSubTypes.Type(value = CorrelatedJoinNode.class, name = "correlatedJoin"), | |
@JsonSubTypes.Type(value = StatisticsWriterNode.class, name = "statisticsWriterNode"), | |
@JsonSubTypes.Type(value = PatternRecognitionNode.class, name = "patternRecognition"), | |
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, see #11447 (comment)
I had some thoughts in #11045, however same concern as in #1720 (comment) applies -- if SPI knows all subclasses, it would be convenient to add a visitor pattern; also, JSON-serialization may be taken as implying serialized form backward- and forward-compatibility, but we make no guarantees about that, otherwise we should have test coverage for that. @assaf2 what problem are you trying to solve? |
The SPI won't need to be aware of all the subclasses. When
We're already using
Why JSON-serialization backward- and forward-compatibility is taken more "seriously" than the SPI class itself?
I want to pass the |
That was my intuition in #11045, but i realized not needing that is actually simple. |
In my case, each worker dynamically supports different predicates. |
👋 @assaf2 - this PR has become inactive. If you're still interested in working on it, please let us know. We're working on closing out old and inactive PRs, so if you're too busy or this has too many merge conflicts to be worth picking back up, we'll be making another pass to close it out in a few weeks. |
Since
TupleDomain
is JSON serializable, IMOConnectorExpression
should be as well