You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "hehuiyuan (via GitHub)" <gi...@apache.org> on 2023/12/04 05:39:45 UTC
[PR] Comparison between defaultParName and partValue [hudi]
hehuiyuan opened a new pull request, #10234:
URL: https://github.com/apache/hudi/pull/10234
### Change Logs
Comparison between defaultParName and partValue
### Impact
### Risk level (write none, low medium or high below)
### Documentation Update
_Describe any necessary documentation update if there is any new feature, config, or user-facing change_
- _The config description must be updated if new configs are added or the default value of the configs are changed_
- _Any new feature or user-facing change requires updating the Hudi website. Please create a Jira ticket, attach the
ticket number here and follow the [instruction](https://hudi.apache.org/contribute/developer-setup#website) to make
changes to the website._
### Contributor's checklist
- [ ] Read through [contributor's guide](https://hudi.apache.org/contribute/how-to-contribute)
- [ ] Change Logs and Impact were stated clearly
- [ ] Adequate tests were added if applicable
- [ ] CI passed
--
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: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7169]Comparison between defaultParName and partValue [hudi]
Posted by "hehuiyuan (via GitHub)" <gi...@apache.org>.
hehuiyuan commented on code in PR #10234:
URL: https://github.com/apache/hudi/pull/10234#discussion_r1413595424
##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/source/prune/PartitionPruners.java:
##########
@@ -94,7 +94,7 @@ private boolean evaluate(String partition) {
Map<String, ColumnStats> partStats = new LinkedHashMap<>();
for (int idx = 0; idx < partitionKeys.length; idx++) {
String partKey = partitionKeys[idx];
- Object partVal = partKey.equals(defaultParName)
+ Object partVal = partStrArray[idx].equals(defaultParName)
Review Comment:
If part filed value is null , use `defaultParName` instead of when writing data.
When reading:
1. If partVal equals `defaultParName`, the value of part field is null and the code return null.
```
Object partVal = partStrArray[idx].equals(defaultParName)
? null : DataTypeUtils.resolvePartition(partStrArray[idx], partitionTypes.get(idx));
```
ColumnStats columnStats = new ColumnStats(null, null, 1);
2. if parVal equals`defaultParName` and parKey is not equal to `defaultParName`, the code return `defaultParName`
```
Object partVal = partKey.equals(defaultParName)
? null : DataTypeUtils.resolvePartition(partStrArray[idx], partitionTypes.get(idx));
```
ColumnStats columnStats = new ColumnStats(`defaultParName`,`defaultParName`, 0);
3. For example IsNotNull Evaluator:
```
public static class IsNotNull extends LeafEvaluator {
private static final long serialVersionUID = 1L;
public static IsNotNull getInstance() {
return new IsNotNull();
}
@Override
public boolean eval(Map<String, ColumnStats> columnStatsMap) {
ColumnStats columnStats = getColumnStats(columnStatsMap);
// should consider FLOAT/DOUBLE & NAN
return columnStats.getMinVal() != null || columnStats.getNullCnt() <= 0;
}
}
```
if part filed value is null ,
apply 2 to 3 , the `eval` method return true
apply 1 to 3 , the `eval` method return false.
--
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: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Comparison between defaultParName and partValue [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #10234:
URL: https://github.com/apache/hudi/pull/10234#issuecomment-1837901855
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "a21ab0df2ee9e6a24219a6973624784a37017d00",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "a21ab0df2ee9e6a24219a6973624784a37017d00",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* a21ab0df2ee9e6a24219a6973624784a37017d00 UNKNOWN
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
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: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7169]Comparison between defaultParName and partValue [hudi]
Posted by "hehuiyuan (via GitHub)" <gi...@apache.org>.
hehuiyuan commented on code in PR #10234:
URL: https://github.com/apache/hudi/pull/10234#discussion_r1418273710
##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/source/prune/PartitionPruners.java:
##########
@@ -94,7 +94,7 @@ private boolean evaluate(String partition) {
Map<String, ColumnStats> partStats = new LinkedHashMap<>();
for (int idx = 0; idx < partitionKeys.length; idx++) {
String partKey = partitionKeys[idx];
- Object partVal = partKey.equals(defaultParName)
+ Object partVal = partStrArray[idx].equals(defaultParName)
Review Comment:
@danny0405
--
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: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7169]Comparison between defaultParName and partValue [hudi]
Posted by "danny0405 (via GitHub)" <gi...@apache.org>.
danny0405 commented on code in PR #10234:
URL: https://github.com/apache/hudi/pull/10234#discussion_r1413618528
##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/source/prune/PartitionPruners.java:
##########
@@ -94,7 +94,7 @@ private boolean evaluate(String partition) {
Map<String, ColumnStats> partStats = new LinkedHashMap<>();
for (int idx = 0; idx < partitionKeys.length; idx++) {
String partKey = partitionKeys[idx];
- Object partVal = partKey.equals(defaultParName)
+ Object partVal = partStrArray[idx].equals(defaultParName)
Review Comment:
The fix makes sense, just to improve the code like I mentioned above a little bit.
--
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: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Comparison between defaultParName and partValue [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #10234:
URL: https://github.com/apache/hudi/pull/10234#issuecomment-1837908541
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "a21ab0df2ee9e6a24219a6973624784a37017d00",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=21286",
"triggerID" : "a21ab0df2ee9e6a24219a6973624784a37017d00",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* a21ab0df2ee9e6a24219a6973624784a37017d00 Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=21286)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
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: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Comparison between defaultParName and partValue [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #10234:
URL: https://github.com/apache/hudi/pull/10234#issuecomment-1838118983
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "a21ab0df2ee9e6a24219a6973624784a37017d00",
"status" : "SUCCESS",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=21286",
"triggerID" : "a21ab0df2ee9e6a24219a6973624784a37017d00",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* a21ab0df2ee9e6a24219a6973624784a37017d00 Azure: [SUCCESS](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=21286)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
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: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7169]Comparison between defaultParName and partValue [hudi]
Posted by "danny0405 (via GitHub)" <gi...@apache.org>.
danny0405 merged PR #10234:
URL: https://github.com/apache/hudi/pull/10234
--
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: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7169]Comparison between defaultParName and partValue [hudi]
Posted by "hehuiyuan (via GitHub)" <gi...@apache.org>.
hehuiyuan commented on code in PR #10234:
URL: https://github.com/apache/hudi/pull/10234#discussion_r1413595424
##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/source/prune/PartitionPruners.java:
##########
@@ -94,7 +94,7 @@ private boolean evaluate(String partition) {
Map<String, ColumnStats> partStats = new LinkedHashMap<>();
for (int idx = 0; idx < partitionKeys.length; idx++) {
String partKey = partitionKeys[idx];
- Object partVal = partKey.equals(defaultParName)
+ Object partVal = partStrArray[idx].equals(defaultParName)
Review Comment:
If part filed value is null , use `defaultParName` instead of when writing data.
When reading:
1. If partVal equals `defaultParName`, the value of part field is null and the code return null.
```
Object partVal = partStrArray[idx].equals(defaultParName)
? null : DataTypeUtils.resolvePartition(partStrArray[idx], partitionTypes.get(idx));
```
ColumnStats columnStats = new ColumnStats(null, null, 1);
2. if parVal equals`defaultParName` and parKey is not equal to `defaultParName`, it will return `defaultParName`
```
Object partVal = partKey.equals(defaultParName)
? null : DataTypeUtils.resolvePartition(partStrArray[idx], partitionTypes.get(idx));
```
ColumnStats columnStats = new ColumnStats(`defaultParName`,`defaultParName`, 0);
3. Example for LeafEvaluator evaluator:
```
public static class IsNotNull extends LeafEvaluator {
private static final long serialVersionUID = 1L;
public static IsNotNull getInstance() {
return new IsNotNull();
}
@Override
public boolean eval(Map<String, ColumnStats> columnStatsMap) {
ColumnStats columnStats = getColumnStats(columnStatsMap);
// should consider FLOAT/DOUBLE & NAN
return columnStats.getMinVal() != null || columnStats.getNullCnt() <= 0;
}
}
```
--
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: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Comparison between defaultParName and partValue [hudi]
Posted by "danny0405 (via GitHub)" <gi...@apache.org>.
danny0405 commented on code in PR #10234:
URL: https://github.com/apache/hudi/pull/10234#discussion_r1413431893
##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/source/prune/PartitionPruners.java:
##########
@@ -94,7 +94,7 @@ private boolean evaluate(String partition) {
Map<String, ColumnStats> partStats = new LinkedHashMap<>();
for (int idx = 0; idx < partitionKeys.length; idx++) {
String partKey = partitionKeys[idx];
- Object partVal = partKey.equals(defaultParName)
+ Object partVal = partStrArray[idx].equals(defaultParName)
Review Comment:
The partKey is never used, maybe just switch it to ` String partValStr= partStrArray[idx];` and use this variable then.
--
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: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7169]Comparison between defaultParName and partValue [hudi]
Posted by "hehuiyuan (via GitHub)" <gi...@apache.org>.
hehuiyuan commented on code in PR #10234:
URL: https://github.com/apache/hudi/pull/10234#discussion_r1413652428
##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/source/prune/PartitionPruners.java:
##########
@@ -94,7 +94,7 @@ private boolean evaluate(String partition) {
Map<String, ColumnStats> partStats = new LinkedHashMap<>();
for (int idx = 0; idx < partitionKeys.length; idx++) {
String partKey = partitionKeys[idx];
- Object partVal = partKey.equals(defaultParName)
+ Object partVal = partStrArray[idx].equals(defaultParName)
Review Comment:
> The fix makes sense, just to improve the code like I mentioned above a little bit.
The key of `Map<String, ColumnStats> partStats` is partKey.
https://github.com/apache/hudi/blob/cd4f0de57522a681fbe5b62fd774c1943254ec2d/hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/source/prune/PartitionPruners.java#L100C23-L100C30
--
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: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Comparison between defaultParName and partValue [hudi]
Posted by "hehuiyuan (via GitHub)" <gi...@apache.org>.
hehuiyuan commented on code in PR #10234:
URL: https://github.com/apache/hudi/pull/10234#discussion_r1413595424
##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/source/prune/PartitionPruners.java:
##########
@@ -94,7 +94,7 @@ private boolean evaluate(String partition) {
Map<String, ColumnStats> partStats = new LinkedHashMap<>();
for (int idx = 0; idx < partitionKeys.length; idx++) {
String partKey = partitionKeys[idx];
- Object partVal = partKey.equals(defaultParName)
+ Object partVal = partStrArray[idx].equals(defaultParName)
Review Comment:
1. If partVal equals `defaultParName`, the value of part field is null and the code return null.
```
Object partVal = partStrArray[idx].equals(defaultParName)
? null : DataTypeUtils.resolvePartition(partStrArray[idx], partitionTypes.get(idx));
```
ColumnStats columnStats = new ColumnStats(null, null, 1);
2. if parVal equals`defaultParName` and parKey is not equal to `defaultParName`, it will return `defaultParName`
```
Object partVal = partKey.equals(defaultParName)
? null : DataTypeUtils.resolvePartition(partStrArray[idx], partitionTypes.get(idx));
```
ColumnStats columnStats = new ColumnStats(`defaultParName`,`defaultParName`, 0);
3. Example for LeafEvaluator evaluator:
```
public static class IsNotNull extends LeafEvaluator {
private static final long serialVersionUID = 1L;
public static IsNotNull getInstance() {
return new IsNotNull();
}
@Override
public boolean eval(Map<String, ColumnStats> columnStatsMap) {
ColumnStats columnStats = getColumnStats(columnStatsMap);
// should consider FLOAT/DOUBLE & NAN
return columnStats.getMinVal() != null || columnStats.getNullCnt() <= 0;
}
}
```
--
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: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7169]Comparison between defaultParName and partValue [hudi]
Posted by "danny0405 (via GitHub)" <gi...@apache.org>.
danny0405 commented on PR #10234:
URL: https://github.com/apache/hudi/pull/10234#issuecomment-1844269884
@hehuiyuan Can you fire a follow up fix to add some UTs like in `TestIncrementalInputSplits`.
--
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: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7169]Comparison between defaultParName and partValue [hudi]
Posted by "hehuiyuan (via GitHub)" <gi...@apache.org>.
hehuiyuan commented on PR #10234:
URL: https://github.com/apache/hudi/pull/10234#issuecomment-1844748082
> @hehuiyuan Can you fire a follow up fix to add some UTs like in `TestIncrementalInputSplits`.
ok
--
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: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org