Skip to content

refactor: removed unused loggers #435

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

Merged
merged 3 commits into from
Jul 23, 2025
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import java.util.concurrent.TimeUnit;

public class ExpressionCreator {
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ExpressionCreator.class);

private ExpressionCreator() {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import io.substrait.util.VisitationContext;

public interface ExpressionVisitor<R, C extends VisitationContext, E extends Throwable> {
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ExpressionVisitor.class);

R visit(Expression.NullLiteral expr, C context) throws E;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

@Value.Immutable
public abstract class FieldReference implements Expression {
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(FieldReference.class);

public abstract List<ReferenceSegment> segments();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@
* Converts from {@link io.substrait.proto.Expression} to {@link io.substrait.expression.Expression}
*/
public class ProtoExpressionConverter {

static final org.slf4j.Logger logger =
org.slf4j.LoggerFactory.getLogger(ProtoExpressionConverter.class);

public static final Type.Struct EMPTY_TYPE = Type.Struct.builder().nullable(false).build();

private final ExtensionLookup lookup;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
* from {@link io.substrait.plan.Plan} to {@link io.substrait.proto.Plan}
*/
public class ExtensionCollector extends AbstractExtensionLookup {
static final org.slf4j.Logger logger =
org.slf4j.LoggerFactory.getLogger(ExtensionCollector.class);

private final BidiMap<Integer, SimpleExtension.FunctionAnchor> funcMap;
private final BidiMap<Integer, SimpleExtension.TypeAnchor> typeMap;
private final BidiMap<Integer, String> uriMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
* new anchors.
*/
public class ImmutableExtensionLookup extends AbstractExtensionLookup {
static final org.slf4j.Logger logger =
org.slf4j.LoggerFactory.getLogger(ImmutableExtensionLookup.class);

private int counter = -1;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@
import java.util.stream.Stream;
import javax.annotation.Nullable;
import org.immutables.value.Value;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/** Classes used to deserialize YAML extension files. Handles functions and types. */
@Value.Enclosing
public class SimpleExtension {
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(SimpleExtension.class);
private static final Logger LOGGER = LoggerFactory.getLogger(SimpleExtension.class);

// Key for looking up URI in InjectableValues
public static final String URI_LOCATOR_KEY = "uri";
Expand Down Expand Up @@ -801,7 +803,7 @@ public static ExtensionCollection buildExtensionCollection(
.windowFunctions(allWindowFunctionVariants)
.addAllTypes(extensionSignatures.types())
.build();
logger.atDebug().log(
LOGGER.atDebug().log(
"Loaded {} aggregate functions and {} scalar functions from {}.",
collection.aggregateFunctions().size(),
collection.scalarFunctions().size(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
*/
@Value.Enclosing
public interface ParameterizedType extends TypeExpression {
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ParameterizedType.class);

static class RequiredParameterizedVisitorException extends RuntimeException {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

public class TypeExpressionCreator extends TypeCreator
implements ExtendedTypeCreator<TypeExpression, TypeExpression> {
static final org.slf4j.Logger logger =
org.slf4j.LoggerFactory.getLogger(TypeExpressionCreator.class);

public static final TypeExpressionCreator REQUIRED = new TypeExpressionCreator(false);
public static final TypeExpressionCreator NULLABLE = new TypeExpressionCreator(true);
Expand Down
2 changes: 0 additions & 2 deletions core/src/main/java/io/substrait/plan/PlanProtoConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

/** Converts from {@link io.substrait.plan.Plan} to {@link io.substrait.proto.Plan} */
public class PlanProtoConverter {
static final org.slf4j.Logger logger =
org.slf4j.LoggerFactory.getLogger(PlanProtoConverter.class);

public Plan toProto(io.substrait.plan.Plan plan) {
List<PlanRel> planRels = new ArrayList<>();
Expand Down
2 changes: 0 additions & 2 deletions core/src/main/java/io/substrait/plan/ProtoPlanConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@

/** Converts from {@link io.substrait.proto.Plan} to {@link io.substrait.plan.Plan} */
public class ProtoPlanConverter {
static final org.slf4j.Logger logger =
org.slf4j.LoggerFactory.getLogger(io.substrait.plan.ProtoPlanConverter.class);

protected final SimpleExtension.ExtensionCollection extensionCollection;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import io.substrait.type.Type;

public abstract class AbstractWriteRel extends SingleInputRel {
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(AbstractWriteRel.class);

public abstract NamedStruct getTableSchema();

Expand Down
1 change: 0 additions & 1 deletion core/src/main/java/io/substrait/relation/Aggregate.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

@Value.Immutable
public abstract class Aggregate extends SingleInputRel implements HasExtension {
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(Aggregate.class);

public abstract List<Grouping> getGroupings();

Expand Down
1 change: 0 additions & 1 deletion core/src/main/java/io/substrait/relation/BiRel.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import java.util.List;

public abstract class BiRel extends AbstractRel {
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(BiRel.class);

public abstract Rel getLeft();

Expand Down
1 change: 0 additions & 1 deletion core/src/main/java/io/substrait/relation/Expand.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
@Value.Enclosing
@Value.Immutable
public abstract class Expand extends SingleInputRel {
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(Expand.class);

public abstract List<ExpandField> getFields();

Expand Down
1 change: 0 additions & 1 deletion core/src/main/java/io/substrait/relation/Fetch.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

@Value.Immutable
public abstract class Fetch extends SingleInputRel implements HasExtension {
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(Fetch.class);

public abstract long getOffset();

Expand Down
1 change: 0 additions & 1 deletion core/src/main/java/io/substrait/relation/Filter.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

@Value.Immutable
public abstract class Filter extends SingleInputRel implements HasExtension {
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(Filter.class);

public abstract Expression getCondition();

Expand Down
2 changes: 0 additions & 2 deletions core/src/main/java/io/substrait/relation/LocalFiles.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
@Value.Immutable
public abstract class LocalFiles extends AbstractReadRel {

static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(LocalFiles.class);

public abstract List<FileOrFiles> getItems();

@Override
Expand Down
1 change: 0 additions & 1 deletion core/src/main/java/io/substrait/relation/Project.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

@Value.Immutable
public abstract class Project extends SingleInputRel implements HasExtension {
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(Project.class);

public abstract List<Expression> getExpressions();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@

/** Converts from {@link io.substrait.proto.Rel} to {@link io.substrait.relation.Rel} */
public class ProtoRelConverter {
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ProtoRelConverter.class);

protected final ExtensionLookup lookup;
protected final SimpleExtension.ExtensionCollection extensions;
Expand Down
1 change: 0 additions & 1 deletion core/src/main/java/io/substrait/relation/Sort.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

@Value.Immutable
public abstract class Sort extends SingleInputRel implements HasExtension {
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(Sort.class);

public abstract List<Expression.SortField> getSortFields();

Expand Down
1 change: 0 additions & 1 deletion core/src/main/java/io/substrait/relation/ZeroInputRel.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import java.util.List;

public abstract class ZeroInputRel extends AbstractRel {
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ZeroInputRel.class);

@Override
public final List<Rel> getInputs() {
Expand Down
1 change: 0 additions & 1 deletion core/src/main/java/io/substrait/type/Deserializers.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import java.util.function.BiFunction;

public class Deserializers {
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(Deserializers.class);

public static final StdDeserializer<ParameterizedType> PARAMETERIZED_TYPE =
new ParseDeserializer<>(ParameterizedType.class, ParseToPojo::parameterizedType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import java.util.stream.Collectors;

public class StringTypeVisitor implements TypeVisitor<String, RuntimeException> {
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(StringTypeVisitor.class);

private String n(Type type) {
return type.nullable() ? "?" : "";
Expand Down
1 change: 0 additions & 1 deletion core/src/main/java/io/substrait/type/Type.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

@Value.Enclosing
public interface Type extends TypeExpression, ParameterizedType, NullableType, FunctionArg {
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(Type.class);

public static TypeCreator withNullability(boolean nullable) {
return nullable ? TypeCreator.NULLABLE : TypeCreator.REQUIRED;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import java.util.List;

public class TypeExpressionEvaluator {
static final org.slf4j.Logger logger =
org.slf4j.LoggerFactory.getLogger(TypeExpressionEvaluator.class);

public static Type evaluateExpression(
TypeExpression returnExpression,
Expand Down
6 changes: 4 additions & 2 deletions core/src/main/java/io/substrait/type/YamlRead.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class YamlRead {
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(YamlRead.class);
private static final Logger LOGGER = LoggerFactory.getLogger(YamlRead.class);

private static final List<String> FUNCTIONS =
Collections.unmodifiableList(
Expand Down Expand Up @@ -56,7 +58,7 @@ private static Stream<SimpleExtension.Function> parse(String name) {
.registerModule(Deserializers.MODULE);
var doc = mapper.readValue(new File(name), SimpleExtension.ExtensionSignatures.class);

logger.atDebug().log(
LOGGER.atDebug().log(
"Parsed {} functions in file {}.",
Optional.ofNullable(doc.scalars()).map(List::size).orElse(0)
+ Optional.ofNullable(doc.aggregates()).map(List::size).orElse(0),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import org.antlr.v4.runtime.tree.RuleNode;

class ThrowVisitor<T> extends SubstraitTypeBaseVisitor<T> {
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ThrowVisitor.class);

@Override
public T visitChildren(final RuleNode node) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import org.antlr.v4.runtime.Recognizer;

public class TypeStringParser {
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TypeStringParser.class);

private TypeStringParser() {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

abstract class BaseProtoConverter<T, I>
extends TypeExpressionVisitor.TypeExpressionThrowsVisitor<T, RuntimeException> {
static final org.slf4j.Logger logger =
org.slf4j.LoggerFactory.getLogger(BaseProtoConverter.class);

protected final ExtensionCollector extensionCollector;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

public class ParameterizedProtoConverter
extends BaseProtoConverter<ParameterizedType, ParameterizedType.IntegerOption> {
static final org.slf4j.Logger logger =
org.slf4j.LoggerFactory.getLogger(ParameterizedProtoConverter.class);

public ParameterizedProtoConverter(ExtensionCollector extensionCollector) {
super(extensionCollector, "Parameterized types cannot include return type expressions.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

public class TypeExpressionProtoVisitor
extends BaseProtoConverter<DerivationExpression, DerivationExpression> {
static final org.slf4j.Logger logger =
org.slf4j.LoggerFactory.getLogger(TypeExpressionProtoVisitor.class);

public TypeExpressionProtoVisitor(ExtensionCollector extensionCollector) {
super(extensionCollector, "Unexpected expression type. This shouldn't happen.");
Expand Down
1 change: 0 additions & 1 deletion core/src/main/java/io/substrait/util/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import java.util.function.Supplier;

public class Util {
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(Util.class);

public static <T> Supplier<T> memoize(Supplier<T> supplier) {
return new Memoizer<T>(supplier);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import org.junit.jupiter.api.Test;

public class TestTypeParser {
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TestTypeParser.class);

private final TypeCreator n = TypeCreator.NULLABLE;
private final TypeCreator r = TypeCreator.REQUIRED;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@
@Value.Enclosing
public class SubstraitRelVisitor extends RelNodeVisitor<Rel, RuntimeException> {

static final org.slf4j.Logger logger =
org.slf4j.LoggerFactory.getLogger(SubstraitRelVisitor.class);
private static final FeatureBoard FEATURES_DEFAULT = ImmutableFeatureBoard.builder().build();
private static final Expression.BoolLiteral TRUE = ExpressionCreator.bool(false, true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import org.apache.calcite.sql.type.SqlTypeName;

public class TypeConverter {
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TypeConverter.class);

private final UserTypeMapper userTypeMapper;

// DEFAULT TypeConverter which does not handle user-defined types
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import org.apache.calcite.sql.SqlKind;

public class CallConverters {
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(CallConverters.class);

public static Function<TypeConverter, SimpleCallConverter> CAST =
typeConverter ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
import java.util.function.Function;
import org.apache.calcite.rex.*;
import org.apache.calcite.sql.SqlKind;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/** Converts field selections from Calcite representation. */
public class FieldSelectionConverter implements CallConverter {
static final org.slf4j.Logger logger =
org.slf4j.LoggerFactory.getLogger(FieldSelectionConverter.class);
private static final Logger LOGGER = LoggerFactory.getLogger(FieldSelectionConverter.class);

private final TypeConverter typeConverter;

public FieldSelectionConverter(TypeConverter typeConverter) {
Expand All @@ -32,7 +34,7 @@ public Optional<Expression> convert(
var reference = call.getOperands().get(1);

if (reference.getKind() != SqlKind.LITERAL || !(reference instanceof RexLiteral)) {
logger
LOGGER
.atWarn()
.log(
"Found item operator without literal kind/type. This isn't handled well. Reference was {} with toString {}.",
Expand Down Expand Up @@ -101,13 +103,13 @@ private Optional<Integer> toInt(Expression.Literal l) {
} else if (l instanceof Expression.I64Literal i64) {
return Optional.of((int) i64.value());
}
logger.atWarn().log("Literal expected to be int type but was not. {}.", l);
LOGGER.atWarn().log("Literal expected to be int type but was not. {}.", l);
return Optional.empty();
}

public Optional<String> toString(Expression.Literal l) {
if (!(l instanceof Expression.FixedCharLiteral)) {
logger.atWarn().log("Literal expected to be char type but was not. {}", l);
LOGGER.atWarn().log("Literal expected to be char type but was not. {}", l);
return Optional.empty();
}

Expand Down
Loading
Loading