|
18 | 18 | package org.apache.doris.analysis; |
19 | 19 |
|
20 | 20 | import com.google.common.collect.ImmutableMap; |
| 21 | +import org.bouncycastle.util.Strings; |
21 | 22 |
|
| 23 | +import java.util.List; |
22 | 24 | import java.util.Map; |
23 | 25 |
|
24 | 26 | public class TableScanParams { |
25 | 27 | public static String INCREMENTAL_READ = "incr"; |
| 28 | + public static String BRANCH = "branch"; |
| 29 | + public static String TAG = "tag"; |
26 | 30 |
|
27 | 31 | private final String paramType; |
28 | | - private final Map<String, String> params; |
| 32 | + // There are two ways to pass parameters to a function. |
| 33 | + // - One is in map form, where the data is stored in `mapParams`. |
| 34 | + // such as: @func_name('param1'='value1', 'param2'='value2', 'param3'='value3') |
| 35 | + // - The other is in list form, where the data is stored in `listParams`. |
| 36 | + // such as: `listParams` is used for @func_name('value1', 'value2', 'value3') |
| 37 | + private final Map<String, String> mapParams; |
| 38 | + private final List<String> listParams; |
29 | 39 |
|
30 | | - public TableScanParams(String paramType, Map<String, String> params) { |
31 | | - this.paramType = paramType; |
32 | | - this.params = params == null ? ImmutableMap.of() : ImmutableMap.copyOf(params); |
| 40 | + public TableScanParams(String paramType, Map<String, String> mapParams, List<String> listParams) { |
| 41 | + this.paramType = Strings.toLowerCase(paramType); |
| 42 | + this.mapParams = mapParams == null ? ImmutableMap.of() : ImmutableMap.copyOf(mapParams); |
| 43 | + this.listParams = listParams; |
| 44 | + } |
| 45 | + |
| 46 | + public List<String> getListParams() { |
| 47 | + return listParams; |
33 | 48 | } |
34 | 49 |
|
35 | 50 | public String getParamType() { |
36 | 51 | return paramType; |
37 | 52 | } |
38 | 53 |
|
39 | | - public Map<String, String> getParams() { |
40 | | - return params; |
| 54 | + public Map<String, String> getMapParams() { |
| 55 | + return mapParams; |
41 | 56 | } |
42 | 57 |
|
43 | 58 | public boolean incrementalRead() { |
44 | 59 | return INCREMENTAL_READ.equals(paramType); |
45 | 60 | } |
| 61 | + |
| 62 | + public boolean isBranch() { |
| 63 | + return BRANCH.equals(paramType); |
| 64 | + } |
| 65 | + |
| 66 | + public boolean isTag() { |
| 67 | + return TAG.equals(paramType); |
| 68 | + } |
46 | 69 | } |
0 commit comments