Skip to content

Conversation

@todd5167
Copy link
Contributor

@todd5167 todd5167 commented Feb 9, 2022

Tips

What is the purpose of the pull request

  • Incorrect verification of KeyGenClass attribute results in NPE. If not set, return an empty string, NPE appears when getRecordKey *

Brief change log

(for example:)

  • *Modify org.apache.spark.sql.hudi.command.SqlKeyGenerator#originKeyGen *

Verify this pull request

(Please pick either of the following options)

This pull request is a trivial rework / code cleanup without any test coverage.

(or)

This pull request is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(example:)

  • Added integration tests for end-to-end.
  • Added HoodieClientWriteTest to verify the change.
  • Manually verified the change by running a job locally.

Committer checklist

  • Has a corresponding JIRA in PR title & commit

  • Commit message is descriptive of the change

  • CI is green

  • Necessary doc changes done or have another open PR

  • For large changes, please consider breaking it into sub-tasks under an umbrella JIRA.

@todd5167 todd5167 changed the title fix NPE caused by incorrect beforeKeyGenClassName validation [HUDI-3401] fix NPE caused by incorrect beforeKeyGenClassName validation Feb 9, 2022
@hudi-bot
Copy link
Collaborator

hudi-bot commented Feb 9, 2022

CI report:

Bot commands @hudi-bot supports the following commands:
  • @hudi-bot run azure re-run the last Azure build

@nsivabalan
Copy link
Contributor

@YannByron : Can you review please.

@YannByron
Copy link
Contributor

YannByron commented Feb 9, 2022

@todd5167 LGTM. But if you show some codes or steps to indicate how to reproduce this , it will be nice.

@todd5167
Copy link
Contributor Author

@todd5167 LGTM. But if you show some codes or steps to indicate how to reproduce this , it will be nice.

@YannByron Execute insert statement using spark sql,with the default KEYGEN_CLASS, the exception occurs when the RecordKey is generated.

e.g.:INSERT into hudi_mor_rt partition(order_date = '20220209') values (5,'todd',1,1,'x','x')

@YannByron
Copy link
Contributor

@todd5167 I create a mor table, and insert some data, but i can reproduce this issues. can you give the complete sqls please?

the codes that i test like this:

create table hudi_mor_tbl (uuid long, name string, order_date string) using hudi partitioned by (order_date) tblproperties (type='mor');
insert into hudi_mor_tbl values (5,'todd', '20220209');
insert into hudi_mor_tbl partition(order_date = '20220210') values (6,'todd');
insert into hudi_mor_tbl_rt partition(order_date = '20220210') values (7,'todd'); -- this use the rt table.

@todd5167
Copy link
Contributor Author

@todd5167 I create a mor table, and insert some data, but i can reproduce this issues. can you give the complete sqls please?

the codes that i test like this:

create table hudi_mor_tbl (uuid long, name string, order_date string) using hudi partitioned by (order_date) tblproperties (type='mor');
insert into hudi_mor_tbl values (5,'todd', '20220209');
insert into hudi_mor_tbl partition(order_date = '20220210') values (6,'todd');
insert into hudi_mor_tbl_rt partition(order_date = '20220210') values (7,'todd'); -- this use the rt table.

@YannByron
val beforeKeyGenClassName = props.getString(SqlKeyGenerator.ORIGIN_KEYGEN_CLASS_NAME, null)

You only need to verify whether the current return value is an empty string or Null.

@YannByron
Copy link
Contributor

@todd5167 I know this pr can work and have no side effect. Sorry for my insistence. i'm just a little pertinacious to find a reproducible steps that cause NPE here.

@YannByron
Copy link
Contributor

@nsivabalan if you have no other updates, please merge it.

@nsivabalan
Copy link
Contributor

thanks Yann.

@nsivabalan nsivabalan merged commit 45d1216 into apache:master Feb 25, 2022
@nsivabalan nsivabalan added the status:triaged Issue has been reviewed and categorized label Feb 27, 2022
vingov pushed a commit to vingov/hudi that referenced this pull request Apr 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:triaged Issue has been reviewed and categorized

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants