This is an automated email from the ASF dual-hosted git repository.

cwylie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid.git


The following commit(s) were added to refs/heads/master by this push:
     new 6c71777  Add test for join on __time column (#11289)
6c71777 is described below

commit 6c7177714f9fe88c39eac6061e49d48cf38415f7
Author: Rohan Garg <[email protected]>
AuthorDate: Thu May 27 10:50:39 2021 +0530

    Add test for join on __time column (#11289)
---
 .../apache/druid/sql/calcite/CalciteQueryTest.java | 32 ++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git 
a/sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java 
b/sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java
index 48eb303..1e32e76 100644
--- a/sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java
+++ b/sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java
@@ -17491,4 +17491,36 @@ public class CalciteQueryTest extends 
BaseCalciteQueryTest
         ImmutableList.of()
     );
   }
+
+  @Test
+  public void testJoinWithTimeDimension() throws Exception
+  {
+    testQuery(
+        PLANNER_CONFIG_DEFAULT,
+        QUERY_CONTEXT_DEFAULT,
+        "SELECT count(*) FROM druid.foo t1 inner join druid.foo t2 on 
t1.__time = t2.__time",
+        CalciteTests.REGULAR_USER_AUTH_RESULT,
+        ImmutableList.of(Druids.newTimeseriesQueryBuilder()
+                               .dataSource(JoinDataSource.create(new 
TableDataSource(CalciteTests.DATASOURCE1),
+                                                                 new 
QueryDataSource(
+                                                                     
Druids.newScanQueryBuilder()
+                                                                           
.dataSource(CalciteTests.DATASOURCE1)
+                                                                           
.intervals(querySegmentSpec(Filtration.eternity()))
+                                                                           
.resultFormat(ResultFormat.RESULT_FORMAT_COMPACTED_LIST)
+                                                                           
.columns("__time")
+                                                                           
.legacy(false)
+                                                                           
.context(QUERY_CONTEXT_DEFAULT)
+                                                                           
.build()),
+                                                                 "j0.",
+                                                                 "(\"__time\" 
== \"j0.__time\")",
+                                                                 
JoinType.INNER,
+                                                                 null,
+                                                                 
ExprMacroTable.nil()))
+                               
.intervals(querySegmentSpec(Filtration.eternity()))
+                               .granularity(Granularities.ALL)
+                               .aggregators(aggregators(new 
CountAggregatorFactory("a0")))
+                               .context(QUERY_CONTEXT_DEFAULT)
+                               .build()),
+        ImmutableList.of(new Object[]{6L}));
+  }
 }

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to