[
https://issues.apache.org/jira/browse/DRILL-4956?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15800076#comment-15800076
]
ASF GitHub Bot commented on DRILL-4956:
---------------------------------------
Github user paul-rogers commented on a diff in the pull request:
https://github.com/apache/drill/pull/666#discussion_r94704385
--- Diff:
exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/ViewHandler.java
---
@@ -49,6 +50,24 @@ public ViewHandler(SqlHandlerConfig config) {
this.context = config.getContext();
}
+ /**
+ * If view to be dropped is in default temporary workspace, checks if
it's a temporary table or not.
+ *
+ * @param schema view schema
+ * @param viewName view name to be created
+ * @return true is object to be created is temporary table, false
otherwise
+ */
+ protected boolean isTemporaryTable(AbstractSchema schema, String
viewName) {
+ if
(schema.getFullSchemaName().equals(context.getConfig().getString(ExecConstants.DEFAULT_TEMPORARY_WORKSPACE)))
{
+ String temporaryTableName =
context.getSession().findTemporaryTable(viewName);
+ if (temporaryTableName != null) {
+ Table temporaryTable = SqlHandlerUtil.getTableFromSchema(schema,
temporaryTableName);
+ return temporaryTable != null && temporaryTable.getJdbcTableType()
== Schema.TableType.TABLE;
--- End diff --
After reading this same chunk of code in multiple places, I wonder if we
can just do this:
```
enum TempTableStatus { NOT_TEMP, NEW_TEMP, EXISTING_TEMP }
class TempTableResult {
TempTableStatus status;
String resolvedName;
}
TempTableStatus resolveTempTable(List<String> name, ... ) {
...
```
That is, in one place, do the work of checking if table is temp, if it
exists in the name space, and if so, what its (internal?) name is.
> Temporary tables support
> ------------------------
>
> Key: DRILL-4956
> URL: https://issues.apache.org/jira/browse/DRILL-4956
> Project: Apache Drill
> Issue Type: Improvement
> Affects Versions: 1.8.0
> Reporter: Arina Ielchiieva
> Assignee: Arina Ielchiieva
> Labels: doc-impacting
> Fix For: Future
>
>
> Link to design doc -
> https://docs.google.com/document/d/1gSRo_w6q2WR5fPx7SsQ5IaVmJXJ6xCOJfYGyqpVOC-g/edit
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)