name: call create_table raise java.lang.NullPointerException
about: Problems and issues with code or docs
title: ''
labels: bug
assignees: ''
Describe the bug
i use the python lib, and call create_table func then raise java.lang.NullPointerException:
Traceback (most recent call last):
File "gittb.py", line 53, in
hive_metastore_client.create_table(table)
File "/home/ec2-user/lfyang/spark-ui/jupyter/yes/lib/python3.8/site-packages/thrift_files/libraries/thrift_hive_metastore_client/ThriftHiveMetastore.py", line 2633, in create_table
self.recv_create_table()
File "/home/ec2-user/lfyang/spark-ui/jupyter/yes/lib/python3.8/site-packages/thrift_files/libraries/thrift_hive_metastore_client/ThriftHiveMetastore.py", line 2659, in recv_create_table
raise result.o3
thrift_files.libraries.thrift_hive_metastore_client.ttypes.MetaException: MetaException(message='java.lang.NullPointerException')
To Reproduce
Steps to reproduce the behavior:
- pip install hive-metastore-client
- code file createtable.py:
from hive_metastore_client import HiveMetastoreClient
from hive_metastore_client.builders import (
ColumnBuilder,
SerDeInfoBuilder,
StorageDescriptorBuilder,
TableBuilder,
)
HIVE_HOST = "xxx"
HIVE_PORT = 9083
columns = [
ColumnBuilder("id", "string", "col comment").build(),
ColumnBuilder("client_name", "string").build(),
ColumnBuilder("amount", "string").build(),
ColumnBuilder("year", "string").build(),
ColumnBuilder("month", "string").build(),
ColumnBuilder("day", "string").build(),
]
partition_keys = [
ColumnBuilder("year", "string").build(),
ColumnBuilder("month", "string").build(),
ColumnBuilder("day", "string").build(),
]
serde_info = SerDeInfoBuilder(
serialization_lib="org.apache.hadoop.hive.ql.io.orc.OrcSerde"
).build()
storage_descriptor = StorageDescriptorBuilder(
columns=columns,
location="s3a://mys3bucket/xx",
input_format="org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat",
output_format="org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat",
serde_info=serde_info,
).build()
table = TableBuilder(
table_name="test_tmp_table",
db_name="default",
owner="owner name",
storage_descriptor=storage_descriptor,
partition_keys=partition_keys,
).build()
with HiveMetastoreClient(HIVE_HOST, HIVE_PORT) as hive_metastore_client:
hive_metastore_client.create_table(table)
3. python createtable.py
4. See error
Screenshots
If applicable, add screenshots to help explain your problem.
Expected behavior
A clear and concise description of what you expected to happen.
Environment
- Python Python 3.8.5:
- Lib version:
- Hive Metastore 1.2.2:
- Other (e.g. OS):
Additional info
Add any other context about the problem here.