Fixing typechecker on ASTSubtypes escalating to ASTs
parent
6169f4d614
commit
4738e5e631
|
@ -10,11 +10,11 @@ object Catalyst extends HardcodedDefinition
|
|||
Node("Filter")(
|
||||
"condition" -> Type.Native("Expression"),
|
||||
"child" -> Type.AST("LogicalPlan")
|
||||
),
|
||||
).withSupertypes("UnaryNode"),
|
||||
Node("Project")(
|
||||
"projectList" -> Type.Array(Type.Native("NamedExpression")),
|
||||
"child" -> Type.AST("LogicalPlan")
|
||||
),
|
||||
).withSupertypes("UnaryNode"),
|
||||
Node("Union")(
|
||||
"children" -> Type.Array(Type.AST("LogicalPlan")),
|
||||
"byName" -> Type.Bool,
|
||||
|
@ -30,27 +30,27 @@ object Catalyst extends HardcodedDefinition
|
|||
Node("LocalLimit")(
|
||||
"limitExpr" -> Type.Native("Expression"),
|
||||
"child" -> Type.AST("LogicalPlan")
|
||||
),
|
||||
).withSupertypes("UnaryNode"),
|
||||
Node("GlobalLimit")(
|
||||
"limitExpr" -> Type.Native("Expression"),
|
||||
"child" -> Type.AST("LogicalPlan")
|
||||
),
|
||||
).withSupertypes("UnaryNode"),
|
||||
Node("Aggregate")(
|
||||
"groupingExpressions" -> Type.Array(Type.Native("Expression")),
|
||||
"aggregateExpressions" -> Type.Array(Type.Native("NamedExpression")),
|
||||
"child" -> Type.AST("LogicalPlan")
|
||||
),
|
||||
).withSupertypes("UnaryNode"),
|
||||
Node("Window")(
|
||||
"windowExpressions" -> Type.Array(Type.Native("NamedExpression")),
|
||||
"partitionSpec" -> Type.Array(Type.Native("Expression")),
|
||||
"orderSpec" -> Type.Array(Type.Native("SortOrder")),
|
||||
"child" -> Type.AST("LogicalPlan")
|
||||
),
|
||||
).withSupertypes("UnaryNode"),
|
||||
Node("EventTimeWatermark")(
|
||||
"eventTime" -> Type.Native("Attribute"),
|
||||
"delay" -> Type.Native("CalendarInterval"),
|
||||
"child" -> Type.AST("LogicalPlan"),
|
||||
),
|
||||
).withSupertypes("UnaryNode"),
|
||||
)
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
|
@ -134,7 +134,7 @@ object Catalyst extends HardcodedDefinition
|
|||
)
|
||||
|
||||
Function("canPushThrough", Type.Bool)(
|
||||
Type.Node("UnaryNode")
|
||||
Type.ASTSubtype("UnaryNode")
|
||||
)
|
||||
|
||||
Function("canPushThroughCondition", Type.Bool)(
|
||||
|
@ -613,7 +613,7 @@ object Catalyst extends HardcodedDefinition
|
|||
Rule("PushDownPredicates-2-6", "LogicalPlan")(
|
||||
Bind("filter", Match("Filter")(
|
||||
Bind("unusedCondition"),
|
||||
Bind("u", Match("UnaryNode")), // here be dragons.
|
||||
Bind("u", OfType(Type.ASTSubtype("UnaryNode"))), // here be dragons.
|
||||
)) and Test(
|
||||
Apply("canPushThrough")(
|
||||
Ref("u")
|
||||
|
|
|
@ -14,6 +14,9 @@ object Typecheck
|
|||
case (a, b) if a == b => true
|
||||
case (Type.Node(label), o:Type.ASTType) =>
|
||||
schema.nodesByName(label).allSupertypes contains o
|
||||
case (n:Type.ASTSubtype, o:Type.AST) =>
|
||||
println(schema.asts(o.family).subtypes.keys)
|
||||
schema.asts(o.family).subtypes contains n
|
||||
case (Type.Union(elems), a) =>
|
||||
elems.forall { escalatesTo(_, a, schema) }
|
||||
case (a, Type.Union(elems)) =>
|
||||
|
|
Loading…
Reference in New Issue