Skip to content

Commit

Permalink
Remove hand-rolled type signature parser
Browse files Browse the repository at this point in the history
  • Loading branch information
martint committed Jun 1, 2020
1 parent f1b8c60 commit fca04a2
Show file tree
Hide file tree
Showing 21 changed files with 95 additions and 341 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableSet;
import io.prestosql.operator.TypeSignatureParser;
import io.prestosql.spi.type.TypeSignature;
import io.prestosql.sql.analyzer.TypeSignatureTranslator;
import io.prestosql.sql.tree.QualifiedName;

import java.util.ArrayList;
Expand Down Expand Up @@ -94,9 +94,9 @@ private static Signature decodeSimpleSignature(String encodedSignature)
List<String> parts = Splitter.on('|').splitToList(encodedSignature);
checkArgument(parts.size() >= 2, "Expected encoded signature to contain at least 2 parts: %s", encodedSignature);
String name = parts.get(0);
TypeSignature returnType = TypeSignatureParser.parseTypeSignature(parts.get(1), ImmutableSet.of());
TypeSignature returnType = TypeSignatureTranslator.parseTypeSignature(parts.get(1), ImmutableSet.of());
List<TypeSignature> argumentTypes = parts.subList(2, parts.size()).stream()
.map(part -> TypeSignatureParser.parseTypeSignature(part, ImmutableSet.of()))
.map(part -> TypeSignatureTranslator.parseTypeSignature(part, ImmutableSet.of()))
.collect(toImmutableList());
return new Signature(name, returnType, argumentTypes);
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
import static com.google.common.base.Preconditions.checkState;
import static com.google.common.collect.ImmutableList.toImmutableList;
import static com.google.common.collect.ImmutableSet.toImmutableSet;
import static io.prestosql.operator.TypeSignatureParser.parseTypeSignature;
import static io.prestosql.operator.aggregation.AggregationMetadata.ParameterMetadata.ParameterType.BLOCK_INDEX;
import static io.prestosql.operator.aggregation.AggregationMetadata.ParameterMetadata.ParameterType.NULLABLE_BLOCK_INPUT_CHANNEL;
import static io.prestosql.operator.aggregation.AggregationMetadata.ParameterMetadata.ParameterType.STATE;
Expand All @@ -62,6 +61,7 @@
import static io.prestosql.operator.annotations.ImplementationDependency.getImplementationDependencyAnnotation;
import static io.prestosql.operator.annotations.ImplementationDependency.isImplementationDependencyAnnotation;
import static io.prestosql.operator.annotations.ImplementationDependency.validateImplementationDependencyAnnotation;
import static io.prestosql.sql.analyzer.TypeSignatureTranslator.parseTypeSignature;
import static io.prestosql.util.Reflection.methodHandle;
import static java.util.Objects.requireNonNull;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
import static com.google.common.collect.ImmutableList.toImmutableList;
import static com.google.common.collect.ImmutableSet.toImmutableSet;
import static com.google.common.collect.ImmutableSortedSet.toImmutableSortedSet;
import static io.prestosql.operator.TypeSignatureParser.parseTypeSignature;
import static io.prestosql.operator.annotations.ImplementationDependency.isImplementationDependencyAnnotation;
import static io.prestosql.spi.function.OperatorType.EQUAL;
import static io.prestosql.spi.function.OperatorType.GREATER_THAN;
Expand All @@ -66,6 +65,7 @@
import static io.prestosql.spi.function.OperatorType.LESS_THAN_OR_EQUAL;
import static io.prestosql.spi.function.OperatorType.NOT_EQUAL;
import static io.prestosql.spi.function.OperatorType.XX_HASH_64;
import static io.prestosql.sql.analyzer.TypeSignatureTranslator.parseTypeSignature;
import static java.lang.String.CASE_INSENSITIVE_ORDER;

public final class FunctionsParserHelper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.collect.ImmutableList.toImmutableList;
import static io.prestosql.operator.TypeSignatureParser.parseTypeSignature;
import static io.prestosql.operator.annotations.FunctionsParserHelper.containsImplementationDependencyAnnotation;
import static io.prestosql.sql.analyzer.TypeSignatureTranslator.parseTypeSignature;

public interface ImplementationDependency
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.util.Objects;

import static io.prestosql.metadata.SignatureBinder.applyBoundVariables;
import static io.prestosql.operator.TypeSignatureParser.parseTypeSignature;
import static io.prestosql.sql.analyzer.TypeSignatureTranslator.parseTypeSignature;
import static java.util.Objects.requireNonNull;

public final class TypeImplementationDependency
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@

import java.lang.invoke.MethodHandle;

import static io.prestosql.operator.TypeSignatureParser.parseTypeSignature;
import static io.prestosql.operator.scalar.ScalarFunctionImplementation.ArgumentProperty.valueTypeArgumentProperty;
import static io.prestosql.operator.scalar.ScalarFunctionImplementation.NullConvention.RETURN_NULL_ON_NULL;
import static io.prestosql.spi.StandardErrorCode.INVALID_FUNCTION_ARGUMENT;
import static io.prestosql.spi.function.OperatorType.CAST;
import static io.prestosql.spi.type.Chars.padSpaces;
import static io.prestosql.sql.analyzer.TypeSignatureTranslator.parseTypeSignature;
import static io.prestosql.type.Re2JRegexpType.RE2J_REGEXP_SIGNATURE;
import static io.prestosql.util.Reflection.methodHandle;
import static java.lang.invoke.MethodHandles.insertArguments;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
import static com.google.common.collect.ImmutableList.toImmutableList;
import static com.google.common.collect.ImmutableSortedSet.toImmutableSortedSet;
import static io.prestosql.operator.ParametricFunctionHelpers.bindDependencies;
import static io.prestosql.operator.TypeSignatureParser.parseTypeSignature;
import static io.prestosql.operator.annotations.FunctionsParserHelper.containsImplementationDependencyAnnotation;
import static io.prestosql.operator.annotations.FunctionsParserHelper.containsLegacyNullable;
import static io.prestosql.operator.annotations.FunctionsParserHelper.createTypeVariableConstraints;
Expand All @@ -82,6 +81,7 @@
import static io.prestosql.operator.scalar.ScalarFunctionImplementation.NullConvention.RETURN_NULL_ON_NULL;
import static io.prestosql.operator.scalar.ScalarFunctionImplementation.NullConvention.USE_NULL_FLAG;
import static io.prestosql.spi.StandardErrorCode.FUNCTION_IMPLEMENTATION_ERROR;
import static io.prestosql.sql.analyzer.TypeSignatureTranslator.parseTypeSignature;
import static io.prestosql.util.Failures.checkCondition;
import static io.prestosql.util.Reflection.constructorMethodHandle;
import static io.prestosql.util.Reflection.methodHandle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.collect.ImmutableList.toImmutableList;
import static io.prestosql.metadata.Signature.typeVariable;
import static io.prestosql.operator.TypeSignatureParser.parseTypeSignature;
import static io.prestosql.sql.analyzer.TypeSignatureTranslator.parseTypeSignature;

public final class WindowAnnotationsParser
{
Expand Down
Loading

0 comments on commit fca04a2

Please sign in to comment.