Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line numberDiff line numberDiff line change
Expand Up@@ -44,8 +44,8 @@
import static org.apache.iotdb.commons.pipe.config.constant.PipeConnectorConstant.CONNECTOR_FORMAT_HYBRID_VALUE;
import static org.apache.iotdb.commons.pipe.config.constant.PipeConnectorConstant.CONNECTOR_FORMAT_KEY;
import static org.apache.iotdb.commons.pipe.config.constant.PipeConnectorConstant.CONNECTOR_FORMAT_TS_FILE_VALUE;
import static org.apache.iotdb.commons.pipe.config.constant.PipeConnectorConstant.CONNECTOR_IOTDB_BATCH_DELAY_KEY;
import static org.apache.iotdb.commons.pipe.config.constant.PipeConnectorConstant.CONNECTOR_IOTDB_BATCH_DELAY_MS_KEY;
import static org.apache.iotdb.commons.pipe.config.constant.PipeConnectorConstant.CONNECTOR_IOTDB_BATCH_DELAY_SECONDS_KEY;
import static org.apache.iotdb.commons.pipe.config.constant.PipeConnectorConstant.CONNECTOR_IOTDB_BATCH_SIZE_KEY;
import static org.apache.iotdb.commons.pipe.config.constant.PipeConnectorConstant.CONNECTOR_IOTDB_PLAIN_BATCH_DELAY_DEFAULT_VALUE;
import static org.apache.iotdb.commons.pipe.config.constant.PipeConnectorConstant.CONNECTOR_IOTDB_PLAIN_BATCH_SIZE_DEFAULT_VALUE;
Expand All@@ -54,8 +54,8 @@
import static org.apache.iotdb.commons.pipe.config.constant.PipeConnectorConstant.CONNECTOR_LEADER_CACHE_ENABLE_DEFAULT_VALUE;
import static org.apache.iotdb.commons.pipe.config.constant.PipeConnectorConstant.CONNECTOR_LEADER_CACHE_ENABLE_KEY;
import static org.apache.iotdb.commons.pipe.config.constant.PipeConnectorConstant.SINK_FORMAT_KEY;
import static org.apache.iotdb.commons.pipe.config.constant.PipeConnectorConstant.SINK_IOTDB_BATCH_DELAY_KEY;
import static org.apache.iotdb.commons.pipe.config.constant.PipeConnectorConstant.SINK_IOTDB_BATCH_DELAY_MS_KEY;
import static org.apache.iotdb.commons.pipe.config.constant.PipeConnectorConstant.SINK_IOTDB_BATCH_DELAY_SECONDS_KEY;
import static org.apache.iotdb.commons.pipe.config.constant.PipeConnectorConstant.SINK_IOTDB_BATCH_SIZE_KEY;
import static org.apache.iotdb.commons.pipe.config.constant.PipeConnectorConstant.SINK_LEADER_CACHE_ENABLE_KEY;

Expand DownExpand Up@@ -95,7 +95,8 @@ public PipeTransferBatchReqBuilder(final PipeParameters parameters) {
if (Objects.isNull(requestMaxDelayInMillis)) {
final int requestMaxDelayInSeconds =
parameters.getIntOrDefault(
Arrays.asList(CONNECTOR_IOTDB_BATCH_DELAY_KEY, SINK_IOTDB_BATCH_DELAY_KEY),
Arrays.asList(
CONNECTOR_IOTDB_BATCH_DELAY_SECONDS_KEY, SINK_IOTDB_BATCH_DELAY_SECONDS_KEY),
usingTsFileBatch
? CONNECTOR_IOTDB_TS_FILE_BATCH_DELAY_DEFAULT_VALUE
: CONNECTOR_IOTDB_PLAIN_BATCH_DELAY_DEFAULT_VALUE);
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -109,7 +109,11 @@ public void validate(final PipeParameterValidator validator) throws Exception {
SINK_OPC_UA_MODEL_KEY,
true,
CONNECTOR_OPC_UA_MODEL_CLIENT_SERVER_VALUE,
CONNECTOR_OPC_UA_MODEL_PUB_SUB_VALUE);
CONNECTOR_OPC_UA_MODEL_PUB_SUB_VALUE)
.validateSynonymAttributes(
Arrays.asList(CONNECTOR_IOTDB_USER_KEY, SINK_IOTDB_USER_KEY),
Arrays.asList(CONNECTOR_IOTDB_USERNAME_KEY, SINK_IOTDB_USERNAME_KEY),
false);
}

