You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "leaves12138 (via GitHub)" <gi...@apache.org> on 2023/05/25 08:44:47 UTC
[GitHub] [incubator-paimon] leaves12138 opened a new issue, #1233: [Docs] Insert into non-null column with nullable value
leaves12138 opened a new issue, #1233:
URL: https://github.com/apache/incubator-paimon/issues/1233
### Search before asking
- [X] I searched in the [issues](https://github.com/apache/incubator-paimon/issues) and found nothing similar.
### Motivation
In spark, insert into a non-null column (primary-key) with a nullable value will display a error:
Cannot write nullable values to non-null column 'pkey'
But we can use the nvl or coalesce to work around. We need a docs in https://paimon.apache.org/docs/master/how-to/writing-tables/#applying-recordschanges-to-tables to demonstrate this.
we also need a test case to cover this like:
@Test
public void testNonnull() {
spark.sql(
"CREATE TABLE T (a INT NOT NULL, b INT, c STRING) TBLPROPERTIES"
+ " ('primary-key'='a', 'file.format'='avro')");
spark.sql(
"CREATE TABLE T2 (a INT, b INT, c STRING) TBLPROPERTIES"
+ " ('file.format'='avro')");
spark.sql("INSERT INTO T2 VALUES (1, 11, '111'), (null, 22, '222')").collectAsList();
Assertions.assertNoException(spark.sql("INSERT INTO T SELECT nvl(a, 1), b, c FROM T2"));
}
in class SparkWriteITCase
### Solution
_No response_
### Anything else?
_No response_
### Are you willing to submit a PR?
- [ ] I'm willing to submit a PR!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-paimon] reswqa commented on issue #1233: [Docs] Insert into non-null column with nullable value
Posted by "reswqa (via GitHub)" <gi...@apache.org>.
reswqa commented on issue #1233:
URL: https://github.com/apache/incubator-paimon/issues/1233#issuecomment-1562997880
Thanks @leaves12138 for creating this, I'd like to take it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-paimon] JingsongLi commented on issue #1233: [Docs] Insert into non-null column with nullable value
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on issue #1233:
URL: https://github.com/apache/incubator-paimon/issues/1233#issuecomment-1566587711
https://github.com/apache/incubator-paimon/issues/1048
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-paimon] JingsongLi closed issue #1233: [Docs] Insert into non-null column with nullable value
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi closed issue #1233: [Docs] Insert into non-null column with nullable value
URL: https://github.com/apache/incubator-paimon/issues/1233
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org