Search code examples
hadoophdfsamazon-emrtrino

Cannot create table over hdfs without master ip


So, I was creating a table using over hdfs using CTAS command, as:

CREATE TABLE <catalog>.<schema>.<table_name> AS ( external_location = 'hdfs:///path' ) SELECT ... ;

This throws me an error

Failed checking path: hdfs:/path

While, if I write my query as the following, it works fine:

CREATE TABLE <catalog>.<schema>.<table_name> AS ( external_location = 'hdfs://[master_ip]/path' ) SELECT ... ;

Solution

  • If you'd like to set the filesystem used for the tables, edit the core-site.xml to include hdfs://namenode.address:port as fs.defaultFS and restart the Trino server(s).

    Only then can you exclude the host/port from the URI