In this article we will learn about some of the frequently asked TypeScript programming questions in technical like “IN/EXISTS predicate sub-queries can only be used in a Filter:” Code Answer. When creating scripts and web applications, error handling is an important part. If your code lacks error checking code, your program may look very unprofessional and you may be open to security risks. Error or stack handling on typescript was simple and easy. An error message with filename, line number and a message describing the error is sent to the browser. This tutorial contains some of the most common error checking methods in Typescript. Below are some solution about “IN/EXISTS predicate sub-queries can only be used in a Filter:” Code Answer.
IN/EXISTS predicate sub-queries can only be used in a Filter:
xxxxxxxxxx
1
import sparkSession.implicits._
2
3
Seq("france").toDF("country").createOrReplaceTempView("countries")
4
Seq(("user1", "france"), ("user2", "italy"), ("user2", "usa"))
5
.toDF("user", "country").createOrReplaceTempView("users")
6
7
val query =
8
s"""
9
|SELECT
10
| CASE
11
| WHEN u.country = 'italy' THEN 'Italy'
12
| ELSE (
13
| CASE
14
| WHEN u.country = c.country THEN upper(u.country)
15
| ELSE u.country
16
| END
17
| ) END AS country
18
|FROM users u
19
|LEFT JOIN countries c
20
| ON u.country = c.country
21
""".stripMargin
22
sparkSession.sql(query).show()
23