Import cannot be found when writing spark sql using IDEA

1. Problem performance

insert image description here
First of all, the import error is reported because the corresponding jar package is not imported, and a certain library is missing.
After finding it, you need to add the library and jar package to the current project, so that the import xxx in the code can be imported normally

Two, the solution

1. Go to apache (click here to enter directly) official website to download apache.spark

2. Open the IDEA software
and click File——>Project Structure——>Modules——>Dependencies
insert image description here
insert image description here
3. Click on the right +, select Jars or directory, select the downloaded Jar package, click OK, and then check the newly added jars package, click OK.
insert image description here
insert image description here
insert image description here

3. Effect display

insert image description here
After importing the jar package, no error is displayed:
insert image description here

Guess you like

Origin blog.csdn.net/weixin_43520450/article/details/124504947