Github user paul-rogers commented on a diff in the pull request:
https://github.com/apache/drill/pull/666#discussion_r91016062
--- Diff:
exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/WorkspaceSchemaFactory.java
---
@@ -478,10 +479,27 @@ private View getView(DotDrillFile f) throws
IOException {
return f.getView(logicalPlanPersistence);
}
+ /**
+ * Looks for table in this workspace. First check among temporary and
persistent tables.
+ * If no cached tables are found, checks if passed table name
corresponds to existing view name.
+ * If passed table name is not a view either, looks fo temporary /
persistent table name
+ * directly on file system.
+ *
+ * @param tableName original table name
+ * @return table instance of temporary / persistent table or view
+ */
@Override
public Table getTable(String tableName) {
+
+ // check temporary tables
+ String temporaryTableName =
SqlHandlerUtil.generateTemporaryTableName(tableName, schemaConfig.getUuid());
+ TableInstance temporaryTableKey = new TableInstance(new
TableSignature(temporaryTableName), ImmutableList.of());
+ if (tables.alreadyContainsKey(temporaryTableKey)) {
--- End diff --
We use the temporary table name (with uuid) as the table name in the key.
Shouldn't we use the user-defined name as the key with the internal name as
additional info? Otherwise, will the internal name "leak through" to the user
somehow? Might this somehow allow a workspace to contain both a real table Foo
and a temp table Foo_uuid?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---