Skip to content

Commit

Permalink
Merge branch 'develop' into feature/capsule-object-mapper-creator
Browse files Browse the repository at this point in the history
  • Loading branch information
thoniTUB authored Aug 19, 2024
2 parents 549d1b6 + 1cbe570 commit 9587461
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.bakdata.conquery.models.query.queryplan.DateAggregationAction;
import com.bakdata.conquery.sql.conversion.NodeConverter;
import com.bakdata.conquery.sql.conversion.model.QueryStep;
import com.google.common.base.Preconditions;

public class CQNegationConverter implements NodeConverter<CQNegation> {

Expand All @@ -21,12 +20,7 @@ public ConversionContext convert(CQNegation negationNode, ConversionContext cont
.convert(negationNode.getChild(), context.withNegation(true))
.withNegation(false);

Preconditions.checkArgument(
converted.getQuerySteps().size() == 1,
"As we convert only 1 child CQElement, their should be only a single query step."
);
QueryStep queryStep = converted.getLastConvertedStep();

if (negationNode.getDateAction() != DateAggregationAction.NEGATE) {
QueryStep withBlockedValidityDate = queryStep.toBuilder()
.selects(queryStep.getSelects().blockValidityDate())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pid,datum,geschlecht
1,2012-01-01,"f"
2,2010-07-15,"m"
3,2013-11-10,"f"
4,2012-11-11,"m"
5,2007-11-11,
6,2012-11-11,
7,2012-11-11,"mf"
8,2012-11-11,"fm"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
result,dates
2,{}
4,{}
5,{}
6,{}
7,{}
8,{}
101 changes: 101 additions & 0 deletions backend/src/test/resources/tests/sql/not/with_sibling/not.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"label": "Simple negation query where NEGATION is not the first node to convert",
"type": "QUERY_TEST",
"sqlSpec": {
"isEnabled": true
},
"expectedCsv": "tests/sql/not/with_sibling/expected.csv",
"query": {
"type": "CONCEPT_QUERY",
"root": {
"type": "OR",
"children": [
{
"ids": [
"geschlecht_select"
],
"type": "CONCEPT",
"label": "Geschlecht SELECT",
"tables": [
{
"id": "geschlecht_select.geschlecht_connector",
"filters": [
{
"filter": "geschlecht_select.geschlecht_connector.geschlecht",
"type": "BIG_MULTI_SELECT",
"value": [
"m"
]
}
]
}
]
},
{
"type": "NEGATION",
"child": {
"ids": [
"geschlecht_select"
],
"type": "CONCEPT",
"label": "Geschlecht SELECT",
"tables": [
{
"id": "geschlecht_select.geschlecht_connector",
"filters": [
{
"filter": "geschlecht_select.geschlecht_connector.geschlecht",
"type": "BIG_MULTI_SELECT",
"value": [
"f"
]
}
]
}
]
}
}
]
}
},
"concepts": [
{
"label": "geschlecht_select",
"type": "TREE",
"connectors": [
{
"label": "geschlecht_connector",
"table": "table1",
"filters": {
"label": "geschlecht",
"description": "Geschlecht zur gegebenen Datumseinschränkung",
"column": "table1.geschlecht",
"type": "SELECT"
}
}
]
}
],
"content": {
"tables": [
{
"csv": "tests/sql/not/with_sibling/content.csv",
"name": "table1",
"primaryColumn": {
"name": "pid",
"type": "STRING"
},
"columns": [
{
"name": "datum",
"type": "DATE"
},
{
"name": "geschlecht",
"type": "STRING"
}
]
}
]
}
}

0 comments on commit 9587461

Please sign in to comment.