Skip to content

Commit 2f5fad9

Browse files
committed
[CALCITE-2115] Remove not generated mongo doc, and remove useless test
1 parent 802fce3 commit 2f5fad9

File tree

2 files changed

+7
-56
lines changed

2 files changed

+7
-56
lines changed

mongodb/src/test/java/org/apache/calcite/adapter/mongodb/MongoAdapterTest.java

Lines changed: 7 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -284,37 +284,6 @@ private CalciteAssert.AssertThat assertModel(URL url) {
284284
"CITY=LAWTON; LONGITUDE=null; LATITUDE=null; POP=45542; STATE=OK; ID=73505");
285285
}
286286

287-
@Disabled("broken; [CALCITE-2115] is logged to fix it")
288-
@Test void testUnionPlan() {
289-
assertModel(MODEL)
290-
.query("select * from \"sales_fact_1997\"\n"
291-
+ "union all\n"
292-
+ "select * from \"sales_fact_1998\"")
293-
.explainContains("PLAN=EnumerableUnion(all=[true])\n"
294-
+ " MongoToEnumerableConverter\n"
295-
+ " MongoProject(product_id=[CAST(ITEM($0, 'product_id')):DOUBLE])\n"
296-
+ " MongoTableScan(table=[[_foodmart, sales_fact_1997]])\n"
297-
+ " MongoToEnumerableConverter\n"
298-
+ " MongoProject(product_id=[CAST(ITEM($0, 'product_id')):DOUBLE])\n"
299-
+ " MongoTableScan(table=[[_foodmart, sales_fact_1998]])")
300-
.limit(2)
301-
.returns(
302-
MongoAssertions.checkResultUnordered(
303-
"product_id=337", "product_id=1512"));
304-
}
305-
306-
@Disabled(
307-
"java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Double")
308-
@Test void testFilterUnionPlan() {
309-
assertModel(MODEL)
310-
.query("select * from (\n"
311-
+ " select * from \"sales_fact_1997\"\n"
312-
+ " union all\n"
313-
+ " select * from \"sales_fact_1998\")\n"
314-
+ "where \"product_id\" = 1")
315-
.runs();
316-
}
317-
318287
/**
319288
* Tests that mongo query is empty when filter simplified to false.
320289
*/
@@ -584,13 +553,12 @@ private CalciteAssert.AssertThat assertModel(URL url) {
584553
"{$project: {C: 1, STATE: 1, CITY: 1}}"));
585554
}
586555

587-
@Disabled("broken; [CALCITE-2115] is logged to fix it")
588556
@Test void testDistinctCount() {
589557
assertModel(MODEL)
590558
.query("select state, count(distinct city) as cdc from zips\n"
591559
+ "where state in ('CA', 'TX') group by state order by state")
592-
.returns("STATE=CA; CDC=1072\n"
593-
+ "STATE=TX; CDC=1233\n")
560+
.returns("STATE=CA; CDC=3\n"
561+
+ "STATE=TX; CDC=3\n")
594562
.queryContains(
595563
mongoChecker(
596564
"{\n"
@@ -605,12 +573,7 @@ private CalciteAssert.AssertThat assertModel(URL url) {
605573
+ " ]\n"
606574
+ " }\n"
607575
+ "}",
608-
"{$project: {CITY: '$city', STATE: '$state'}}",
609-
"{$group: {_id: {CITY: '$CITY', STATE: '$STATE'}}}",
610-
"{$project: {_id: 0, CITY: '$_id.CITY', STATE: '$_id.STATE'}}",
611-
"{$group: {_id: '$STATE', CDC: {$sum: {$cond: [ {$eq: ['CITY', null]}, 0, 1]}}}}",
612-
"{$project: {STATE: '$_id', CDC: '$CDC'}}",
613-
"{$sort: {STATE: 1}}"));
576+
"{$project: {STATE: '$state', CITY: '$city'}}"));
614577
}
615578

616579
@Test void testDistinctCountOrderBy() {
@@ -636,18 +599,16 @@ private CalciteAssert.AssertThat assertModel(URL url) {
636599
"{$limit: 5}"));
637600
}
638601

639-
@Disabled("broken; [CALCITE-2115] is logged to fix it")
640602
@Test void testProject() {
641603
assertModel(MODEL)
642604
.query("select state, city, 0 as zero from zips order by state, city")
643605
.limit(2)
644-
.returns("STATE=AK; CITY=AKHIOK; ZERO=0\n"
645-
+ "STATE=AK; CITY=AKIACHAK; ZERO=0\n")
606+
.returns("STATE=AK; CITY=ANCHORAGE; ZERO=0\n"
607+
+ "STATE=AK; CITY=FAIRBANKS; ZERO=0\n")
646608
.queryContains(
647609
mongoChecker(
648-
"{$project: {CITY: '$city', STATE: '$state'}}",
649-
"{$sort: {STATE: 1, CITY: 1}}",
650-
"{$project: {STATE: 1, CITY: 1, ZERO: {$literal: 0}}}"));
610+
"{$project: {STATE: '$state', CITY: '$city', 'ZERO': {$literal: 0}}}",
611+
"{$sort: {STATE: 1, CITY: 1}}"));
651612
}
652613

653614
@Test void testFilter() {

mongodb/src/test/resources/mongo-model.json

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,6 @@
4444
"type": "view",
4545
"sql": "select cast(_MAP['city'] AS varchar(20)) AS city,\n cast(_MAP['loc'][0] AS float) AS longitude, cast(_MAP['loc'][1] AS float) AS latitude, cast(_MAP['pop'] AS integer) AS pop, cast(_MAP['state'] AS varchar(2)) AS state, cast(_MAP['_id'] AS varchar(5)) AS id from \"mongo_raw\".\"zips\""
4646
},
47-
{
48-
"name": "sales_fact_1997",
49-
"type": "view",
50-
"sql": "select cast(_MAP['product_id'] AS double) AS \"product_id\" from \"_foodmart\".\"sales_fact_1997\""
51-
},
52-
{
53-
"name": "sales_fact_1998",
54-
"type": "view",
55-
"sql": "select cast(_MAP['product_id'] AS double) AS \"product_id\" from \"_foodmart\".\"sales_fact_1998\""
56-
},
5747
{
5848
"name": "store",
5949
"type": "view",

0 commit comments

Comments
 (0)