@Override
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -46,13 +46,13 @@
import java.util.List;
import java.util.Objects;

import static org.apache.iotdb.commons.pipe.config.constant.PipeConnectorConstant.CONNECTOR_IOTDB_BATCH_DELAY_KEY;
import static org.apache.iotdb.commons.pipe.config.constant.PipeConnectorConstant.CONNECTOR_IOTDB_BATCH_DELAY_MS_KEY;
import static org.apache.iotdb.commons.pipe.config.constant.PipeConnectorConstant.CONNECTOR_IOTDB_BATCH_DELAY_SECONDS_KEY;
import static org.apache.iotdb.commons.pipe.config.constant.PipeConnectorConstant.CONNECTOR_IOTDB_BATCH_SIZE_KEY;
import static org.apache.iotdb.commons.pipe.config.constant.PipeConnectorConstant.CONNECTOR_IOTDB_PLAIN_BATCH_DELAY_DEFAULT_VALUE;
import static org.apache.iotdb.commons.pipe.config.constant.PipeConnectorConstant.CONNECTOR_IOTDB_PLAIN_BATCH_SIZE_DEFAULT_VALUE;
import static org.apache.iotdb.commons.pipe.config.constant.PipeConnectorConstant.SINK_IOTDB_BATCH_DELAY_KEY;
import static org.apache.iotdb.commons.pipe.config.constant.PipeConnectorConstant.SINK_IOTDB_BATCH_DELAY_MS_KEY;
import static org.apache.iotdb.commons.pipe.config.constant.PipeConnectorConstant.SINK_IOTDB_BATCH_DELAY_SECONDS_KEY;
import static org.apache.iotdb.commons.pipe.config.constant.PipeConnectorConstant.SINK_IOTDB_BATCH_SIZE_KEY;

