@Override public String getDisplayName() { return signature.toString(); }
@Override public String toString() { if (fieldName.isPresent()) { return format("%s %s", fieldName.get(), typeSignature); } return typeSignature.toString(); }
public static String generateAggregationName(String baseName, TypeSignature outputType, List<TypeSignature> inputTypes) { StringBuilder sb = new StringBuilder(); sb.append(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, outputType.toString())); for (TypeSignature inputType : inputTypes) { sb.append(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, inputType.toString())); } sb.append(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, baseName.toLowerCase(ENGLISH))); return sb.toString(); }
@Override protected String formatOneLine() { return type.getTypeSignature().toString(); }
@Override public String toString() { if (hasDependency) { return super.toString(); } return getTypeSignature().toString(); } }
private static String getTypeString(TpchColumn<?> column) { return getPrestoType(column).getTypeSignature().toString(); } }
private static void assertRowSignature( String typeName, Set<String> literalParameters, TypeSignature expectedSignature) { TypeSignature signature = parseTypeSignature(typeName, literalParameters); assertEquals(signature, expectedSignature); assertEquals(signature.toString(), typeName); }
@Override public BytecodeNode getBytecode(MethodGenerationContext generationContext) { return InvokeInstruction.invokeDynamic(type.getTypeSignature().toString().replaceAll("\\W+", "_"), binding.getType(), bootstrapMethod, binding.getBindingId()); }
@Override public String getDisplayName() { if (length == UNBOUNDED_LENGTH) { return getTypeSignature().getBase(); } return getTypeSignature().toString(); }
@Override protected List<String> getFunctionParameterTypes() { return ImmutableList.of(SHORT_DECIMAL.getTypeSignature().toString()); } }
public Document getDocument() { return new Document().append("name", name) .append("type", type.getTypeSignature().toString()) .append("hidden", hidden); }
@Override protected List<String> getFunctionParameterTypes() { return ImmutableList.of(LONG_DECIMAL.getTypeSignature().toString()); } }
@Override public Set<ColumnStatisticType> getSupportedColumnStatistics(Type type) { return loadValue(supportedColumnStatisticsCache, type.getTypeSignature().toString(), () -> delegate.getSupportedColumnStatistics(type)); }
@Override protected List<String> getFunctionParameterTypes() { return ImmutableList.of(LONG_DECIMAL.getTypeSignature().toString()); } }
private static void assertThat(String typeSignature, BoundVariables boundVariables, String expectedTypeSignature) { assertEquals( SignatureBinder.applyBoundVariables(parseTypeSignature(typeSignature, ImmutableSet.of("p", "s")), boundVariables).toString(), expectedTypeSignature); }
@Override protected List<String> getFunctionParameterTypes() { return ImmutableList.of(DecimalType.createDecimalType(MAX_SHORT_PRECISION + 1, 2).getTypeSignature().toString()); } }
@Override protected List<String> getFunctionParameterTypes() { return ImmutableList.of(DecimalType.createDecimalType(MAX_SHORT_PRECISION + 1, 2).getTypeSignature().toString()); } }
private static Expression createFailureFunction(RuntimeException exception, Type type) { requireNonNull(exception, "Exception is null"); String failureInfo = JsonCodec.jsonCodec(FailureInfo.class).toJson(Failures.toFailure(exception).toFailureInfo()); FunctionCall jsonParse = new FunctionCall(QualifiedName.of("json_parse"), ImmutableList.of(new StringLiteral(failureInfo))); FunctionCall failureFunction = new FunctionCall(QualifiedName.of("fail"), ImmutableList.of(jsonParse)); return new Cast(failureFunction, type.getTypeSignature().toString()); }
@Test public void testVarchar() { assertEquals(VARCHAR.getTypeSignature().toString(), "varchar"); assertEquals(createVarcharType(42).getTypeSignature().toString(), "varchar(42)"); assertEquals(parseTypeSignature("varchar"), createUnboundedVarcharType().getTypeSignature()); assertEquals(createUnboundedVarcharType().getTypeSignature(), parseTypeSignature("varchar")); assertEquals(parseTypeSignature("varchar").hashCode(), createUnboundedVarcharType().getTypeSignature().hashCode()); assertNotEquals(createUnboundedVarcharType().getTypeSignature(), parseTypeSignature("varchar(10)")); }
private static IfExpression createIfExpression(Expression left, Expression right, ComparisonExpression.Operator operator, Expression result, Type trueValueType) { return new IfExpression( new ComparisonExpression(operator, left, right), result, new Cast(new NullLiteral(), trueValueType.getTypeSignature().toString())); } }