forked from prestodb/presto
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
87db58c
commit c408975
Showing
4 changed files
with
133 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -283,4 +283,19 @@ public void testRenameTable() | |
assertQuery("SELECT value FROM test_rename.tmp_rename_new_table", "SELECT 1"); | ||
assertUpdate("DROP TABLE test_rename.tmp_rename_new_table"); | ||
} | ||
|
||
@Test | ||
public void testAlterTable() | ||
{ | ||
assertUpdate("CREATE TABLE test_alter.tmp_alter_table (value bigint)"); | ||
MongoCollection<Document> collection = mongoQueryRunner.getMongoClient().getDatabase("test_alter").getCollection("tmp_alter_table"); | ||
collection.insertOne(new Document(ImmutableMap.of("value", 1))); | ||
|
||
assertUpdate("ALTER TABLE test_alter.tmp_alter_table ADD COLUMN email varchar"); | ||
collection.insertOne(new Document(ImmutableMap.of("value", 2, "email", "[email protected]"))); | ||
assertQuery("SELECT email from test_alter.tmp_alter_table WHERE email IS NOT NULL", "SELECT '[email protected]'"); | ||
assertUpdate("ALTER TABLE test_alter.tmp_alter_table RENAME COLUMN email TO email_id"); | ||
assertQuery("SELECT email_id from test_alter.tmp_alter_table WHERE email_id IS NOT NULL", "SELECT '[email protected]'"); | ||
assertUpdate("ALTER TABLE test_alter.tmp_alter_table DROP COLUMN email_id"); | ||
} | ||
} |