【问题标题】:parquet to hyper conversion using pyspark使用 pyspark 将 parquet 转换为超级转换
【发布时间】:2022-09-25 11:17:33
【问题描述】:
标签:
python
pyspark
parquet
【解决方案1】:
如果您不想在从 parquet 文件创建 .hyper 文件时定义模式,您可以使用 CREATE TABLE 命令而不是 COPY 命令。
要使用CREATE TABLE 命令,您可以像这样跳过架构和表定义:
# Start the Hyper process.
with HyperProcess(telemetry=Telemetry.SEND_USAGE_DATA_TO_TABLEAU) as hyper:
# Open a connection to the Hyper process. This will also create the new Hyper file.
# The `CREATE_AND_REPLACE` mode causes the file to be replaced if it
# already exists.
with Connection(endpoint=hyper.endpoint,
database=hyper_database_path,
create_mode=CreateMode.CREATE_AND_REPLACE) as connection:
connection.execute_command("CREATE TABLE products AS (SELECT * FROM external('products.parquet'))")