Class RelJson
java.lang.Object
org.apache.calcite.rel.externalize.RelJson
Utilities for converting
RelNode
into JSON format.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Translates a JSON object that represents an input reference into a RexNode. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclassToTypeName
(Class<? extends RelNode> class_) Inverse oftypeNameToClass(java.lang.String)
.static RelJson
create()
Creates a RelJson.getConstructor
(String type) static <C extends Comparable<C>>
com.google.common.collect.Range<C>rangeFromJson
(List<String> list) Creates aRange
from a JSON object.static <C extends Comparable<C>>
com.google.common.collect.RangeSet<C>rangeSetFromJson
(List<List<String>> rangeSetsJson) Converts a JSON list to aRangeSet
.static RexNode
readExpression
(RelOptCluster cluster, RelJson.InputTranslator translator, Map<String, Object> o) Deprecated.static <C extends Comparable<C>>
Sarg<C>sargFromJson
(Map<String, Object> map) Converts a JSON object to aSarg
.toCollation
(List<Map<String, Object>> jsonFieldCollations) toDistribution
(Map<String, Object> map) toFieldCollation
(Map<String, Object> map) <C extends Comparable<C>>
List<String>toJson
(com.google.common.collect.Range<C> range) Serializes aRange
that can be deserialized usingrangeFromJson(List)
.<C extends Comparable<C>>
List<List<String>>toJson
(com.google.common.collect.RangeSet<C> rangeSet) @Nullable Object
toJson
(AggregateCall node) toJson
(RelCollationImpl node) <C extends Comparable<C>>
ObjecttoRex
(RelOptCluster cluster, Object o) Translates a JSON expression into a RexNode.toType
(RelDataTypeFactory typeFactory, Object o) typeNameToClass
(String type) Converts a type name to a class.withInputTranslator
(RelJson.InputTranslator inputTranslator) Returns a RelJson with a given InputTranslator.withJsonBuilder
(JsonBuilder jsonBuilder) Returns a RelJson with a given JsonBuilder.Returns a RelJson with an operator table that consists of the standard operators plus operators in all libraries.withOperatorTable
(SqlOperatorTable operatorTable) Returns a RelJson with a given operator table.
-
Field Details
-
PACKAGES
-
-
Constructor Details
-
RelJson
Deprecated.Usecreate()
, followed bywithJsonBuilder(org.apache.calcite.util.JsonBuilder)
ifjsonBuilder
is not null.Creates a RelJson.
-
-
Method Details
-
create
Creates a RelJson. -
withJsonBuilder
Returns a RelJson with a given JsonBuilder. -
withInputTranslator
Returns a RelJson with a given InputTranslator. -
withOperatorTable
Returns a RelJson with a given operator table. -
withLibraryOperatorTable
Returns a RelJson with an operator table that consists of the standard operators plus operators in all libraries. -
create
-
getConstructor
-
typeNameToClass
Converts a type name to a class. E.g.getClass("LogicalProject")
returnsLogicalProject
.class. -
classToTypeName
Inverse oftypeNameToClass(java.lang.String)
. -
toJson
-
toCollation
-
toFieldCollation
-
toDistribution
-
toType
-
toJson
-
toJson
-
toJson
-
toJson
public <C extends Comparable<C>> List<List<String>> toJson(com.google.common.collect.RangeSet<C> rangeSet) -
toJson
Serializes aRange
that can be deserialized usingrangeFromJson(List)
. -
toJson
-
toRex
Translates a JSON expression into a RexNode.- Parameters:
cluster
- The optimization environmento
- JSON object- Returns:
- the transformed RexNode
-
sargFromJson
Converts a JSON object to aSarg
.For example,
{rangeSet: [["[", 0, 5, "]"], ["[", 10, "-", ")"]], nullAs: "UNKNOWN"}
represents the range x ≥ 0 and x ≤ 5 or x > 10. -
rangeSetFromJson
public static <C extends Comparable<C>> com.google.common.collect.RangeSet<C> rangeSetFromJson(List<List<String>> rangeSetsJson) Converts a JSON list to aRangeSet
. -
rangeFromJson
public static <C extends Comparable<C>> com.google.common.collect.Range<C> rangeFromJson(List<String> list) Creates aRange
from a JSON object.The JSON object is as serialized using
toJson(Range)
, e.g.["[", ")", 10, "-"]
.- See Also:
-
RelJson.RangeToJsonConverter
-
readExpression
@Deprecated public static RexNode readExpression(RelOptCluster cluster, RelJson.InputTranslator translator, Map<String, Object> o) Deprecated.Translates a JSON expression into a RexNode, using a givenRelJson.InputTranslator
to transform JSON objects that represent input references into RexNodes.- Parameters:
cluster
- The optimization environmenttranslator
- Input translatoro
- JSON object- Returns:
- the transformed RexNode
-
create()
, followed bywithJsonBuilder(org.apache.calcite.util.JsonBuilder)
ifjsonBuilder
is not null.