|
21 | 21 |
|
22 | 22 | import org.apache.iotdb.commons.exception.SemanticException; |
23 | 23 | import org.apache.iotdb.commons.queryengine.common.SessionInfo; |
24 | | -import org.apache.iotdb.commons.queryengine.plan.relational.metadata.ColumnMetadata; |
25 | 24 | import org.apache.iotdb.commons.queryengine.plan.relational.sql.ast.QualifiedName; |
26 | 25 |
|
27 | | -import com.google.common.collect.ImmutableList; |
28 | | -import com.google.common.collect.ImmutableMap; |
29 | 26 | import com.google.common.collect.Lists; |
30 | | -import org.apache.tsfile.read.common.type.Type; |
31 | 27 |
|
32 | 28 | import java.util.List; |
33 | 29 | import java.util.Optional; |
@@ -88,52 +84,4 @@ public static QualifiedObjectName createQualifiedObjectName( |
88 | 84 |
|
89 | 85 | return new QualifiedObjectName(databaseName, objectName); |
90 | 86 | } |
91 | | - |
92 | | - public static boolean tableExists(Metadata metadata, SessionInfo session, String table) { |
93 | | - if (!session.getDatabaseName().isPresent()) { |
94 | | - return false; |
95 | | - } |
96 | | - QualifiedObjectName name = new QualifiedObjectName(session.getDatabaseName().get(), table); |
97 | | - return metadata.tableExists(name); |
98 | | - } |
99 | | - |
100 | | - public static class TableMetadataBuilder { |
101 | | - public static TableMetadataBuilder tableMetadataBuilder(String tableName) { |
102 | | - return new TableMetadataBuilder(tableName); |
103 | | - } |
104 | | - |
105 | | - private final String tableName; |
106 | | - private final ImmutableList.Builder<ColumnMetadata> columns = ImmutableList.builder(); |
107 | | - private final ImmutableMap.Builder<String, Object> properties = ImmutableMap.builder(); |
108 | | - private final Optional<String> comment; |
109 | | - |
110 | | - private TableMetadataBuilder(String tableName) { |
111 | | - this(tableName, Optional.empty()); |
112 | | - } |
113 | | - |
114 | | - private TableMetadataBuilder(String tableName, Optional<String> comment) { |
115 | | - this.tableName = tableName; |
116 | | - this.comment = comment; |
117 | | - } |
118 | | - |
119 | | - public TableMetadataBuilder column(String columnName, Type type) { |
120 | | - columns.add(new ColumnMetadata(columnName, type)); |
121 | | - return this; |
122 | | - } |
123 | | - |
124 | | - public TableMetadataBuilder hiddenColumn(String columnName, Type type) { |
125 | | - columns.add( |
126 | | - ColumnMetadata.builder().setName(columnName).setType(type).setHidden(true).build()); |
127 | | - return this; |
128 | | - } |
129 | | - |
130 | | - public TableMetadataBuilder property(String name, Object value) { |
131 | | - properties.put(name, value); |
132 | | - return this; |
133 | | - } |
134 | | - |
135 | | - public TableMetadata build() { |
136 | | - return new TableMetadata(tableName, columns.build(), properties.buildOrThrow(), comment); |
137 | | - } |
138 | | - } |
139 | 87 | } |
0 commit comments