-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into refactoring/69_update_documentation
- Loading branch information
Showing
15 changed files
with
130 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 1 addition & 3 deletions
4
src/main/java/com/exasol/sql/expression/BooleanExpression.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/main/java/com/exasol/sql/expression/function/exasol/ExasolAggregateFunction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.exasol.sql.expression.function.exasol; | ||
|
||
import com.exasol.sql.expression.function.FunctionName; | ||
|
||
/** | ||
* This class is a list of Aggregate Functions that the Exasol database supports. | ||
* | ||
* <p> | ||
* Currently unsupported functions: GROUPING, PERCENTILE_CONT, PERCENTILE_DISC, OVER clause for all aggregate functions | ||
* and keywords. See {@link <a href="https://github.com/exasol/sql-statement-builder/issues/72"> github issue # 72</a>} | ||
* </p> | ||
*/ | ||
public enum ExasolAggregateFunction implements FunctionName { | ||
APPROXIMATE_COUNT_DISTINCT, AVG, CORR, COUNT, COVAR_POP, COVAR_SAMP, FIRST_VALUE, GROUP_CONCAT, LAST_VALUE, MAX, | ||
MEDIAN, MIN, REGR_SLOPE, REGR_INTERCEPT, REGR_COUNT, REGR_R2, REGR_AVGX, REGR_AVGY, REGR_SXX, REGR_SXY, REGR_SYY, | ||
STDDEV, STDDEV_POP, STDDEV_SAMP, SUM, VAR_POP, VAR_SAMP, VARIANCE; | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/com/exasol/sql/expression/function/exasol/ExasolAnalyticFunctions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.exasol.sql.expression.function.exasol; | ||
|
||
import com.exasol.sql.expression.function.FunctionName; | ||
|
||
/** | ||
* This class is a list of Analytic Functions that the Exasol database supports. | ||
* <p> | ||
* This class covers functions that are not in the {@link ExasolAggregateFunction} list. | ||
* </p> | ||
* <p> | ||
* Currently unsupported functions: CUME_DIST, DENSE_RANK, LAG, LEAD, NTH_VALUE, NTILE, NAMED WINDOW CLAUSE, | ||
* PERCENT_RANK, PERCENTILE_CONT, PERCENTILE_DISC, RANK, RATIO_TO_REPORT, ROW_NUMBER, OVER clause for all analytic | ||
* functions, functions' prefixes that goes after parenthesis. | ||
* </p> | ||
*/ | ||
public enum ExasolAnalyticFunctions implements FunctionName { | ||
ANY, EVERY, LISTAGG | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/test/java/com/exasol/sql/expression/function/exasol/ExasolAggregateFunctionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.exasol.sql.expression.function.exasol; | ||
|
||
import static com.exasol.hamcrest.SqlFragmentRenderResultMatcher.rendersTo; | ||
import static com.exasol.sql.expression.ExpressionTerm.column; | ||
import static com.exasol.sql.expression.ExpressionTerm.integerLiteral; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import com.exasol.sql.StatementFactory; | ||
import com.exasol.sql.dql.select.Select; | ||
import com.exasol.sql.expression.BooleanTerm; | ||
|
||
public class ExasolAggregateFunctionTest { | ||
@Test | ||
void testAggregateFunctionCoalesce() { | ||
final Select select = StatementFactory.getInstance().select() // | ||
.function(ExasolAggregateFunction.APPROXIMATE_COUNT_DISTINCT, "COUNT_APPR", column("customer_id")); | ||
select.from().table("orders"); | ||
select.where(BooleanTerm.gt(column("price"), integerLiteral(1000))); | ||
assertThat(select, | ||
rendersTo("SELECT APPROXIMATE_COUNT_DISTINCT(customer_id) COUNT_APPR FROM orders WHERE price > 1000")); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/test/java/com/exasol/sql/expression/function/exasol/ExasolAnalyticFunctionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.exasol.sql.expression.function.exasol; | ||
|
||
import static com.exasol.hamcrest.SqlFragmentRenderResultMatcher.rendersTo; | ||
import static com.exasol.sql.expression.ExpressionTerm.column; | ||
import static com.exasol.sql.expression.ExpressionTerm.integerLiteral; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import com.exasol.sql.StatementFactory; | ||
import com.exasol.sql.dql.select.Select; | ||
import com.exasol.sql.expression.BooleanTerm; | ||
|
||
public class ExasolAnalyticFunctionTest { | ||
@Test | ||
void testAggregateFunctionCoalesce() { | ||
final Select select = StatementFactory.getInstance().select() // | ||
.field("department") // | ||
.function(ExasolAnalyticFunctions.ANY, " ANY_ ", BooleanTerm.lt(column("age"), integerLiteral(30))); | ||
select.from().table("employee_table"); | ||
select.groupBy(column("department")); | ||
assertThat(select, | ||
rendersTo("SELECT department, ANY((age < 30)) ANY_ FROM employee_table GROUP BY department")); | ||
} | ||
} |
Oops, something went wrong.