Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix case sensitivity issue of MongoDB view #7546

Merged
merged 1 commit into from
Apr 25, 2021

Conversation

ebyhr
Copy link
Member

@ebyhr ebyhr commented Apr 10, 2021

Fixes #7491

@cla-bot cla-bot bot added the cla-signed label Apr 10, 2021
@ebyhr ebyhr force-pushed the mongodb-view-case-sensitivity branch from 085a9e8 to d02cc4f Compare April 17, 2021 08:04
@ebyhr ebyhr requested review from hashhar and findepi April 17, 2021 10:05
@@ -432,7 +433,7 @@ private Document getTableMetadata(SchemaTableName schemaTableName)

if (doc == null) {
if (!collectionExists(db, tableName)) {
throw new TableNotFoundException(schemaTableName);
throw new TableNotFoundException(new SchemaTableName(schemaName, tableName));
Copy link
Member

Choose a reason for hiding this comment

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

This will lowercase schemaName, tableName. Let's pass actual names (case-preserving) with some String message message

@@ -325,6 +325,34 @@ public void testCaseInsensitive()
assertUpdate("DROP TABLE testcase.testinsensitive");
}

@Test
public void testCaseInsensitiveView()
Copy link
Member

Choose a reason for hiding this comment

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

testNonLowercaseViewName

public void testCaseInsensitiveView()
{
// Case insensitive schema name
MongoCollection<Document> collection = client.getDatabase("testInsensitive").getCollection("test_collection");
Copy link
Member

Choose a reason for hiding this comment

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

testInsensitive -> eg NonLowercaseSchema

MongoCollection<Document> collection = client.getDatabase("testInsensitive").getCollection("test_collection");
collection.insertOne(new Document(ImmutableMap.of("Name", "abc", "Value", 1)));

client.getDatabase("testInsensitive").createView("test_view", "test_collection", ImmutableList.of());
Copy link
Member

Choose a reason for hiding this comment

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

test_view -> eg lowercase_view

collection = client.getDatabase("test_database").getCollection("test_collection");
collection.insertOne(new Document(ImmutableMap.of("Name", "abc", "Value", 1)));

client.getDatabase("test_database").createView("testInsensitive", "test_collection", ImmutableList.of());
Copy link
Member

Choose a reason for hiding this comment

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

testInsensitive -> eg NonLowercaseView

@ebyhr ebyhr force-pushed the mongodb-view-case-sensitivity branch from d02cc4f to 08a9a76 Compare April 24, 2021 13:26
Copy link
Member

@hashhar hashhar left a comment

Choose a reason for hiding this comment

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

LGTM % nits.

nit: Commit message can be more explicit like Fix handling/querying of non-lowercase MongoDB views.

@ebyhr ebyhr force-pushed the mongodb-view-case-sensitivity branch from 08a9a76 to 8280f46 Compare April 24, 2021 14:28
@hashhar hashhar merged commit accc294 into trinodb:master Apr 25, 2021
@hashhar hashhar mentioned this pull request Apr 25, 2021
9 tasks
@ebyhr ebyhr deleted the mongodb-view-case-sensitivity branch April 25, 2021 05:40
@martint martint added this to the 356 milestone Apr 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

mongodb select * on view returns error CommandNotSupportedOnView
4 participants