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(); }
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 public String getDisplayName() { return getTypeSignature().toString(); }
@Override public String toString() { if (hasDependency) { return super.toString(); } return getTypeSignature().toString(); } }
public static String serializeColumnTypes(List<Type> columnTypes) { return LIST_CODEC.toJson(columnTypes.stream() .map(type -> type.getTypeSignature().toString()) .collect(toList())); } }
private static String getTypeString(TpchColumn<?> column) { return getPrestoType(column).getTypeSignature().toString(); } }
private static Column createColumn(String name, Type type) { TypeSignature signature = type.getTypeSignature(); return new Column(name, signature.toString(), toClientTypeSignature(signature)); }
@Override protected List<String> getFunctionParameterTypes() { return ImmutableList.of(SHORT_DECIMAL.getTypeSignature().toString()); } }
@Override protected List<String> getFunctionParameterTypes() { return ImmutableList.of(SHORT_DECIMAL.getTypeSignature().toString()); } }
@Override public Set<ColumnStatisticType> getSupportedColumnStatistics(Type type) { return loadValue(supportedColumnStatisticsCache, type.getTypeSignature().toString(), () -> delegate.getSupportedColumnStatistics(type)); }
private static void assertRowSignature( String typeName, Set<String> literalParameters, TypeSignature expectedSignature) { TypeSignature signature = parseTypeSignature(typeName, literalParameters); assertEquals(signature, expectedSignature); assertEquals(signature.toString(), typeName); }
@Override protected List<String> getFunctionParameterTypes() { return ImmutableList.of(SHORT_DECIMAL.getTypeSignature().toString()); } }
@Override protected List<String> getFunctionParameterTypes() { return ImmutableList.of(LONG_DECIMAL.getTypeSignature().toString()); } }
@Override public BytecodeNode getBytecode(MethodGenerationContext generationContext) { return InvokeInstruction.invokeDynamic(type.getTypeSignature().toString().replaceAll("\\W+", "_"), binding.getType(), bootstrapMethod, binding.getBindingId()); }
private void assertQueryResult(String type, Object data, Object expected) { TypeSignature signature = parseTypeSignature(type); List<List<Object>> rows = newArrayList(fixData( ImmutableList.of(new Column("test", signature.toString(), toClientTypeSignature(signature))), ImmutableList.of(ImmutableList.of(data)))); assertEquals(rows.size(), 1); assertEquals(rows.get(0).size(), 1); assertEquals(rows.get(0).get(0), expected); }
@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()); } }
@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())); } }
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())); } }