Skip to content

Commit 3b8b43f

Browse files
committed
Polishing.
Signed-off-by: Youssef Aouichaoui <[email protected]>
1 parent 1f48584 commit 3b8b43f

File tree

6 files changed

+2
-112
lines changed

6 files changed

+2
-112
lines changed

src/main/java/org/springframework/data/elasticsearch/core/query/SqlQuery.java

-65
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,11 @@
1515
*/
1616
package org.springframework.data.elasticsearch.core.query;
1717

18-
import static org.springframework.data.elasticsearch.core.sql.types.ResponseFormat.cbor;
19-
import static org.springframework.data.elasticsearch.core.sql.types.ResponseFormat.csv;
20-
import static org.springframework.data.elasticsearch.core.sql.types.ResponseFormat.json;
21-
import static org.springframework.data.elasticsearch.core.sql.types.ResponseFormat.smile;
22-
import static org.springframework.data.elasticsearch.core.sql.types.ResponseFormat.yaml;
23-
2418
import java.time.Duration;
2519
import java.util.ArrayList;
2620
import java.util.List;
2721
import java.util.TimeZone;
2822

29-
import org.springframework.data.elasticsearch.core.sql.types.ResponseFormat;
3023
import org.springframework.lang.Nullable;
3124
import org.springframework.util.Assert;
3225

@@ -38,20 +31,6 @@
3831
* @since 5.4
3932
*/
4033
public class SqlQuery {
41-
/**
42-
* Separator for CSV results.
43-
* <p>
44-
* Default, this is set to {@code ,}.
45-
*/
46-
@Nullable private final String delimiter;
47-
48-
/**
49-
* The format for the response, such as csv, json, txt, can be viewed at the {@link ResponseFormat}. The java client
50-
* of Elasticsearch only supports JSON. See {@link co.elastic.clients.transport.JsonEndpoint}
51-
* <p>
52-
* Default, this is set to {@code json}.
53-
*/
54-
@Nullable private final ResponseFormat format;
5534

5635
/**
5736
* If true, returns partial results if there are shard request timeouts or shard failures.
@@ -157,9 +136,6 @@ public class SqlQuery {
157136
@Nullable private final Duration waitForCompletionTimeout;
158137

159138
private SqlQuery(Builder builder) {
160-
this.delimiter = builder.delimiter;
161-
this.format = builder.format;
162-
163139
this.allowPartialSearchResults = builder.allowPartialSearchResults;
164140

165141
this.catalog = builder.catalog;
@@ -185,16 +161,6 @@ private SqlQuery(Builder builder) {
185161
this.waitForCompletionTimeout = builder.waitForCompletionTimeout;
186162
}
187163

188-
@Nullable
189-
public String getDelimiter() {
190-
return delimiter;
191-
}
192-
193-
@Nullable
194-
public ResponseFormat getFormat() {
195-
return format;
196-
}
197-
198164
@Nullable
199165
public Boolean getAllowPartialSearchResults() {
200166
return allowPartialSearchResults;
@@ -279,9 +245,6 @@ public static Builder builder(String query) {
279245
}
280246

281247
public static class Builder {
282-
@Nullable private String delimiter;
283-
@Nullable private ResponseFormat format;
284-
285248
@Nullable private Boolean allowPartialSearchResults;
286249

287250
@Nullable private String catalog;
@@ -313,24 +276,6 @@ private Builder(String query) {
313276
this.query = query;
314277
}
315278

316-
/**
317-
* Separator for CSV results.
318-
*/
319-
public Builder withDelimiter(String delimiter) {
320-
this.delimiter = delimiter;
321-
322-
return this;
323-
}
324-
325-
/**
326-
* The format for the response, such as csv, json, txt, can be viewed at the {@link ResponseFormat}.
327-
*/
328-
public Builder withFormat(ResponseFormat format) {
329-
this.format = format;
330-
331-
return this;
332-
}
333-
334279
/**
335280
* If true, returns partial results if there are shard request timeouts or shard failures.
336281
*/
@@ -482,16 +427,6 @@ public Builder withWaitForCompletionTimeout(Duration waitForCompletionTimeout) {
482427
}
483428

484429
public SqlQuery build() {
485-
if (Boolean.TRUE.equals(columnar)) {
486-
if (!(cbor.equals(format) || json.equals(format) || smile.equals(format) || yaml.equals(format))) {
487-
throw new IllegalArgumentException("Columnar format support only YAML, CBOR, JSON and SMILE.");
488-
}
489-
}
490-
491-
if (delimiter != null && !csv.equals(format)) {
492-
throw new IllegalArgumentException("Delimiter support is only available for CSV responses.");
493-
}
494-
495430
return new SqlQuery(this);
496431
}
497432
}

src/main/java/org/springframework/data/elasticsearch/core/sql/ReactiveSqlOperations.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
*/
2929
public interface ReactiveSqlOperations {
3030
/**
31-
* Execute the criteria {@code query} against elasticsearch and return result as {@link SqlResponse}
31+
* Execute the sql {@code query} against elasticsearch and return result as {@link SqlResponse}
3232
*
3333
* @param query the query to execute
3434
* @return {@link SqlResponse} containing the list of found objects

src/main/java/org/springframework/data/elasticsearch/core/sql/SqlOperations.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*/
2727
public interface SqlOperations {
2828
/**
29-
* Execute the criteria {@code query} against elasticsearch and return result as {@link SqlResponse}
29+
* Execute the sql {@code query} against elasticsearch and return result as {@link SqlResponse}
3030
*
3131
* @param query the query to execute
3232
* @return {@link SqlResponse} containing the list of found objects

src/main/java/org/springframework/data/elasticsearch/core/sql/SqlResponse.java

-12
Original file line numberDiff line numberDiff line change
@@ -121,18 +121,6 @@ public JsonValue get(Column column) {
121121
return row.get(column);
122122
}
123123

124-
/**
125-
* This method should attempt to convert the SQL response into a document if the columns selected in an SQL query
126-
* correspond to the fields in the document.
127-
*
128-
* @param documentClass The class that represents the document.
129-
* @return an instance of Document {@link T}.
130-
* @param <T> Document type.
131-
*/
132-
public <T> T toDocument(Class<T> documentClass) {
133-
throw new UnsupportedOperationException("Not implemented yet.");
134-
}
135-
136124
public static class Builder {
137125
private final Map<Column, JsonValue> row = new HashMap<>();
138126

src/main/java/org/springframework/data/elasticsearch/core/sql/types/ResponseFormat.java

-29
This file was deleted.

src/main/java/org/springframework/data/elasticsearch/core/sql/types/package-info.java

-4
This file was deleted.

0 commit comments

Comments
 (0)