Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Using SparkSQL insert Paimon, the fields do not match #4731

Open
1 of 2 tasks
luowanghaoyun opened this issue Dec 17, 2024 · 4 comments
Open
1 of 2 tasks

[Bug] Using SparkSQL insert Paimon, the fields do not match #4731

luowanghaoyun opened this issue Dec 17, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@luowanghaoyun
Copy link
Contributor

luowanghaoyun commented Dec 17, 2024

Search before asking

  • I searched in the issues and found nothing similar.

Paimon version

0.9

Compute Engine

Spark 3.5

Minimal reproduce step

We have some problems when upgrading the paimon version from 0.8 to 0.9.
for example:

CREATE TABLE T (
  id BIGINT,
  a BIGINT,
  b BIGINT,
  c STRING,
  d STRING)
 TBLPROPERTIES (
  'bucket' = '1',
  'primary-key' = 'id'
)

What doesn't meet your expectations?

Problem 1

If I submit the following sql:

INSERT INTO T(id, d, c, b, a)
SELECT CAST(1 AS BIGINT) AS id, 'd' AS d, 'c' AS c, CAST(3 AS BIGINT) AS b, CAST(2 AS BIGINT) AS a
  • with Paimon-0.9: throw java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Long
  • with Paimon-0.8: sql executed successfully, the data in table is (1, 2, 3, c, d)

I guess the fields do not match.
I changed the sql to the following, select item is the same as table schema:

INSERT INTO T
SELECT CAST(2 AS BIGINT) AS id, CAST(2 AS BIGINT) AS a, CAST(3 AS BIGINT) AS b, 'c' AS c, 'd' AS d

with Paimon-0.9: sql executed successfully, the data in table is (1, 2, 3, c, d), (2, 2, 3, c, d)

Problem 2

In addition, we also found that implicit conversion is also invalid:

SET spark.sql.storeAssignmentPolicy=LEGACY;
INSERT INTO T
SELECT 3 AS id, 2 AS a, 3 AS b, 'c' AS c, 'd' AS d
  • with Paimon-0.9: throw java.lang.ClassCastException: java.lang.Int cannot be cast to java.lang.Long
  • with Paimon-0.8: sql executed successfully

Anything else?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!
@luowanghaoyun luowanghaoyun added the bug Something isn't working label Dec 17, 2024
@Zouxxyy
Copy link
Contributor

Zouxxyy commented Dec 17, 2024

@luowanghaoyun Can you try the latest 1.0-snapshot, these problems should have been fixed

@luowanghaoyun
Copy link
Contributor Author

@Zouxxyy I have tried the latest version(paimon-spark-3.5-1.0-20241218.002704-69.jar). The problems still exist. Can you check again?

@Zouxxyy
Copy link
Contributor

Zouxxyy commented Dec 21, 2024

Here my test on the master code
image

@xuzifu666
Copy link
Member

Here my test on the master code
image

+1 in my test,master is OK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants