I have two tables T1 and T2.
T1 has 3 columns t1c1, t1c2, t1c3 - all are of String types.
T2 has 4 columns t2c1, t2c2, t2c3, t2c4 - all are of String types.
I'm trying to perform a join as:
SELECT T1.t1c1, T1.t1c2, T1.t1c3, T2.t2c1, T2.t2c2, T2.t2c3, T2.t2c4
FROM T1, T2
WHERE T1.t1c1 = T2.t2c1 & T1.t1c2 = T2.t2c2;
But this is throwing me an error like this:
AnalysisException: cannot resolve '(CAST(T2.t2c1 AS DOUBLE) & CAST(T1.t1c2 AS DOUBLE))' due to data type mismatch: '(CAST(T2.t2c1 AS DOUBLE) & CAST(T1.t1c2 AS DOUBLE))' requires integral type, not double;
Then I tried this one:
SELECT T1.t1c1, T1.t1c2, T1.t1c3, T2.t2c1, T2.t2c2, T2.t2c3, T2.t2c4
FROM T1, T2
WHERE CAST(T1.t1c1 AS STRING) = CAST(T2.t2c1 AS STRING) & CAST(T1.t1c2 AS STRING) = CAST(T2.t2c2 AS STRING);
Then this error comes:
AnalysisException: cannot resolve '(CAST(CAST(T2.t2c1 AS STRING) AS DOUBLE) & CAST(CAST(T1.t1c2 AS STRING) AS DOUBLE))' due to data type mismatch: '(CAST(CAST(T2.t2c1 AS STRING) AS DOUBLE) & CAST(CAST(T1.t1c2 AS STRING) AS DOUBLE))' requires integral type, not double;
I want to work with StringType. How can I resolve this problem? And why this implicit casting is happening?