Skip to content

Commit

Permalink
[KYUUBI #6727] replace immutable empty list and map in BatchRequest i…
Browse files Browse the repository at this point in the history
…nitialization

# 🔍 Description
## Issue References 🔗

This pull request fixes #

## Describe Your Solution 🔧

- replace immutable empty list and map with mutable one for BatchRequest initialization, for easier BatchRequest construction for rest-client use

## Types of changes 🔖

- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

## Test Plan 🧪

#### Behavior Without This Pull Request ⚰️

#### Behavior With This Pull Request 🎉

#### Related Unit Tests

---

# Checklist 📝

- [ ] This patch was not authored or co-authored using [Generative Tooling](https://www.apache.org/legal/generative-tooling.html)

**Be nice. Be informative.**

Closes #6727 from bowenliang123/batchapi-emptylist.

Closes #6727

9d6a04c [Bowen Liang] update

Authored-by: Bowen Liang <[email protected]>
Signed-off-by: Bowen Liang <[email protected]>
  • Loading branch information
bowenliang123 committed Oct 15, 2024
1 parent acd80f0 commit 70e0302
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@

package org.apache.kyuubi.client.api.v1.dto;

import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

Expand All @@ -29,9 +26,9 @@ public class BatchRequest {
private String resource;
private String className;
private String name;
private Map<String, String> conf = Collections.emptyMap();
private List<String> args = Collections.emptyList();
private Map<String, String> extraResourcesMap = Collections.emptyMap();
private Map<String, String> conf = new HashMap<>(0);
private List<String> args = new ArrayList<>(0);
private Map<String, String> extraResourcesMap = new HashMap<>(0);

public BatchRequest() {}

Expand Down Expand Up @@ -91,7 +88,7 @@ public void setName(String name) {

public Map<String, String> getConf() {
if (null == conf) {
return Collections.emptyMap();
return new HashMap<>(0);
}
return conf;
}
Expand All @@ -102,7 +99,7 @@ public void setConf(Map<String, String> conf) {

public List<String> getArgs() {
if (null == args) {
return Collections.emptyList();
return new ArrayList<>(0);
}
return args;
}
Expand Down

0 comments on commit 70e0302

Please sign in to comment.