Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Fix #46 #71

Closed
Closed

Conversation

zhongnansu
Copy link
Member

@zhongnansu zhongnansu commented Jun 5, 2019

Issue #46 :
Testing: Passed gradle build
Description of changes:
Made minimal change to get rid of identical mapping check when query from multi-index, but still keeping the unknown index check. Updated corresponding tests.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@zhongnansu zhongnansu changed the title Sql 46 Fix #46 Jun 5, 2019
@@ -210,12 +210,8 @@ public boolean isValidIdentifierForTerm(SQLIdentifierExpr expr) {
);
}

public boolean hasIdenticalMappings(TermFieldScope scope, Map<String, String> indexToType) {
public boolean hasUnknownIndex(TermFieldScope scope) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the definition of "unknown index"? Based on the code in this method, as well as on lines 76-77, I think the logic should be inverted.

Copy link
Member Author

@zhongnansu zhongnansu Jun 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. "unknown index" refers to index that is not existed, or can not be matched by wildcard. I modified the logic to make more sense.

@@ -102,6 +102,7 @@ public void testNonResolvingIndexPatternWithNonExistingIndex() throws IOExceptio
}

@Test
@Ignore("allow non-identical mapping when query multi-index")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer deleting the tests that are not asserting any truth anymore.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleted

@@ -210,19 +210,15 @@ public boolean isValidIdentifierForTerm(SQLIdentifierExpr expr) {
);
}

public boolean hasIdenticalMappings(TermFieldScope scope, Map<String, String> indexToType) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realized that relaxing the mapping check completely will break the functionality where mappings are used to generate Elasticsearch DSL such as WHERE = clause, GROUP BY, ORDER By etc. This is because it will make it ambiguous as to mapping from which index to be applied. Lets keep this function, but only check for mappings present as part of SELECT clause.

@zhongnansu
Copy link
Member Author

Switch to another approach.

@zhongnansu zhongnansu closed this Jun 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants