Skip to content

chore: remove dead code #440

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions core/src/main/java/io/substrait/expression/ExpressionCreator.java
Original file line number Diff line number Diff line change
Expand Up @@ -488,20 +488,4 @@ public static Expression cast(
.failureBehavior(failureBehavior)
.build();
}

private static ByteString padLeftIfNeeded(byte[] value, int length) {

if (length < value.length) {
throw new IllegalArgumentException(
"Byte values should either be at or below the expected length.");
}

if (length == value.length) {
return ByteString.copyFrom(value);
}

byte[] newArray = new byte[length];
System.arraycopy(value, 0, newArray, length - value.length, value.length);
return ByteString.copyFrom(newArray);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public class ExtensionCollector extends AbstractExtensionLookup {

private final BidiMap<Integer, SimpleExtension.FunctionAnchor> funcMap;
private final BidiMap<Integer, SimpleExtension.TypeAnchor> typeMap;
private final BidiMap<Integer, String> uriMap;

// start at 0 to make sure functionAnchors start with 1 according to spec
private int counter = 0;
Expand All @@ -30,7 +29,6 @@ public ExtensionCollector() {
super(new HashMap<>(), new HashMap<>());
funcMap = new BidiMap<>(functionAnchorMap);
typeMap = new BidiMap<>(typeAnchorMap);
uriMap = new BidiMap<>(new HashMap<>());
}

public int getFunctionReference(SimpleExtension.Function declaration) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ public class ImmutableExtensionLookup extends AbstractExtensionLookup {
static final org.slf4j.Logger logger =
org.slf4j.LoggerFactory.getLogger(ImmutableExtensionLookup.class);

private int counter = -1;

private ImmutableExtensionLookup(
Map<Integer, SimpleExtension.FunctionAnchor> functionMap,
Map<Integer, SimpleExtension.TypeAnchor> typeMap) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,6 @@ public static String constructKey(String name, List<Argument> arguments) {

public Util.IntRange getRange() {
// end range is exclusive so add one to size.

long optionalCount = args().stream().filter(t -> !t.required()).count();
int max =
variadic()
.map(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.substrait.relation;

import io.substrait.expression.Expression;
import io.substrait.expression.FunctionArg;
import io.substrait.expression.proto.ProtoExpressionConverter;
import io.substrait.extension.AdvancedExtension;
import io.substrait.extension.ExtensionLookup;
Expand Down Expand Up @@ -42,7 +41,6 @@
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

/** Converts from {@link io.substrait.proto.Rel} to {@link io.substrait.relation.Rel} */
public class ProtoRelConverter {
Expand Down Expand Up @@ -647,14 +645,7 @@ protected Aggregate newAggregate(AggregateRel rel) {
.build());
}
List<Aggregate.Measure> measures = new ArrayList<>(rel.getMeasuresCount());
var pF = new FunctionArg.ProtoFrom(protoExprConverter, protoTypeConverter);
for (var measure : rel.getMeasuresList()) {
var func = measure.getMeasure();
var funcDecl = lookup.getAggregateFunction(func.getFunctionReference(), extensions);
var args =
IntStream.range(0, measure.getMeasure().getArgumentsCount())
.mapToObj(i -> pF.convert(funcDecl, i, measure.getMeasure().getArguments(i)))
.collect(java.util.stream.Collectors.toList());
measures.add(
Aggregate.Measure.builder()
.function(protoAggrFuncConverter.from(measure.getMeasure()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,6 @@ protected ParameterizedType.IntegerOption i(int len) {
return ParameterizedType.IntegerOption.newBuilder().setLiteral(len).build();
}

private static ParameterizedType.IntegerOption i(String param) {
return ParameterizedType.IntegerOption.newBuilder()
.setParameter(ParameterizedType.IntegerParameter.newBuilder().setName(param))
.build();
}

public ParameterizedType varChar(ParameterizedType.IntegerOption len) {
return wrap(
ParameterizedType.ParameterizedVarChar.newBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public class TestTypeParser {
private final TypeCreator r = TypeCreator.REQUIRED;

private final TypeExpressionCreator eo = TypeExpressionCreator.REQUIRED;
private final TypeExpressionCreator en = TypeExpressionCreator.NULLABLE;
private final ParameterizedTypeCreator pr = ParameterizedTypeCreator.REQUIRED;
private final ParameterizedTypeCreator pn = ParameterizedTypeCreator.NULLABLE;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,15 +448,6 @@ private RelNode applyRemap(RelNode relNode, Rel.Remap remap) {
return relBuilder.push(relNode).project(rexList).build();
}

private void checkRexInputRefOnly(RexNode rexNode, String context, String aggName) {
if (!(rexNode instanceof RexInputRef)) {
throw new UnsupportedOperationException(
String.format(
"Compound expression %s in %s of agg function %s is not implemented yet.",
rexNode, context, aggName));
}
}

public static class Context implements VisitationContext {
public static Context newContext() {
return new Context();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,6 @@ public Rel visit(org.apache.calcite.rel.core.Correlate correlate) {
// right input of correlated-join is similar to a correlated sub-query
apply(correlate.getRight());

var joinType =
switch (correlate.getJoinType()) {
case INNER -> Join.JoinType.INNER; // corresponds to CROSS APPLY join
case LEFT -> Join.JoinType.LEFT; // corresponds to OUTER APPLY join
default -> throw new IllegalArgumentException(
"Invalid correlated join type: " + correlate.getJoinType());
};
return super.visit(correlate);
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,7 @@ public static void main(String[] args) {
return false;
}

try {
SqlOperator op = (SqlOperator) f.get(null);
return true;
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
return true;
})
.filter(f -> Modifier.isStatic(f.getModifiers()) && Modifier.isPublic(f.getModifiers()))
.collect(Collectors.toMap(Field::getName, ListSqlOperatorFunctions::toOp));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,6 @@ public LiteralConverter(TypeConverter typeConverter) {
.append(CALCITE_LOCAL_TIME_FORMATTER)
.toFormatter();

private static final DateTimeFormatter CALCITE_TIMESTAMP_WITH_ZONE_FORMATTER =
new DateTimeFormatterBuilder()
.parseCaseInsensitive()
.append(CALCITE_LOCAL_DATE_FORMATTER)
.appendLiteral(' ')
.append(CALCITE_LOCAL_TIME_FORMATTER)
.appendLiteral(' ')
.appendZoneId()
.toFormatter();

private static final ZoneOffset SYSTEM_TIMEZONE =
OffsetDateTime.now(ZoneId.systemDefault()).getOffset();

private Expression nullOf(RexLiteral literal) {
return null;
}

private static BigDecimal i(RexLiteral literal) {
return bd(literal).setScale(0, RoundingMode.HALF_UP);
}
Expand Down
Loading