@Test void sql() { when(arg1.sql(scope)).thenReturn("arg1"); OlapFunction<Integer> sut = new OlapFunction<>("bar", TypeToken.of(Integer.class), arg1); String result = sut.sql(scope); assertThat(result, is("bar(arg1) over ()")); }
String sql(Scope scope) { return String.format("%s(%s) over (%s)", functionName, argumentsSql(scope), Stream.of(partitionBySql(scope), orderBySql(scope)) .filter(StringUtils::isNotBlank) .collect(joining(" "))); }
OlapFunction { String sql(Scope scope) { return String.format("%s(%s) over (%s)", functionName, argumentsSql(scope), Stream.of(partitionBySql(scope), orderBySql(scope)) .filter(StringUtils::isNotBlank) .collect(joining(" "))); } }
OlapFunction { String sql(Scope scope) { return String.format("%s(%s) over (%s)", functionName, argumentsSql(scope), Stream.of(partitionBySql(scope), orderBySql(scope)) .filter(StringUtils::isNotBlank) .collect(joining(" "))); } OlapFunction(String functionName, TypeToken<T> type, TypedExpression<?>... arguments); }
OlapFunction { String sql(Scope scope) { return String.format("%s(%s) over (%s)", functionName, argumentsSql(scope), Stream.of(partitionBySql(scope), orderBySql(scope)) .filter(StringUtils::isNotBlank) .collect(joining(" "))); } OlapFunction(String functionName, TypeToken<T> type, TypedExpression<?>... arguments);  }
OlapFunction { String sql(Scope scope) { return String.format("%s(%s) over (%s)", functionName, argumentsSql(scope), Stream.of(partitionBySql(scope), orderBySql(scope)) .filter(StringUtils::isNotBlank) .collect(joining(" "))); } OlapFunction(String functionName, TypeToken<T> type, TypedExpression<?>... arguments);   }