public abstract class PipeConsensusTransferBatchReqBuilder implements AutoCloseable {
Expand DownExpand Up@@ -80,7 +80,8 @@ protected PipeConsensusTransferBatchReqBuilder(
if (Objects.isNull(requestMaxDelayInMillis)) {
final int requestMaxDelayInSeconds =
parameters.getIntOrDefault(
Arrays.asList(CONNECTOR_IOTDB_BATCH_DELAY_KEY, SINK_IOTDB_BATCH_DELAY_KEY),
Arrays.asList(
CONNECTOR_IOTDB_BATCH_DELAY_SECONDS_KEY, SINK_IOTDB_BATCH_DELAY_SECONDS_KEY),
CONNECTOR_IOTDB_PLAIN_BATCH_DELAY_DEFAULT_VALUE);
maxDelayInMs =
requestMaxDelayInSeconds < 0 ? Integer.MAX_VALUE : requestMaxDelayInSeconds * 1000;
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -826,7 +826,7 @@ private static class CommonTableScanOperatorParameters {
List<ColumnSchema> columnSchemas;
int[] columnsIndexArray;
Map<Symbol, ColumnSchema> columnSchemaMap;
Map<Symbol, Integer> idAndAttributeColumnsIndexMap;
Map<Symbol, Integer> tagAndAttributeColumnsIndexMap;
List<String> measurementColumnNames;
Map<String, Integer> measurementColumnsIndexMap;
String timeColumnName;
Expand All@@ -844,7 +844,7 @@ private CommonTableScanOperatorParameters(
columnSchemas = new ArrayList<>(outputColumnCount);
columnsIndexArray = new int[outputColumnCount];
columnSchemaMap = node.getAssignments();
idAndAttributeColumnsIndexMap = node.getIdAndAttributeIndexMap();
tagAndAttributeColumnsIndexMap = node.getTagAndAttributeIndexMap();
measurementColumnNames = new ArrayList<>();
measurementColumnsIndexMap = new HashMap<>();
measurementSchemas = new ArrayList<>();
Expand All@@ -861,7 +861,7 @@ private CommonTableScanOperatorParameters(
case ATTRIBUTE:
columnsIndexArray[idx++] =
requireNonNull(
idAndAttributeColumnsIndexMap.get(columnName), columnName + " is null");
tagAndAttributeColumnsIndexMap.get(columnName), columnName + " is null");
columnSchemas.add(schema);
break;
case FIELD:
Expand DownExpand Up@@ -2707,7 +2707,8 @@ public Operator visitAggregationTreeDeviceViewScan(
case TAG:
case ATTRIBUTE:
aggColumnsIndexArray[channel] =
requireNonNull(node.getIdAndAttributeIndexMap().get(symbol), symbol + " is null");
requireNonNull(
node.getTagAndAttributeIndexMap().get(symbol), symbol + " is null");
break;
case FIELD:
aggColumnsIndexArray[channel] = measurementColumnCount;
Expand DownExpand Up@@ -2778,9 +2779,9 @@ public Operator visitAggregationTreeDeviceViewScan(
for (int i = 0; i < node.getGroupingKeys().size(); i++) {
Symbol groupingKey = node.getGroupingKeys().get(i);

if (node.getIdAndAttributeIndexMap().containsKey(groupingKey)) {
if (node.getTagAndAttributeIndexMap().containsKey(groupingKey)) {
groupingKeySchemas.add(node.getAssignments().get(groupingKey));
groupingKeyIndex[i] = node.getIdAndAttributeIndexMap().get(groupingKey);
groupingKeyIndex[i] = node.getTagAndAttributeIndexMap().get(groupingKey);
} else {
if (node.getProjection() != null
&& !node.getProjection().getMap().isEmpty()
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -201,7 +201,7 @@ protected RelationPlan visitTable(final Table table, final Void context) {

// on the basis of that the order of fields is same with the column category order of segments
// in DeviceEntry
final Map<Symbol, Integer> idAndAttributeIndexMap = new HashMap<>();
final Map<Symbol, Integer> tagAndAttributeIndexMap = new HashMap<>();
int idIndex = 0;
for (final Field field : fields) {
final TsTableColumnCategory category = field.getColumnCategory();
Expand All@@ -212,7 +212,7 @@ protected RelationPlan visitTable(final Table table, final Void context) {
new ColumnSchema(
field.getName().orElse(null), field.getType(), field.isHidden(), category));
if (category == TsTableColumnCategory.TAG) {
idAndAttributeIndexMap.put(symbol, idIndex++);
tagAndAttributeIndexMap.put(symbol, idIndex++);
}
}

Expand All@@ -230,7 +230,7 @@ protected RelationPlan visitTable(final Table table, final Void context) {
qualifiedObjectName,
outputSymbols,
tableColumnSchema,
idAndAttributeIndexMap,
tagAndAttributeIndexMap,
null,
treeDeviceViewSchema.getColumn2OriginalNameMap()),
scope,
Expand All@@ -247,7 +247,7 @@ protected RelationPlan visitTable(final Table table, final Void context) {
qualifiedObjectName,
outputSymbols,
tableColumnSchema,
idAndAttributeIndexMap);
tagAndAttributeIndexMap);
return new RelationPlan(tableScanNode, scope, outputSymbols, outerContext);

// Collection<Field> fields = analysis.getMaterializedViewStorageTableFields(node);
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -565,7 +565,7 @@ private List<PlanNode> constructDeviceTableScanByTags(
node.getOutputSymbols(),
node.getAssignments(),
new ArrayList<>(),
node.getIdAndAttributeIndexMap(),
node.getTagAndAttributeIndexMap(),
node.getScanOrder(),
node.getTimePredicate().orElse(null),
node.getPushDownPredicate(),
Expand DownExpand Up@@ -640,7 +640,7 @@ private List<PlanNode> constructDeviceTableScanByRegionReplicaSet(
node.getOutputSymbols(),
node.getAssignments(),
new ArrayList<>(),
node.getIdAndAttributeIndexMap(),
node.getTagAndAttributeIndexMap(),
node.getScanOrder(),
node.getTimePredicate().orElse(null),
node.getPushDownPredicate(),
Expand DownExpand Up@@ -727,7 +727,7 @@ public List<PlanNode> visitTreeDeviceViewScan(TreeDeviceViewScanNode node, PlanC
node.getOutputSymbols(),
node.getAssignments(),
new ArrayList<>(),
node.getIdAndAttributeIndexMap(),
node.getTagAndAttributeIndexMap(),
node.getScanOrder(),
node.getTimePredicate().orElse(null),
node.getPushDownPredicate(),
Expand All@@ -749,7 +749,7 @@ public List<PlanNode> visitTreeDeviceViewScan(TreeDeviceViewScanNode node, PlanC
node.getOutputSymbols(),
node.getAssignments(),
new ArrayList<>(),
node.getIdAndAttributeIndexMap(),
node.getTagAndAttributeIndexMap(),
node.getScanOrder(),
node.getTimePredicate().orElse(null),
node.getPushDownPredicate(),
Expand DownExpand Up@@ -1166,7 +1166,7 @@ private void buildRegionNodeMap(
partialAggTableScanNode.getOutputSymbols(),
partialAggTableScanNode.getAssignments(),
new ArrayList<>(),
partialAggTableScanNode.getIdAndAttributeIndexMap(),
partialAggTableScanNode.getTagAndAttributeIndexMap(),
partialAggTableScanNode.getScanOrder(),
partialAggTableScanNode.getTimePredicate().orElse(null),
partialAggTableScanNode.getPushDownPredicate(),
Expand All@@ -1186,7 +1186,7 @@ private void buildRegionNodeMap(
partialAggTableScanNode.getOutputSymbols(),
partialAggTableScanNode.getAssignments(),
new ArrayList<>(),
partialAggTableScanNode.getIdAndAttributeIndexMap(),
partialAggTableScanNode.getTagAndAttributeIndexMap(),
partialAggTableScanNode.getScanOrder(),
partialAggTableScanNode.getTimePredicate().orElse(null),
partialAggTableScanNode.getPushDownPredicate(),
Expand DownExpand Up@@ -1267,7 +1267,7 @@ private void processSortProperty(
newSortOrders.add(expectedOrderingScheme.getOrdering(symbol));
lastIsTimeRelated = true;
break;
} else if (!deviceTableScanNode.getIdAndAttributeIndexMap().containsKey(symbol)) {
} else if (!deviceTableScanNode.getTagAndAttributeIndexMap().containsKey(symbol)) {
break;
}

Expand All@@ -1284,7 +1284,7 @@ private void processSortProperty(
createTreeDeviceIdColumnValueExtractor(deviceTableScanNode);
final List<Function<DeviceEntry, String>> orderingRules = new ArrayList<>();
for (final Symbol symbol : newOrderingSymbols) {
final Integer idx = deviceTableScanNode.getIdAndAttributeIndexMap().get(symbol);
final Integer idx = deviceTableScanNode.getTagAndAttributeIndexMap().get(symbol);
if (idx == null) {
// time column or date_bin column
break;
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -101,7 +101,7 @@ public static Optional<PlanNode> pruneColumns(TableScanNode node, Set<Symbol> re
newOutputs,
newAssignments,
deviceTableScanNode.getDeviceEntries(),
deviceTableScanNode.getIdAndAttributeIndexMap(),
deviceTableScanNode.getTagAndAttributeIndexMap(),
deviceTableScanNode.getScanOrder(),
deviceTableScanNode.getTimePredicate().orElse(null),
deviceTableScanNode.getPushDownPredicate(),
Expand All@@ -119,7 +119,7 @@ public static Optional<PlanNode> pruneColumns(TableScanNode node, Set<Symbol> re
newOutputs,
newAssignments,
deviceTableScanNode.getDeviceEntries(),
deviceTableScanNode.getIdAndAttributeIndexMap(),
deviceTableScanNode.getTagAndAttributeIndexMap(),
deviceTableScanNode.getScanOrder(),
deviceTableScanNode.getTimePredicate().orElse(null),
deviceTableScanNode.getPushDownPredicate(),
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -74,7 +74,7 @@ public AggregationTableScanNode(
List<Symbol> outputSymbols,
Map<Symbol, ColumnSchema> assignments,
List<DeviceEntry> deviceEntries,
Map<Symbol, Integer> idAndAttributeIndexMap,
Map<Symbol, Integer> tagAndAttributeIndexMap,
Ordering scanOrder,
Expression timePredicate,
Expression pushDownPredicate,
Expand All@@ -94,7 +94,7 @@ public AggregationTableScanNode(
outputSymbols,
assignments,
deviceEntries,
idAndAttributeIndexMap,
tagAndAttributeIndexMap,
scanOrder,
timePredicate,
pushDownPredicate,
Expand DownExpand Up@@ -260,7 +260,7 @@ public AggregationTableScanNode clone() {
outputSymbols,
assignments,
deviceEntries,
idAndAttributeIndexMap,
tagAndAttributeIndexMap,
scanOrder,
timePredicate,
pushDownPredicate,
Expand DownExpand Up@@ -294,7 +294,7 @@ public static AggregationTableScanNode combineAggregationAndTableScan(
tableScanNode.getOutputSymbols(),
tableScanNode.getAssignments(),
tableScanNode.getDeviceEntries(),
tableScanNode.getIdAndAttributeIndexMap(),
tableScanNode.getTagAndAttributeIndexMap(),
tableScanNode.getScanOrder(),
tableScanNode.getTimePredicate().orElse(null),
tableScanNode.getPushDownPredicate(),
Expand All@@ -318,7 +318,7 @@ public static AggregationTableScanNode combineAggregationAndTableScan(
tableScanNode.getOutputSymbols(),
tableScanNode.getAssignments(),
tableScanNode.getDeviceEntries(),
tableScanNode.getIdAndAttributeIndexMap(),
tableScanNode.getTagAndAttributeIndexMap(),
tableScanNode.getScanOrder(),
tableScanNode.getTimePredicate().orElse(null),
tableScanNode.getPushDownPredicate(),
Expand DownExpand Up@@ -348,7 +348,7 @@ public static AggregationTableScanNode combineAggregationAndTableScan(
tableScanNode.getOutputSymbols(),
tableScanNode.getAssignments(),
tableScanNode.getDeviceEntries(),
tableScanNode.getIdAndAttributeIndexMap(),
tableScanNode.getTagAndAttributeIndexMap(),
tableScanNode.getScanOrder(),
tableScanNode.getTimePredicate().orElse(null),
tableScanNode.getPushDownPredicate(),
Expand All@@ -372,7 +372,7 @@ public static AggregationTableScanNode combineAggregationAndTableScan(
tableScanNode.getOutputSymbols(),
tableScanNode.getAssignments(),
tableScanNode.getDeviceEntries(),
tableScanNode.getIdAndAttributeIndexMap(),
tableScanNode.getTagAndAttributeIndexMap(),
tableScanNode.getScanOrder(),
tableScanNode.getTimePredicate().orElse(null),
tableScanNode.getPushDownPredicate(),
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -51,7 +51,7 @@ public AggregationTreeDeviceViewScanNode(
List<Symbol> outputSymbols,
Map<Symbol, ColumnSchema> assignments,
List<DeviceEntry> deviceEntries,
Map<Symbol, Integer> idAndAttributeIndexMap,
Map<Symbol, Integer> tagAndAttributeIndexMap,
Ordering scanOrder,
Expression timePredicate,
Expression pushDownPredicate,
Expand All@@ -73,7 +73,7 @@ public AggregationTreeDeviceViewScanNode(
outputSymbols,
assignments,
deviceEntries,
idAndAttributeIndexMap,
tagAndAttributeIndexMap,
scanOrder,
timePredicate,
pushDownPredicate,
Expand DownExpand Up@@ -140,7 +140,7 @@ public AggregationTreeDeviceViewScanNode clone() {
outputSymbols,
assignments,
deviceEntries,
idAndAttributeIndexMap,
tagAndAttributeIndexMap,
scanOrder,
timePredicate,
pushDownPredicate,
Expand Down
Loading