Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in inserting in Table with transaction ( Invalid method name: 'alter_table_req') #12949

Closed
alexcpn opened this issue Jun 23, 2022 · 4 comments

Comments

@alexcpn
Copy link

alexcpn commented Jun 23, 2022

Insert does not work for table created with transactional=true
Gives error Invalid method name: 'alter_table_req'

Closest related I could find - #6180

Versions

ENV HADOOP_VERSION=3.3.0
ENV METASTORE_VERSION=3.1.3
image: trinodb/trino:386

Works

trino:default> CREATE TABLE test4.employee2 (id int, name varchar, salary int)
            -> WITH (
            ->    format='ORC');
CREATE TABLE
trino:default> INSERT INTO test4.employee VALUES
            -> (1, 'Jerry', 5000),
            -> (2, 'Tom',   8000),
            -> (3, 'Kate',  6000);
Query 20220623_040943_00016_7tuyy failed: Table 'hive.test4.employee' does not exist

trino:default> INSERT INTO test4.employee2 VALUES
            -> (1, 'Jerry', 5000),
            -> (2, 'Tom',   8000),
            -> (3, 'Kate',  6000);
INSERT: 3 rows

Query 20220623_040953_00017_7tuyy, FINISHED, 3 nodes
Splits: 7 total, 7 done (100.00%)
0.33 [0 rows, 0B] [0 rows/s, 0B/s]

Does not work for table created with transactional=true

trino:default> CREATE TABLE test4.employee3 (id int, name varchar, salary int)
            -> WITH (
            ->    format='ORC',transactional=true);
CREATE TABLE
trino:default> INSERT INTO test4.employee3 VALUES
            -> (1, 'Jerry', 5000),
            -> (2, 'Tom',   8000),
            -> (3, 'Kate',  6000);
INSERT: 3 rows

Query 20220623_041225_00021_7tuyy, FAILED, 2 nodes
Splits: 8 total, 8 done (100.00%)
10.40 [0 rows, 0B] [0 rows/s, 0B/s]

Query 20220623_041225_00021_7tuyy failed: Invalid method name: 'alter_table_req'
@alexcpn alexcpn changed the title Error in inserting in Table with transaction as true Invalid method name: 'alter_table_req' Error in inserting in Table with transaction ( Invalid method name: 'alter_table_req') Jun 24, 2022
@alexcpn
Copy link
Author

alexcpn commented Jun 30, 2022

Seems that this is not supported in Presto/ Trino as of now.

From https://trino.io/blog/2020/06/01/hive-acid.html

How to use Hive ACID and transactional tables in Presto
Hive transactional tables are readable in Presto without any need to tweak configs, you only need to take care of these requirements:

Use Presto version 331 or higher
Use Hive 3 Metastore Server. Presto does not support Hive transactional tables created with Hive before version 3.

Note that Presto cannot create or write to Hive transactional tables yet. You can create and write to Hive transactional tables via Hive or via Spark with Hive ACID Data Source plugin and use Presto to read these tables._

@findepi
Copy link
Member

findepi commented Jul 19, 2022

Duplicates #7310. Let me close this one.

Note that Presto cannot create or write to Hive transactional tables yet.

I don't know about Presto, but Trino can write to Hive transactional tables.
We test with HDP 3.1, so the feature is expected to work with HDP 3.1

@findepi findepi closed this as completed Jul 19, 2022
@divyanshidm
Copy link

I am using trino to write to hive transactional table but it complains that
Query 20230206_111140_00040_xknre failed: Invalid method name: 'alter_table_req'

@hackeryang
Copy link
Member

hackeryang commented Apr 28, 2023

I am using trino to write to hive transactional table but it complains that Query 20230206_111140_00040_xknre failed: Invalid method name: 'alter_table_req'

We also encountered this error in Trino 402, then we tracked relevant source codes, and found that it was because we used transactional ACID Hive tables, and Trino is dependant on the maven project trino-hive-apache, and the source codes of this project contains this patch: trinodb/trino-hive-apache#15

The patch mentioned above needed the implementation in the Hive Metastore side, so the Trino foundation company Starburst modifed some source codes in their internal Hive project, which contains the new thrift api alter_table_req, but this api doesn't exist in Apache Hive:
https://github.com/starburstdata/hive3/blob/master/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java

It was fixed in Trino 405: #12771

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants