malduarte commented on issue #54590:
URL: https://github.com/apache/spark/issues/54590#issuecomment-3997302897
Instead use:
- `sessionState.sqlParser.parsePlan` to get the logical plan
- `sessionState.analyzer.execute` on the plan obtained in the previous step
Example
```
scala> var plan = spark.sessionState.sqlParser.parsePlan("create table
aux.cenas as select 1 from aux.TransactionBalance")
var plan: org.apache.spark.sql.catalyst.plans.logical.LogicalPlan =
'CreateTableAsSelect unresolvedtablespec(None, optionlist(), None, None,
None, None, false), false, false
:- 'UnresolvedIdentifier [aux, cenas], false
+- 'Project [unresolvedalias(1)]
+- 'UnresolvedRelation [aux, TransactionBalance], [], false
scala> spark.sessionState.analyzer.execute(plan)
val res12: org.apache.spark.sql.catalyst.plans.logical.LogicalPlan =
CreateTableAsSelect
TableSpec(Map(),None,Map(),None,None,None,None,false,List()), false, true
:- ResolvedIdentifier org.apache.iceberg.spark.SparkCatalog@35b1104,
aux.cenas
+- Project [1 AS 1#17]
+- SubqueryAlias local.aux.TransactionBalance
+- RelationV2[PlayerId#9, OperatorId#10, MoneyType#11,
TransactionDate#12, StartDayBalance#13L, Balance#14L, Credits#15, Debits#16]
local.aux.TransactionBalance
scala> spark.catalog.tableExists("aux.cenas")
val res13: Boolean = false
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]