Hi! I'm trying to understand catalogs. I've read <...
# troubleshooting
r
Hi! I'm trying to understand catalogs. I've read Flink Catalog doc and Flink Catalog Blog (2020). They suggest that I should be able to do this:
Copy code
CREATE CATALOG hive WITH (
    'type'='hive',
[…]
);
But it doesn't work - I get an error:
Copy code
Could not find any factory for identifier 'hive' that implements 'org.apache.flink.table.factories.CatalogFactory' in the classpath.

Available factory identifiers are:

generic_in_memory
What am I missing? I'm running vanilla 1.18 out of the box
Copy code
❯ ./bin/start-cluster.sh
Starting cluster.
Starting standalonesession daemon on host asgard08.
Starting taskexecutor daemon on host asgard08.
❯ ./bin/sql-client.sh

[…]
          
    ______ _ _       _       _____  ____  _         _____ _ _            _  BETA   
   |  ____| (_)     | |     / ____|/ __ \| |       / ____| (_)          | |  
   | |__  | |_ _ __ | | __ | (___ | |  | | |      | |    | |_  ___ _ __ | |_ 
   |  __| | | | '_ \| |/ /  \___ \| |  | | |      | |    | | |/ _ \ '_ \| __|
   | |    | | | | | |   <   ____) | |__| | |____  | |____| | |  __/ | | | |_ 
   |_|    |_|_|_| |_|_|\_\ |_____/ \___\_\______|  \_____|_|_|\___|_| |_|\__|
          
        Welcome! Enter 'HELP;' to list all available commands. 'QUIT;' to exit.

Command history file path: /Users/rmoff/.flink-sql-history

Flink SQL>
m
Remind me tomorrow in case you don’t get anyone else to help you now
gratitude thank you 1
👍 1
r
have you added the hive jars to the lib folder prior to starting the sql client? I don't know for sure, but I suspect those jars contain the hive catalog implementation
r
I've not added anything. I'm just going on https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/catalogs/#hivecatalog which doesn't mention it
r
I fear the documentation is incomplete disappear
r
OK i'll give that a go. thanks.
👍 1
m
r
OK, so I added
flink-sql-connector-hive-3.1.3_2.12-1.18.0.jar
and now get a different error (which I guess is progress) 😉
Copy code
java.lang.ClassNotFoundException: org.apache.hadoop.conf.Configuration
I'm guessing I'm missing a JAR? I'm not clear about which I actually need from the docs
I found https://nightlies.apache.org/flink/flink-docs-stable/docs/dev/configuration/advanced/#hadoop-dependencies, but it doesn't seem to say what the dependencies are if I'm just trying to run SQL Client?
with a lot of trial and error I got it working with this set of JARs. As you can tell I am out of my depth here 😉 Would proceeding with just this set of JARs available be stupid; is it feasible there would be other Hadoop JARs that it needs, and I need to just resign myself to making the full Hadoop download available to sql client?
Copy code
❯ echo $HADOOP_CLASSPATH
/Users/rmoff/flink/flink-1.18.0/hadoop_lib/*
❯ ls -l hadoop_lib
total 21456
-rw-r--r--@ 1 rmoff  staff   616888 21 Feb  2022 commons-configuration2-2.1.1.jar
-rw-r--r--@ 1 rmoff  staff    62050 21 Feb  2022 commons-logging-1.1.3.jar
-rw-r--r--@ 1 rmoff  staff   104418 21 Feb  2022 hadoop-auth-3.3.2.jar
-rw-r--r--@ 1 rmoff  staff  4470210 21 Feb  2022 hadoop-common-3.3.2.jar
-rw-r--r--@ 1 rmoff  staff  1636323 21 Feb  2022 hadoop-mapreduce-client-core-3.3.2.jar
-rw-r--r--@ 1 rmoff  staff  3362359 21 Feb  2022 hadoop-shaded-guava-1.1.1.jar
-rw-r--r--@ 1 rmoff  staff   195909 21 Feb  2022 stax2-api-4.2.1.jar
-rw-r--r--@ 1 rmoff  staff   522360 21 Feb  2022 woodstox-core-5.3.0.jar
r
To answer your questions from the picture: 1. Hadoop dependencies are not the same as Hive dependencies 2. You either need the bundled hive jar or user defined dependencies (user def deps are needed if Flink doesn't provide you the right Hive version -- most people wanting to use the Hive integration will want to connect to an existing Hive setup)
Would proceeding with just this set of JARs available be stupid
No, it is required
The idea from the Flink Hive docs is indeed that you have a full Hadoop distribution locally, and
HADOOP_CLASSPATH
points to its lib folder.
r
right, but do you need the full set?
r
Yes, if you want to make sure the Hive code works in all cases. You can probably experimentally remove some jars which seem irrelevant (like hadoop-mapreduce-client-core-3.3.2.jar is probably not needed), but there's no guarantee that the Java code is dynamically trying to load some additional dependencies at runtime, and then you'll get a big error.