-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Conversation
085a9e8
to
d02cc4f
Compare
@@ -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)); |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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()); |
There was a problem hiding this comment.
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()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
testInsensitive -> eg NonLowercaseView
d02cc4f
to
08a9a76
Compare
There was a problem hiding this 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
.
plugin/trino-mongodb/src/test/java/io/trino/plugin/mongodb/TestMongoIntegrationSmokeTest.java
Show resolved
Hide resolved
08a9a76
to
8280f46
Compare
Fixes #7491