Skip to content

Commit

Permalink
Removed () after All
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonard Wolters committed Dec 4, 2023
1 parent 1d8a397 commit 7bd012c
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 21 deletions.
8 changes: 4 additions & 4 deletions dsl/src/it/scala/com/crobox/clickhouse/dsl/JoinQueryIT.scala
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class JoinQueryIT extends DslITSpec with TableDrivenPropertyChecks {

// QUERY -- TABLE
query =
select(dsl.all())
select(dsl.all)
.from(
select(shieldId as itemId).from(OneTestTable).where(notEmpty(itemId))
)
Expand All @@ -74,7 +74,7 @@ class JoinQueryIT extends DslITSpec with TableDrivenPropertyChecks {

// QUERY -- QUERY
query =
select(dsl.all())
select(dsl.all)
.from(select(shieldId as itemId).from(OneTestTable).where(notEmpty(itemId)))
.join(joinType, select(itemId, col2).from(TwoTestTable).where(notEmpty(itemId))) using itemId
resultRows = queryExecutor.execute[StringResult](query).futureValue.rows
Expand Down Expand Up @@ -111,7 +111,7 @@ class JoinQueryIT extends DslITSpec with TableDrivenPropertyChecks {
resultRows.length shouldBe result

// QUERY -- TABLE
query = select(dsl.all())
query = select(dsl.all)
.from(select(itemId, col2).from(TwoTestTable).where(notEmpty(itemId)))
.join(joinType, ThreeTestTable)
.where(notEmpty(itemId))
Expand All @@ -120,7 +120,7 @@ class JoinQueryIT extends DslITSpec with TableDrivenPropertyChecks {
resultRows.length shouldBe result

// QUERY -- QUERY
query = select(dsl.all())
query = select(dsl.all)
.from(select(itemId, col2).from(TwoTestTable).where(notEmpty(itemId)))
.join(joinType, select(itemId, col2).from(ThreeTestTable).where(notEmpty(itemId)))
.on((itemId, "=", itemId), (col2, "<=", col2))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ trait OperationalQuery extends Query {

val selectForGroupCols = selectForGroup.toSeq.flatMap(_.columns)

val filteredSelectAll = if (selectForGroupCols.contains(all())) {
val filteredSelectAll = if (selectForGroupCols.contains(all)) {
//Only keep aliased, we already select all cols
newOrderingColumns.collect { case c: AliasedColumn[_] => c }
} else {
Expand Down
2 changes: 1 addition & 1 deletion dsl/src/main/scala/com/crobox/clickhouse/dsl/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ package object dsl extends ClickhouseColumnFunctions with QueryFactory with Quer

def raw(rawSql: String): RawColumn = RawColumn(rawSql)

def all(): All = All()
def all: All = All()

def columnCase[V](condition: TableColumn[Boolean], result: TableColumn[V]): Case[V] = Case[V](condition, result)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ package object parallel {
def recursiveCollectCols(qry: InternalQuery, cols: Seq[Column] = Seq.empty): Seq[Column] = {
val uQry = qry

val selectAll = uQry.select.toSeq.flatMap(_.columns).contains(all())
val selectAll = uQry.select.toSeq.flatMap(_.columns).contains(all)

val maybeFromCols = uQry.from match {
case Some(value: InnerFromQuery) if selectAll =>
Expand All @@ -68,7 +68,7 @@ package object parallel {
.map(origCol => RefColumn(origCol.name))
.toList
.filterNot(_.name == EmptyColumn.name)
.:+(all())
.:+(all)
.distinct

select(joinCols: _*)
Expand Down
16 changes: 8 additions & 8 deletions dsl/src/test/scala/com/crobox/clickhouse/dsl/JoinQueryTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class JoinQueryTest extends DslTestSpec with TableDrivenPropertyChecks {

it should s"QUERY - TABLE - using" in {
val query =
select(dsl.all())
select(dsl.all)
.from(
select(shieldId as itemId).from(OneTestTable).where(notEmpty(itemId))
)
Expand All @@ -57,7 +57,7 @@ class JoinQueryTest extends DslTestSpec with TableDrivenPropertyChecks {

it should s"QUERY - QUERY - using" in {
val query =
select(dsl.all())
select(dsl.all)
.from(select(shieldId as itemId).from(OneTestTable).where(notEmpty(itemId)))
.join(InnerJoin, select(itemId, col2).from(TwoTestTable).where(notEmpty(itemId))) using itemId
toSql(query.internalQuery) should matchSQL(
Expand All @@ -70,7 +70,7 @@ class JoinQueryTest extends DslTestSpec with TableDrivenPropertyChecks {
// ON --> check prefix per ON condition
it should s"QUERY - QUERY - on simple" in {
val query =
select(dsl.all())
select(dsl.all)
.from(select(shieldId as itemId).from(OneTestTable).where(notEmpty(itemId)))
.join(InnerJoin, select(itemId, col2).from(TwoTestTable).where(notEmpty(itemId))) on itemId
toSql(query.internalQuery) should matchSQL(
Expand All @@ -83,7 +83,7 @@ class JoinQueryTest extends DslTestSpec with TableDrivenPropertyChecks {
// ON --> check prefix per ON condition
it should s"QUERY - QUERY - on complex" in {
val query =
select(dsl.all())
select(dsl.all)
.from(select(shieldId as itemId).from(OneTestTable).where(notEmpty(itemId)))
.join(InnerJoin, select(itemId, col2).from(TwoTestTable).where(notEmpty(itemId))) on ((itemId, "<=", itemId))
toSql(query.internalQuery) should matchSQL(
Expand All @@ -110,9 +110,9 @@ class JoinQueryTest extends DslTestSpec with TableDrivenPropertyChecks {

it should s"triple complex join query" in {
val query =
select(dsl.all())
select(dsl.all)
.from(
select(dsl.all())
select(dsl.all)
.from(select(shieldId as itemId).from(OneTestTable).where(notEmpty(itemId)))
.join(InnerJoin, select(itemId, col2).from(TwoTestTable).where(notEmpty(itemId))) on itemId
)
Expand Down Expand Up @@ -141,9 +141,9 @@ class JoinQueryTest extends DslTestSpec with TableDrivenPropertyChecks {

it should s"triple complex join query with custom aliases" in {
val query =
select(dsl.all())
select(dsl.all)
.from(
select(dsl.all())
select(dsl.all)
.from(select(shieldId as itemId).from(OneTestTable).as("ott_alias").where(notEmpty(itemId)))
.as("1_lEfT")
.join(InnerJoin, select(itemId, col2).from(TwoTestTable).as("ttt.alias").where(notEmpty(itemId))) on itemId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class QueryMergeTest extends DslTestSpec {
val expectedUUID = UUID.randomUUID()

val left: OperationalQuery = select(itemId) from TwoTestTable where (col3 isEq "wompalama")
val right: OperationalQuery = select(CHDsl.all()) from OneTestTable where shieldId.isEq(expectedUUID)
val right: OperationalQuery = select(CHDsl.all) from OneTestTable where shieldId.isEq(expectedUUID)
val query = right.merge(left) on timestampColumn

// PURE SPECULATIVE / SQL ONLY
Expand Down Expand Up @@ -40,9 +40,9 @@ class QueryMergeTest extends DslTestSpec {

it should "recursively collect columns from right hand queries" in {
val expectedUUID = UUID.randomUUID()
val left: OperationalQuery = select(CHDsl.all()) from OneTestTable where shieldId.isEq(expectedUUID)
val right: OperationalQuery = select(CHDsl.all()) from TwoTestTable where (col3 isEq "wompalama")
val right2: OperationalQuery = select(CHDsl.all()) from ThreeTestTable where shieldId.isEq(expectedUUID)
val left: OperationalQuery = select(CHDsl.all) from OneTestTable where shieldId.isEq(expectedUUID)
val right: OperationalQuery = select(CHDsl.all) from TwoTestTable where (col3 isEq "wompalama")
val right2: OperationalQuery = select(CHDsl.all) from ThreeTestTable where shieldId.isEq(expectedUUID)
val query = right2 merge (right) on timestampColumn merge (left) on timestampColumn

// PURE SPECULATIVE / SQL ONLY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class QueryTest extends DslTestSpec {

it should "use alias in subselect" in {
val query =
select(dsl.all()).from(select(col1, shieldId).from(OneTestTable).join(InnerJoin, TwoTestTable) using shieldId)
select(dsl.all).from(select(col1, shieldId).from(OneTestTable).join(InnerJoin, TwoTestTable) using shieldId)
toSql(query.internalQuery) should matchSQL(s"""
|SELECT * FROM
|(SELECT column_1, shield_id FROM $database.captainAmerica AS L1
Expand Down

0 comments on commit 7bd012c

Please sign in to comment.