Skip to content

Commit 0baec59

Browse files
committed
Add columns field
Signed-off-by: Chen Dai <[email protected]>
1 parent 9a7ca08 commit 0baec59

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

core/src/main/java/org/opensearch/sql/planner/logical/LogicalPlanDSL.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
@UtilityClass
3333
public class LogicalPlanDSL {
3434

35-
public static LogicalPlan write(LogicalPlan input, Table table) {
36-
return new LogicalWrite(input, table);
35+
public static LogicalPlan write(LogicalPlan input, Table table, List<String> columns) {
36+
return new LogicalWrite(input, table, columns);
3737
}
3838

3939
public static LogicalPlan aggregation(

core/src/main/java/org/opensearch/sql/planner/logical/LogicalWrite.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
package org.opensearch.sql.planner.logical;
77

88
import java.util.Collections;
9+
import java.util.List;
910
import lombok.EqualsAndHashCode;
1011
import lombok.Getter;
1112
import lombok.ToString;
@@ -15,16 +16,23 @@
1516
* Logical operator for insert statement.
1617
*/
1718
@EqualsAndHashCode(callSuper = true)
19+
@Getter
1820
@ToString
1921
public class LogicalWrite extends LogicalPlan {
2022

2123
/** Table that handles the write operation. */
22-
@Getter
2324
private final Table table;
2425

25-
public LogicalWrite(LogicalPlan child, Table table) {
26+
/** Optional column name list specified in insert statement. */
27+
private final List<String> columns;
28+
29+
/**
30+
* Construct a logical write with given child node, table and column name list.
31+
*/
32+
public LogicalWrite(LogicalPlan child, Table table, List<String> columns) {
2633
super(Collections.singletonList(child));
2734
this.table = table;
35+
this.columns = columns;
2836
}
2937

3038
@Override

core/src/test/java/org/opensearch/sql/planner/logical/LogicalPlanNodeVisitorTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import com.google.common.collect.ImmutableList;
1414
import com.google.common.collect.ImmutableMap;
15+
import java.util.Collections;
1516
import java.util.HashMap;
1617
import java.util.Map;
1718
import java.util.stream.Collectors;
@@ -86,7 +87,7 @@ public TableScanOperator build() {
8687
assertNull(tableScanBuilder.accept(new LogicalPlanNodeVisitor<Integer, Object>() {
8788
}, null));
8889

89-
LogicalPlan write = LogicalPlanDSL.write(null, table);
90+
LogicalPlan write = LogicalPlanDSL.write(null, table, Collections.emptyList());
9091
assertNull(write.accept(new LogicalPlanNodeVisitor<Integer, Object>() {
9192
}, null));
9293

core/src/test/java/org/opensearch/sql/planner/optimizer/LogicalPlanOptimizerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ void table_support_write_builder_should_be_replaced() {
282282

283283
assertEquals(
284284
writeBuilder,
285-
optimize(write(values(), table))
285+
optimize(write(values(), table, Collections.emptyList()))
286286
);
287287
}
288288

0 commit comments

Comments
 (0)