Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public ExprType getOutputType(InputBindingInspector inspector)
@Override
public boolean canVectorize(InputBindingInspector inspector)
{
return inspector.areNumeric(left, right) && inspector.canVectorize(left, right);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This opens not just STRING but also LONG_ARRAY and DOUBLE_ARRAY. Is that intentional (will numeric arrays work)?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

i think canVectorize will still end up false because array types/functions are not yet vectorizable, but yeah i guess array types would not be well handled here even if they were, though maybe that is the case for non-vectorized expression as well. I'll do a bit of exploration and see what up

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Did this exploration lead somewhere?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

array types do not currently implement canVectorize so will return the default false. We probably should not use canVectorize for argument validation and maybe should consider doing this explicitly when we can resolve the input types I think.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Got it. IMO we shouldn't rely on the fact that the array types happen to not be vectorizable. If they suddenly became vectorizable then this method would start returning true, maybe improperly.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

like, I agree here, but canVectorize still feels wrong to saddle with type validation, it can explode when creating the processor if the types are nonsense

I think what might be best is to introduce a 'validate' method to expressions so that arguments can be checked up front, and maybe explode if the input is madness

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In that case, could you add a comment about the situation?

return inspector.canVectorize(left, right);
}

@Override
Expand Down Expand Up @@ -130,7 +130,7 @@ public ExprType getOutputType(InputBindingInspector inspector)
@Override
public boolean canVectorize(InputBindingInspector inspector)
{
return inspector.areNumeric(left, right) && inspector.canVectorize(left, right);
return inspector.canVectorize(left, right);
}

@Override
Expand Down Expand Up @@ -185,7 +185,7 @@ public ExprType getOutputType(InputBindingInspector inspector)
@Override
public boolean canVectorize(InputBindingInspector inspector)
{
return inspector.areNumeric(left, right) && inspector.canVectorize(left, right);
return inspector.canVectorize(left, right);
}

@Override
Expand Down Expand Up @@ -241,7 +241,7 @@ public ExprType getOutputType(InputBindingInspector inspector)
@Override
public boolean canVectorize(InputBindingInspector inspector)
{
return inspector.areNumeric(left, right) && inspector.canVectorize(left, right);
return inspector.canVectorize(left, right);
}

@Override
Expand Down Expand Up @@ -296,7 +296,7 @@ public ExprType getOutputType(InputBindingInspector inspector)
@Override
public boolean canVectorize(InputBindingInspector inspector)
{
return inspector.areNumeric(left, right) && inspector.canVectorize(left, right);
return inspector.canVectorize(left, right);
}

@Override
Expand Down Expand Up @@ -351,7 +351,7 @@ public ExprType getOutputType(InputBindingInspector inspector)
@Override
public boolean canVectorize(InputBindingInspector inspector)
{
return inspector.areNumeric(left, right) && inspector.canVectorize(left, right);
return inspector.canVectorize(left, right);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,6 @@ public BindingAnalysis analyzeInputs()
@Override
public ExprType getOutputType(InputBindingInspector inspector)
{
if (left.isNullLiteral()) {
return right.getOutputType(inspector);
}
if (right.isNullLiteral()) {
return left.getOutputType(inspector);
}
return ExprTypeConversion.operator(left.getOutputType(inspector), right.getOutputType(inspector));
}

Expand Down
Loading