Skip to content

[Table Model] Create table device#12746

Merged
JackieTien97 merged 9 commits intoapache:ty/TableModelGrammarfrom
MarcosZyk:create-table-device
Jun 18, 2024
Merged

[Table Model] Create table device#12746
JackieTien97 merged 9 commits intoapache:ty/TableModelGrammarfrom
MarcosZyk:create-table-device

Conversation

@MarcosZyk
Copy link
Copy Markdown
Contributor

@MarcosZyk MarcosZyk commented Jun 16, 2024

Description

Support Create Table Device, including:

  1. Statement CreateDevice
  2. PlanNode CreateTableDeviceNode, including ser/deser and split logic
  3. LogicalPlan stage logic
  4. execution logic invoking SchemaRegion

Local execution result

image

Comment on lines +216 to +222
PathPatternTree patternTree = new PathPatternTree();
for (PartialPath devicePath : devicePathList) {
patternTree.appendFullPath(devicePath.concatNode(ONE_LEVEL_PATH_WILDCARD));
}
SchemaPartition partition =
partitionFetcher.getOrCreateSchemaPartition(
patternTree, context.getSession().getUserName());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

directly add interface in Metadata use Map<String, List as parameter to fetch SchemaPartition.

Copy link
Copy Markdown
Contributor

@JackieTien97 JackieTien97 Jun 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

String databaseName, List<IDeviceId>
[database, table, , , , ]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already set interface in Metadata, but a todo is left waiting for implementation.

import java.util.Objects;

public class CreateTableDeviceNode extends WritePlanNode {
private final List<PartialPath> devicePathList;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not using List<String[]> + String databaseName + String tableName;
while serializing, we only need to serialize index 1+ and index 0 is db.tableName won't de serialized.
index 0 can be derialized from String databaseName + String tableName

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The db name and table name have been separated from the device id, Object[].

TRegionReplicaSet regionReplicaSet =
analysis
.getSchemaPartitionInfo()
.getSchemaRegionReplicaSet(new StringArrayDeviceID(devicePathList.get(i).getNodes()));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pass String database and use IDeviceID.Factory.create(String[]) to create IDeviceId.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add new method in getSchemaRegionReplicaSet(String database, IDeviceId)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed implementation.

@JackieTien97 JackieTien97 merged commit 1264141 into apache:ty/TableModelGrammar Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants