wangyum commented on a change in pull request #31548:
URL: https://github.com/apache/spark/pull/31548#discussion_r578182613
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/unresolved.scala
##########
@@ -136,6 +136,29 @@ case class UnresolvedTableValuedFunction(
override lazy val resolved = false
}
+/**
+ * A table-valued command, e.g.
+ * {{{
+ * select tableName from command("show tables");
Review comment:
Yes. This implementation can make these command easy to use:
1. Save result to table.
2. Query the specified column.
3. Filter / Group by / Order by the specified column.
This is the syntax of Teradata:
```sql
SELECT tbl.DatabaseName,
tbl.TableName,
SUM(spc.CurrentPerm)/1024.00 as TableSize
FROM DBC.TablesV tbl
JOIN DBC.TableSize spc
ON tbl.DatabaseName = spc.DatabaseName
AND tbl.TableName = spc.TableName
WHERE tbl.DatabaseName NOT IN ('All', 'Crashdumps', 'DBC', 'dbcmngr',
'Default', 'External_AP', 'EXTUSER', 'LockLogShredder', 'PUBLIC',
'Sys_Calendar', 'SysAdmin', 'SYSBAR', 'SYSJDBC', 'SYSLIB',
'SystemFe', 'SYSUDTLIB', 'SYSUIF', 'TD_SERVER_DB', 'TDStats',
'TD_SYSGPL', 'TD_SYSXML', 'TDMaps', 'TDPUSER', 'TDQCD',
'tdwm', 'SQLJ', 'TD_SYSFNLIB', 'SYSSPATIAL')
AND TableKind = 'T'
GROUP BY tbl.DatabaseName,
tbl.TableName
ORDER BY TableSize DESC;
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]