Configuring Flink SQL Client to Support SQL Verification
This topic is available for MRS 3.3.0 or later only.
Configuration Method
You can verify SQL syntax during SQL job development on the SQL Client. Running SQL commands in verification mode does not start Flink jobs.
- Verifying SQL statements
- When you run the SQL shell command, add -v or --validate to enter the verification mode.
sql-client.sh -v
- When you run the SQL shell command, you can run SET to enter or exit the verification mode.
- Enter the verification mode: SET table.validate = true;
- Exit the verification mode: SET table.validate = false;
- When you run the SQL shell command, add -v or --validate to enter the verification mode.
Submitting a Job Using the Flink SQL Client
- Install the cluster client, for example, in /opt/hadoopclient.
- Log in to the node where the client is installed as the client installation user.
- Run the following command to go to the client installation directory:
cd /opt/hadoopclient
- Run the following command to initialize environment variables:
source /opt/hadoopclient/bigdata_env
- Log in to the Flink SQL client and submit a job.
- Start a yarn-session by referring to Using the Flink Client and record the yarn-session ID (yid).
yarn-session.sh -nm "session-name"
- Run the following command to access the Flink SQL Client:
cd /opt/hadoopclient/Flink/flink/bin
./sql-client.sh
Figure 1 Accessing the Flink SQL Client
- Set high-availability.cluster-id to the yarn-session ID.
SET high-availability.cluster-id=yarn-session ID;
- Run the following SQL statement. If the execution is successful, the following information is displayed on the console.
SELECT name, COUNT(*) AS cnt FROM ( VALUES ('Bob'), ('Alice'), ('Greg'), ('Bob') ) AS NameTable(name) GROUP BY name;
Figure 2 Execute result
- View the executed job on Yarn.
Log in to FusionInsight Manager, choose Cluster > Services > Yarn > Dashboard, and click the link next to ResourceManager WebUI to go to the Yarn web UI and view the job.
Figure 3 Job
- Start a yarn-session by referring to Using the Flink Client and record the yarn-session ID (yid).
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot