Skip to content

Commit 107ea48

Browse files
skyelvesfacebook-github-bot
authored andcommitted
feat: Remove index table existence check (#27509)
Summary: Remove index table existence check ## Release Notes ``` == NO RELEASE NOTE == ``` Differential Revision: D99565855
1 parent fc36697 commit 107ea48

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

presto-main-base/src/main/java/com/facebook/presto/sql/analyzer/StatementAnalyzer.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,9 +1161,6 @@ protected Scope visitCreateVectorIndex(CreateVectorIndex node, Optional<Scope> s
11611161
}
11621162

11631163
QualifiedObjectName targetTable = createQualifiedObjectName(session, node, node.getIndexName(), metadata);
1164-
if (metadataResolver.tableExists(targetTable)) {
1165-
throw new SemanticException(TABLE_ALREADY_EXISTS, node, "Destination table '%s' already exists", targetTable);
1166-
}
11671164

11681165
// Analyze the source table to build a proper scope with typed columns
11691166
// Use AllowAllAccessControl since we check permissions separately below

presto-main-base/src/test/java/com/facebook/presto/sql/analyzer/TestAnalyzer.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@
8282
import static com.facebook.presto.sql.analyzer.SemanticErrorCode.SAMPLE_PERCENTAGE_OUT_OF_RANGE;
8383
import static com.facebook.presto.sql.analyzer.SemanticErrorCode.SCHEMA_NOT_SPECIFIED;
8484
import static com.facebook.presto.sql.analyzer.SemanticErrorCode.STANDALONE_LAMBDA;
85-
import static com.facebook.presto.sql.analyzer.SemanticErrorCode.TABLE_ALREADY_EXISTS;
8685
import static com.facebook.presto.sql.analyzer.SemanticErrorCode.TABLE_FUNCTION_COLUMN_NOT_FOUND;
8786
import static com.facebook.presto.sql.analyzer.SemanticErrorCode.TABLE_FUNCTION_DUPLICATE_RANGE_VARIABLE;
8887
import static com.facebook.presto.sql.analyzer.SemanticErrorCode.TABLE_FUNCTION_IMPLEMENTATION_ERROR;
@@ -2395,9 +2394,8 @@ public void testCreateVectorIndex()
23952394
assertFails(MISSING_TABLE, ".*Source table '.*' does not exist",
23962395
"CREATE VECTOR INDEX test_index ON nonexistent_table(a, b)");
23972396

2398-
// destination table already exists (using an existing table name as the index name)
2399-
assertFails(TABLE_ALREADY_EXISTS, ".*already exists",
2400-
"CREATE VECTOR INDEX t1 ON t2(a, b)");
2397+
// destination table already exists — allowed (connector decides how to handle)
2398+
analyze("CREATE VECTOR INDEX t1 ON t2(a, b)");
24012399

24022400
// column does not exist in source table
24032401
assertFails(MISSING_COLUMN, ".*Column 'unknown' does not exist in source table '.*'",

0 commit comments

Comments
 (0)