mirror of https://github.com/apache/druid.git
Remove Expr.visit. (#10437)
* Remove Expr.visit. It isn't used and doesn't have tests. * Remove Visitor too.
This commit is contained in:
parent
1d6cb624f4
commit
599aacce0f
|
@ -46,14 +46,6 @@ abstract class BinaryOpExprBase implements Expr
|
||||||
this.right = right;
|
this.right = right;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visit(Visitor visitor)
|
|
||||||
{
|
|
||||||
left.visit(visitor);
|
|
||||||
right.visit(visitor);
|
|
||||||
visitor.visit(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Expr visit(Shuttle shuttle)
|
public Expr visit(Shuttle shuttle)
|
||||||
{
|
{
|
||||||
|
|
|
@ -57,12 +57,6 @@ abstract class ConstantExpr implements Expr
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visit(Visitor visitor)
|
|
||||||
{
|
|
||||||
visitor.visit(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Expr visit(Shuttle shuttle)
|
public Expr visit(Shuttle shuttle)
|
||||||
{
|
{
|
||||||
|
|
|
@ -112,12 +112,6 @@ public interface Expr
|
||||||
*/
|
*/
|
||||||
String stringify();
|
String stringify();
|
||||||
|
|
||||||
/**
|
|
||||||
* Programmatically inspect the {@link Expr} tree with a {@link Visitor}. Each {@link Expr} is responsible for
|
|
||||||
* ensuring the {@link Visitor} can visit all of its {@link Expr} children before visiting itself
|
|
||||||
*/
|
|
||||||
void visit(Visitor visitor);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Programatically rewrite the {@link Expr} tree with a {@link Shuttle}. Each {@link Expr} is responsible for
|
* Programatically rewrite the {@link Expr} tree with a {@link Shuttle}. Each {@link Expr} is responsible for
|
||||||
* ensuring the {@link Shuttle} can visit all of its {@link Expr} children, as well as updating its children
|
* ensuring the {@link Shuttle} can visit all of its {@link Expr} children, as well as updating its children
|
||||||
|
@ -252,25 +246,15 @@ public interface Expr
|
||||||
<T> T[] getObjectVector(String name);
|
<T> T[] getObjectVector(String name);
|
||||||
|
|
||||||
long[] getLongVector(String name);
|
long[] getLongVector(String name);
|
||||||
|
|
||||||
double[] getDoubleVector(String name);
|
double[] getDoubleVector(String name);
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
boolean[] getNullVector(String name);
|
boolean[] getNullVector(String name);
|
||||||
|
|
||||||
int getCurrentVectorSize();
|
int getCurrentVectorSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Mechanism to inspect an {@link Expr}, implementing a {@link Visitor} allows visiting all children of an
|
|
||||||
* {@link Expr}
|
|
||||||
*/
|
|
||||||
interface Visitor
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Provide the {@link Visitor} with an {@link Expr} to inspect
|
|
||||||
*/
|
|
||||||
void visit(Expr expr);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mechanism to rewrite an {@link Expr}, implementing a {@link Shuttle} allows visiting all children of an
|
* Mechanism to rewrite an {@link Expr}, implementing a {@link Shuttle} allows visiting all children of an
|
||||||
* {@link Expr}, and replacing them as desired.
|
* {@link Expr}, and replacing them as desired.
|
||||||
|
|
|
@ -111,13 +111,6 @@ public class ExprMacroTable
|
||||||
analyzeInputsSupplier = Suppliers.memoize(this::supplyAnalyzeInputs);
|
analyzeInputsSupplier = Suppliers.memoize(this::supplyAnalyzeInputs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visit(final Visitor visitor)
|
|
||||||
{
|
|
||||||
arg.visit(visitor);
|
|
||||||
visitor.visit(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BindingAnalysis analyzeInputs()
|
public BindingAnalysis analyzeInputs()
|
||||||
{
|
{
|
||||||
|
@ -184,15 +177,6 @@ public class ExprMacroTable
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visit(final Visitor visitor)
|
|
||||||
{
|
|
||||||
for (Expr arg : args) {
|
|
||||||
arg.visit(visitor);
|
|
||||||
}
|
|
||||||
visitor.visit(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BindingAnalysis analyzeInputs()
|
public BindingAnalysis analyzeInputs()
|
||||||
{
|
{
|
||||||
|
|
|
@ -101,13 +101,6 @@ class LambdaExpr implements Expr
|
||||||
return StringUtils.format("(%s) -> %s", ARG_JOINER.join(getIdentifiers()), expr.stringify());
|
return StringUtils.format("(%s) -> %s", ARG_JOINER.join(getIdentifiers()), expr.stringify());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visit(Visitor visitor)
|
|
||||||
{
|
|
||||||
expr.visit(visitor);
|
|
||||||
visitor.visit(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Expr visit(Shuttle shuttle)
|
public Expr visit(Shuttle shuttle)
|
||||||
{
|
{
|
||||||
|
@ -201,15 +194,6 @@ class FunctionExpr implements Expr
|
||||||
return StringUtils.format("%s(%s)", name, ARG_JOINER.join(args.stream().map(Expr::stringify).iterator()));
|
return StringUtils.format("%s(%s)", name, ARG_JOINER.join(args.stream().map(Expr::stringify).iterator()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visit(Visitor visitor)
|
|
||||||
{
|
|
||||||
for (Expr child : args) {
|
|
||||||
child.visit(visitor);
|
|
||||||
}
|
|
||||||
visitor.visit(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Expr visit(Shuttle shuttle)
|
public Expr visit(Shuttle shuttle)
|
||||||
{
|
{
|
||||||
|
@ -338,16 +322,6 @@ class ApplyFunctionExpr implements Expr
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visit(Visitor visitor)
|
|
||||||
{
|
|
||||||
lambdaExpr.visit(visitor);
|
|
||||||
for (Expr arg : argsExpr) {
|
|
||||||
arg.visit(visitor);
|
|
||||||
}
|
|
||||||
visitor.visit(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Expr visit(Shuttle shuttle)
|
public Expr visit(Shuttle shuttle)
|
||||||
{
|
{
|
||||||
|
|
|
@ -131,12 +131,6 @@ class IdentifierExpr implements Expr
|
||||||
return StringUtils.format("\"%s\"", StringEscapeUtils.escapeJava(binding));
|
return StringUtils.format("\"%s\"", StringEscapeUtils.escapeJava(binding));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visit(Visitor visitor)
|
|
||||||
{
|
|
||||||
visitor.visit(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Expr visit(Shuttle shuttle)
|
public Expr visit(Shuttle shuttle)
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,13 +45,6 @@ abstract class UnaryExpr implements Expr
|
||||||
|
|
||||||
abstract UnaryExpr copy(Expr expr);
|
abstract UnaryExpr copy(Expr expr);
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visit(Visitor visitor)
|
|
||||||
{
|
|
||||||
expr.visit(visitor);
|
|
||||||
visitor.visit(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Expr visit(Shuttle shuttle)
|
public Expr visit(Shuttle shuttle)
|
||||||
{
|
{
|
||||||
|
|
|
@ -282,14 +282,6 @@ public abstract class TrimExprMacro implements ExprMacroTable.ExprMacro
|
||||||
return StringUtils.format("%s(%s, %s)", mode.getFnName(), stringExpr.stringify(), charsExpr.stringify());
|
return StringUtils.format("%s(%s, %s)", mode.getFnName(), stringExpr.stringify(), charsExpr.stringify());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visit(final Visitor visitor)
|
|
||||||
{
|
|
||||||
stringExpr.visit(visitor);
|
|
||||||
charsExpr.visit(visitor);
|
|
||||||
visitor.visit(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Expr visit(Shuttle shuttle)
|
public Expr visit(Shuttle shuttle)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue