jackylee-ch commented on PR #11113:
URL:
https://github.com/apache/incubator-gluten/pull/11113#issuecomment-3566167713
> Because the Hive table created with Hive cli. I don't know how to add it.
@beliefer You can try to use alterTable api to change the hive table.
Here is a little example, It should work well with this pr.
```scala
spark.range(0,
10).write.mode("overwrite").parquet("file:///tmp/test_parquet")
spark.range(10, 20).write.mode("overwrite").orc("file:///tmp/test_orc")
spark.sql("create external table demo (id long) partitioned by (part
string) stored as orc location 'file:///tmp/demo'")
spark.sql("alter table demo add partition(part=2) location
'file:///tmp/test_orc'")
val table =
spark.sessionState.catalog.getTableMetadata(TableIdentifier("demo"))
val newTable = table.copy(storage =
table.storage.copy(
serde =
Some("org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe"),
inputFormat =
Some("org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat"),
outputFormat =
Some("org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat")
))
spark.sessionState.catalog.alterTable(newTable)
spark.sql("alter table demo add partition(part=1) location
'file:///tmp/test_parquet'")
spark.table("demo").show()
```
--
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]