From 89618a9e1e05dc164a5e0858750ca2e28a322fa3 Mon Sep 17 00:00:00 2001 From: Caideyipi <87789683+Caideyipi@users.noreply.github.com> Date: Thu, 23 Oct 2025 17:48:44 +0800 Subject: [PATCH] temp --- .../aligned/IoTDBInsertAlignedValuesIT.java | 86 +-- .../iotdb/db/it/query/IoTDBResultSetIT.java | 4 +- .../db/it/selectinto/IoTDBSelectIntoIT.java | 60 +- .../tests/integration/test_dataframe.py | 2 +- .../apache/iotdb/db/qp/sql/IoTDBSqlParser.g4 | 42 +- .../org/apache/iotdb/db/qp/sql/SqlLexer.g4 | 8 +- .../mnode/factory/ConfigMNodeFactory.java | 8 +- .../schema/DeleteLogicalViewProcedure.java | 4 +- .../schemaregion/SchemaExecutionVisitor.java | 28 +- .../metadata/DuplicateInsertException.java | 70 +- .../metadata/view/BrokenViewException.java | 64 +- .../view/InsertNonWritableViewException.java | 66 +- .../view/UnsupportedViewException.java | 80 +-- .../ViewContainsAggregationException.java | 58 +- .../metadata/view/ViewNotExistException.java | 90 +-- .../common/schematree/ClusterSchemaTree.java | 100 +-- .../common/schematree/DeviceSchemaInfo.java | 6 +- .../schematree/IMeasurementSchemaInfo.java | 16 +- .../common/schematree/ISchemaTree.java | 12 +- .../schematree/MeasurementSchemaInfo.java | 50 +- .../node/SchemaMeasurementNode.java | 82 +-- .../executor/RegionWriteExecutor.java | 48 +- .../source/LogicalViewSchemaSource.java | 2 +- .../schema/source/TimeSeriesSchemaSource.java | 4 +- .../db/queryengine/plan/analyze/Analysis.java | 44 +- .../plan/analyze/AnalyzeVisitor.java | 279 ++++---- .../plan/analyze/ExpressionAnalyzer.java | 40 +- .../schema/ClusterSchemaFetchExecutor.java | 32 +- .../analyze/schema/ISchemaComputation.java | 74 +- .../analyze/schema/ISchemaValidation.java | 30 +- .../analyze/schema/NormalSchemaFetcher.java | 403 ++++++----- .../executor/ClusterConfigTaskExecutor.java | 2 +- .../plan/expression/Expression.java | 2 +- .../expression/binary/BinaryExpression.java | 38 +- .../expression/binary/WhenThenExpression.java | 8 +- .../plan/expression/leaf/LeafOperand.java | 8 +- .../expression/multi/FunctionExpression.java | 36 +- .../other/CaseWhenThenExpression.java | 22 +- .../expression/ternary/BetweenExpression.java | 8 +- .../expression/ternary/TernaryExpression.java | 30 +- .../plan/expression/unary/InExpression.java | 34 +- .../expression/unary/IsNullExpression.java | 6 +- .../plan/expression/unary/LikeExpression.java | 6 +- .../expression/unary/LogicNotExpression.java | 12 +- .../expression/unary/NegationExpression.java | 16 +- .../expression/unary/RegularExpression.java | 6 +- .../expression/unary/UnaryExpression.java | 10 +- .../CompleteMeasurementSchemaVisitor.java | 178 ++--- .../visitor/ReplaceLogicalViewVisitor.java | 338 +++++----- .../TransformToViewExpressionVisitor.java | 550 +++++++-------- .../plan/planner/LogicalPlanVisitor.java | 24 +- .../plan/planner/plan/node/PlanNodeType.java | 6 +- .../write/view/CreateLogicalViewNode.java | 474 ++++++------- .../fetcher/cache/SchemaCacheEntry.java | 54 +- .../plan/statement/StatementType.java | 4 +- .../plan/statement/StatementVisitor.java | 12 +- .../statement/crud/InsertBaseStatement.java | 215 +++--- .../crud/InsertMultiTabletsStatement.java | 34 +- .../statement/crud/InsertRowStatement.java | 238 +++---- .../crud/InsertRowsOfOneDeviceStatement.java | 42 +- .../statement/crud/InsertRowsStatement.java | 34 +- .../statement/crud/InsertTabletStatement.java | 242 +++---- .../view/CreateLogicalViewStatement.java | 414 +++++++----- .../schemaregion/ISchemaRegion.java | 52 +- .../schemaregion/SchemaRegionPlanType.java | 4 +- .../schemaregion/SchemaRegionPlanVisitor.java | 6 +- .../impl/SchemaRegionMemoryImpl.java | 34 +- .../impl/SchemaRegionPBTreeImpl.java | 6 +- .../visitor/SchemaRegionPlanDeserializer.java | 32 +- .../visitor/SchemaRegionPlanSerializer.java | 36 +- .../SchemaRegionPlanTxtSerializer.java | 40 +- .../impl/mem/MTreeBelowSGMemoryImpl.java | 148 ++-- .../mem/mnode/factory/MemMNodeFactory.java | 8 +- .../impl/mem/mnode/impl/MeasurementMNode.java | 10 +- .../impl/mem/mnode/info/LogicalViewInfo.java | 294 ++++---- .../impl/mem/mnode/info/TreeDeviceInfo.java | 4 +- .../mem/snapshot/MemMTreeSnapshotUtil.java | 30 +- .../impl/pbtree/MTreeBelowSGCachedImpl.java | 14 +- .../mnode/factory/CacheMNodeFactory.java | 8 +- .../mnode/impl/CachedMeasurementMNode.java | 10 +- .../pbtree/schemafile/MockSchemaFile.java | 4 +- .../collector/MeasurementCollector.java | 2 +- .../read/resp/info/IDeviceSchemaInfo.java | 2 +- .../read/resp/info/ITimeSeriesSchemaInfo.java | 6 +- .../resp/info/impl/ShowDevicesResult.java | 4 +- .../resp/info/impl/ShowTimeSeriesResult.java | 20 +- .../schemaregion/view/ViewPathType.java | 14 +- .../schemaregion/view/ViewPaths.java | 46 +- .../view/visitor/GetSourcePathsVisitor.java | 190 +++--- .../visitor/TransformToExpressionVisitor.java | 566 ++++++++-------- .../req/SchemaRegionWritePlanFactory.java | 4 +- .../impl/view/CreateLogicalViewPlanImpl.java | 148 ++-- .../req/view/ICreateLogicalViewPlan.java | 120 ++-- .../schemaRegion/SchemaRegionBasicTest.java | 616 ++++++++--------- .../schemaRegion/SchemaRegionTestUtil.java | 60 +- .../view/ViewExpressionToStringTest.java | 326 ++++----- .../iotdb/commons/path/MeasurementPath.java | 48 +- .../iotdb/commons/schema/SchemaConstant.java | 12 +- .../schema/column/ColumnHeaderConstant.java | 10 +- .../node/common/AbstractMeasurementMNode.java | 10 +- .../node/common/DeviceMNodeWrapper.java | 18 +- .../commons/schema/node/info/IDeviceInfo.java | 4 +- .../schema/node/role/IDeviceMNode.java | 6 +- .../schema/node/role/IMeasurementMNode.java | 2 +- .../schema/node/utils/IMNodeFactory.java | 4 +- .../schema/view/LogicalViewSchema.java | 460 ++++++------- .../view/viewExpression/ViewExpression.java | 636 +++++++++--------- .../viewExpression/ViewExpressionType.java | 152 ++--- .../binary/BinaryViewExpression.java | 242 +++---- .../arithmetic/AdditionViewExpression.java | 124 ++-- .../ArithmeticBinaryViewExpression.java | 106 +-- .../arithmetic/DivisionViewExpression.java | 124 ++-- .../arithmetic/ModuloViewExpression.java | 124 ++-- .../MultiplicationViewExpression.java | 126 ++-- .../arithmetic/SubtractionViewExpression.java | 124 ++-- .../compare/CompareBinaryViewExpression.java | 106 +-- .../binary/compare/EqualToViewExpression.java | 114 ++-- .../compare/GreaterEqualViewExpression.java | 114 ++-- .../compare/GreaterThanViewExpression.java | 114 ++-- .../compare/LessEqualViewExpression.java | 114 ++-- .../compare/LessThanViewExpression.java | 114 ++-- .../compare/NonEqualViewExpression.java | 114 ++-- .../binary/logic/LogicAndViewExpression.java | 114 ++-- .../logic/LogicBinaryViewExpression.java | 106 +-- .../binary/logic/LogicOrViewExpression.java | 114 ++-- .../leaf/ConstantViewOperand.java | 191 +++--- .../viewExpression/leaf/LeafViewOperand.java | 78 +-- .../viewExpression/leaf/NullViewOperand.java | 120 ++-- .../leaf/TimeSeriesViewOperand.java | 176 ++--- .../leaf/TimestampViewOperand.java | 142 ++-- .../multi/FunctionViewExpression.java | 366 +++++----- .../ternary/BetweenViewExpression.java | 224 +++--- .../ternary/TernaryViewExpression.java | 214 +++--- .../unary/InViewExpression.java | 214 +++--- .../unary/IsNullViewExpression.java | 180 ++--- .../unary/LikeViewExpression.java | 172 ++--- .../unary/LogicNotViewExpression.java | 124 ++-- .../unary/NegationViewExpression.java | 124 ++-- .../unary/RegularViewExpression.java | 202 +++--- .../unary/UnaryViewExpression.java | 146 ++-- .../visitor/ViewExpressionVisitor.java | 450 ++++++------- 141 files changed, 7267 insertions(+), 7171 deletions(-) diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBInsertAlignedValuesIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBInsertAlignedValuesIT.java index 1ac466653f6b0..f2e9d475393f5 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBInsertAlignedValuesIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBInsertAlignedValuesIT.java @@ -292,62 +292,62 @@ public void testInsertWithWrongType() throws SQLException { } @Test - public void testInsertAlignedTimeseriesWithoutAligned() throws SQLException { +// public void testInsertAlignedTimeseriesWithoutAligned() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.execute( "CREATE ALIGNED TIMESERIES root.lz.dev.GPS2(latitude INT32 encoding=PLAIN compressor=SNAPPY, longitude INT32 encoding=PLAIN compressor=SNAPPY) "); - statement.execute("insert into root.lz.dev.GPS2(time,latitude,longitude) values(1,123,456)"); - // it's supported. +// statement.execute("insert into root.lz.dev.GPS2(time,latitude,longitude) values(1,123,456)"); +// // it's supported. +// } +// } +// +// @Test +// public void testInsertTimeseriesWithUnMatchedAlignedType() throws SQLException { +// try (Connection connection = EnvFactory.getEnv().getConnection(); +// Statement statement = connection.createStatement()) { +// statement.execute("create ALIGNED timeseries root.db.d_aligned(s01 INT64 encoding=RLE)"); +// statement.execute("insert into root.db.d_aligned(time, s01) aligned values (4000, 123)"); +// statement.execute("insert into root.db.d_aligned(time, s01) values (5000, 456)"); +// statement.execute("create timeseries root.db.d_not_aligned.s01 INT64 encoding=RLE"); +// statement.execute("insert into root.db.d_not_aligned(time, s01) values (4000, 987)"); +// statement.execute("insert into root.db.d_not_aligned(time, s01) aligned values (5000, 654)"); +// +// try (ResultSet resultSet = statement.executeQuery("select s01 from root.db.d_aligned")) { +// assertTrue(resultSet.next()); +// assertEquals(4000, resultSet.getLong(1)); +// assertEquals(123, resultSet.getLong(2)); +// +// assertTrue(resultSet.next()); +// assertEquals(5000, resultSet.getLong(1)); +// assertEquals(456, resultSet.getLong(2)); +// +// assertFalse(resultSet.next()); +// } +// +// try (ResultSet resultSet = statement.executeQuery("select s01 from root.db.d_not_aligned")) { +// assertTrue(resultSet.next()); +// assertEquals(4000, resultSet.getLong(1)); +// assertEquals(987, resultSet.getLong(2)); +// +// assertTrue(resultSet.next()); +// assertEquals(5000, resultSet.getLong(1)); +// assertEquals(654, resultSet.getLong(2)); +// +// assertFalse(resultSet.next()); +// } } } @Test - public void testInsertTimeseriesWithUnMatchedAlignedType() throws SQLException { - try (Connection connection = EnvFactory.getEnv().getConnection(); - Statement statement = connection.createStatement()) { - statement.execute("create ALIGNED timeseries root.db.d_aligned(s01 INT64 encoding=RLE)"); - statement.execute("insert into root.db.d_aligned(time, s01) aligned values (4000, 123)"); - statement.execute("insert into root.db.d_aligned(time, s01) values (5000, 456)"); - statement.execute("create timeseries root.db.d_not_aligned.s01 INT64 encoding=RLE"); - statement.execute("insert into root.db.d_not_aligned(time, s01) values (4000, 987)"); - statement.execute("insert into root.db.d_not_aligned(time, s01) aligned values (5000, 654)"); - - try (ResultSet resultSet = statement.executeQuery("select s01 from root.db.d_aligned")) { - assertTrue(resultSet.next()); - assertEquals(4000, resultSet.getLong(1)); - assertEquals(123, resultSet.getLong(2)); - - assertTrue(resultSet.next()); - assertEquals(5000, resultSet.getLong(1)); - assertEquals(456, resultSet.getLong(2)); - - assertFalse(resultSet.next()); - } - - try (ResultSet resultSet = statement.executeQuery("select s01 from root.db.d_not_aligned")) { - assertTrue(resultSet.next()); - assertEquals(4000, resultSet.getLong(1)); - assertEquals(987, resultSet.getLong(2)); - - assertTrue(resultSet.next()); - assertEquals(5000, resultSet.getLong(1)); - assertEquals(654, resultSet.getLong(2)); - - assertFalse(resultSet.next()); - } - } - } - - @Test - public void testInsertNonAlignedTimeseriesWithAligned() throws SQLException { +// public void testInsertNonAlignedTimeseriesWithAligned() throws SQLException { try (Connection connection = EnvFactory.getEnv().getConnection(); Statement statement = connection.createStatement()) { statement.execute("CREATE TIMESERIES root.lz.dev.GPS3.latitude with datatype=INT32"); statement.execute("CREATE TIMESERIES root.lz.dev.GPS3.longitude with datatype=INT32"); statement.execute( - "insert into root.lz.dev.GPS3(time,latitude,longitude) aligned values(1,123,456)"); - // it's supported. +// "insert into root.lz.dev.GPS3(time,latitude,longitude) aligned values(1,123,456)"); +// // it's supported. } } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBResultSetIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBResultSetIT.java index 33648973284a5..70eeeffbd7456 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBResultSetIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBResultSetIT.java @@ -177,8 +177,8 @@ public void emptyShowTimeseriesTest() { + ColumnHeaderConstant.DEADBAND + "," + ColumnHeaderConstant.DEADBAND_PARAMETERS - + "," - + ColumnHeaderConstant.VIEW_TYPE +// + "," +// + ColumnHeaderConstant.VIEW_TYPE + ","; resultSetEqualTest("show timeseries root.sg1.**", expectedHeader, emptyResultSet); } diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/selectinto/IoTDBSelectIntoIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/selectinto/IoTDBSelectIntoIT.java index 620e2718b04d9..c368249b6d3df 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/selectinto/IoTDBSelectIntoIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/selectinto/IoTDBSelectIntoIT.java @@ -336,36 +336,36 @@ public void testExpression() { "select k1, k2, k3 from root.sg_expr.d;", expectedQueryHeader, queryRetArray); } - @Test - public void testUsingUnMatchedAlignment() { - String[] intoRetArray = - new String[] { - "root.sg.d1.s1,root.sg_bk1.new_aligned_d.t1,10,", - "root.sg.d2.s1,root.sg_bk1.new_aligned_d.t2,7,", - "root.sg.d1.s2,root.sg_bk1.new_aligned_d.t3,9,", - "root.sg.d2.s2,root.sg_bk1.new_aligned_d.t4,8,", - }; - executeNonQuery( - "CREATE ALIGNED TIMESERIES root.sg_bk1.new_aligned_d(t1 INT32, t2 INT32, t3 FLOAT, t4 FLOAT);"); - // use matched interface (aligned == aligned) - resultSetEqualTest( - "select s1, s2 into aligned root.sg_bk1.new_aligned_d(t1, t2, t3, t4) from root.sg.*;", - selectIntoHeader, - intoRetArray); - String expectedQueryHeader = - "Time,root.sg_bk1.new_aligned_d.t1,root.sg_bk1.new_aligned_d.t3,root.sg_bk1.new_aligned_d.t2,root.sg_bk1.new_aligned_d.t4,"; - resultSetEqualTest( - "select t1, t3, t2, t4 from root.sg_bk1.new_aligned_d;", expectedQueryHeader, rawDataSet); - - // use unmatched interface (non-aligned != aligned) - resultSetEqualTest( - "select s1, s2 into root.sg_bk1.new_aligned_d(t1, t2, t3, t4) from root.sg.*;", - selectIntoHeader, - intoRetArray); - resultSetEqualTest( - "select t1, t3, t2, t4 from root.sg_bk1.new_aligned_d;", expectedQueryHeader, rawDataSet); - } - +// @Test +// public void testUsingUnMatchedAlignment() { +// String[] intoRetArray = +// new String[] { +// "root.sg.d1.s1,root.sg_bk1.new_aligned_d.t1,10,", +// "root.sg.d2.s1,root.sg_bk1.new_aligned_d.t2,7,", +// "root.sg.d1.s2,root.sg_bk1.new_aligned_d.t3,9,", +// "root.sg.d2.s2,root.sg_bk1.new_aligned_d.t4,8,", +// }; +// executeNonQuery( +// "CREATE ALIGNED TIMESERIES root.sg_bk1.new_aligned_d(t1 INT32, t2 INT32, t3 FLOAT, t4 FLOAT);"); +// // use matched interface (aligned == aligned) +// resultSetEqualTest( +// "select s1, s2 into aligned root.sg_bk1.new_aligned_d(t1, t2, t3, t4) from root.sg.*;", +// selectIntoHeader, +// intoRetArray); +// String expectedQueryHeader = +// "Time,root.sg_bk1.new_aligned_d.t1,root.sg_bk1.new_aligned_d.t3,root.sg_bk1.new_aligned_d.t2,root.sg_bk1.new_aligned_d.t4,"; +// resultSetEqualTest( +// "select t1, t3, t2, t4 from root.sg_bk1.new_aligned_d;", expectedQueryHeader, rawDataSet); +// +// // use unmatched interface (non-aligned != aligned) +// resultSetEqualTest( +// "select s1, s2 into root.sg_bk1.new_aligned_d(t1, t2, t3, t4) from root.sg.*;", +// selectIntoHeader, +// intoRetArray); +// resultSetEqualTest( +// "select t1, t3, t2, t4 from root.sg_bk1.new_aligned_d;", expectedQueryHeader, rawDataSet); +// } +// // -------------------------------------- ALIGN BY DEVICE ------------------------------------- @Test diff --git a/iotdb-client/client-py/tests/integration/test_dataframe.py b/iotdb-client/client-py/tests/integration/test_dataframe.py index f314fbac18434..8b6e32b317837 100644 --- a/iotdb-client/client-py/tests/integration/test_dataframe.py +++ b/iotdb-client/client-py/tests/integration/test_dataframe.py @@ -71,7 +71,7 @@ def test_non_time_query(): "Attributes", "Deadband", "DeadbandParameters", - "ViewType", +// "ViewType", ] assert_array_equal( df.values, diff --git a/iotdb-core/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4 b/iotdb-core/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4 index 58f77da6c33e2..2d1241aef71ba 100644 --- a/iotdb-core/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4 +++ b/iotdb-core/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4 @@ -70,7 +70,7 @@ ddlStatement | callInference | loadModel | unloadModel // Quota | setSpaceQuota | showSpaceQuota | setThrottleQuota | showThrottleQuota - // View +// // View | createLogicalView | dropLogicalView | showLogicalView | renameLogicalView | alterLogicalView // Table View | createTableView @@ -767,11 +767,11 @@ showAIDevices : SHOW AI_DEVICES ; -// Create Logical View -createLogicalView - : CREATE VIEW viewTargetPaths AS viewSourcePaths - ; - +// // Create Logical View +// createLogicalView +// : CREATE VIEW viewTargetPaths AS viewSourcePaths +// ; +// showLogicalView : SHOW VIEW prefixPath? timeseriesWhereClause? rowPaginationClause? ; @@ -789,21 +789,21 @@ alterLogicalView | ALTER VIEW fullPath alterClause ; -viewSuffixPaths - : nodeNameWithoutWildcard (DOT nodeNameWithoutWildcard)* - ; - -viewTargetPaths - : fullPath (COMMA fullPath)* - | prefixPath LR_BRACKET viewSuffixPaths (COMMA viewSuffixPaths)* RR_BRACKET - ; - -viewSourcePaths - : fullPath (COMMA fullPath)* - | prefixPath LR_BRACKET viewSuffixPaths (COMMA viewSuffixPaths)* RR_BRACKET - | selectClause fromClause - ; - +// viewSuffixPaths +// : nodeNameWithoutWildcard (DOT nodeNameWithoutWildcard)* +// ; +// +// viewTargetPaths +// : fullPath (COMMA fullPath)* +// | prefixPath LR_BRACKET viewSuffixPaths (COMMA viewSuffixPaths)* RR_BRACKET +// ; +// +// viewSourcePaths +// : fullPath (COMMA fullPath)* +// | prefixPath LR_BRACKET viewSuffixPaths (COMMA viewSuffixPaths)* RR_BRACKET +// | selectClause fromClause +// ; +// // Table view createTableView : CREATE (OR REPLACE)? VIEW qualifiedName diff --git a/iotdb-core/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/SqlLexer.g4 b/iotdb-core/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/SqlLexer.g4 index 0efaf9fac3879..fcc3487affcce 100644 --- a/iotdb-core/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/SqlLexer.g4 +++ b/iotdb-core/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/SqlLexer.g4 @@ -1022,10 +1022,10 @@ VERSION : V E R S I O N ; -VIEW - : V I E W - ; - +// VIEW +// : V I E W +// ; +// WATERMARK_EMBEDDING : W A T E R M A R K '_' E M B E D D I N G ; diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/mnode/factory/ConfigMNodeFactory.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/mnode/factory/ConfigMNodeFactory.java index 382e7c6faf58a..d54c7064220e0 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/mnode/factory/ConfigMNodeFactory.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/mnode/factory/ConfigMNodeFactory.java @@ -73,10 +73,10 @@ public IConfigMNode createAboveDatabaseMNode(IConfigMNode parent, String name) { public IConfigMNode createInternalMNode(IConfigMNode parent, String name) { return new ConfigBasicInternalMNode(parent, name); } - - @Override - public IMeasurementMNode createLogicalViewMNode( +// +// @Override +// public IMeasurementMNode createLogicalViewMNode( IDeviceMNode parent, String name, IMeasurementSchema measurementSchema) { throw new UnsupportedOperationException("View is not supported."); - } +// } } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/DeleteLogicalViewProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/DeleteLogicalViewProcedure.java index 6b448e3257918..d3ab172bb5071 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/DeleteLogicalViewProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/DeleteLogicalViewProcedure.java @@ -37,7 +37,7 @@ import org.apache.iotdb.confignode.procedure.state.schema.DeleteLogicalViewState; import org.apache.iotdb.confignode.procedure.store.ProcedureType; import org.apache.iotdb.consensus.exception.ConsensusException; -import org.apache.iotdb.db.exception.metadata.view.ViewNotExistException; +// import org.apache.iotdb.db.exception.metadata.view.ViewNotExistException; import org.apache.iotdb.mpp.rpc.thrift.TConstructViewSchemaBlackListReq; import org.apache.iotdb.mpp.rpc.thrift.TDeleteViewSchemaReq; import org.apache.iotdb.mpp.rpc.thrift.TInvalidateMatchedSchemaCacheReq; @@ -102,7 +102,7 @@ protected Flow executeFromState( } else { setFailure( new ProcedureException( - new ViewNotExistException( +// new ViewNotExistException( patternTree.getAllPathPatterns().stream() .map(PartialPath::getFullPath) .collect(Collectors.toList())))); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/statemachine/schemaregion/SchemaExecutionVisitor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/statemachine/schemaregion/SchemaExecutionVisitor.java index 6b9ba0a261200..6ddfcffc2ebc6 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/statemachine/schemaregion/SchemaExecutionVisitor.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/statemachine/schemaregion/SchemaExecutionVisitor.java @@ -25,7 +25,7 @@ import org.apache.iotdb.commons.exception.MetadataException; import org.apache.iotdb.commons.path.MeasurementPath; import org.apache.iotdb.commons.path.PartialPath; -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; import org.apache.iotdb.db.exception.metadata.MeasurementAlreadyExistException; import org.apache.iotdb.db.exception.metadata.template.TemplateIsInUseException; import org.apache.iotdb.db.pipe.agent.PipeDataNodeAgent; @@ -591,28 +591,28 @@ public TSStatus visitDeactivateTemplate( } } - @Override +// @Override public TSStatus visitCreateLogicalView( final CreateLogicalViewNode node, final ISchemaRegion schemaRegion) { final Map viewPathToSourceMap = node.getViewPathToSourceExpressionMap(); final List failingStatus = new ArrayList<>(); for (final Map.Entry entry : viewPathToSourceMap.entrySet()) { - try { - schemaRegion.createLogicalView( +// try { +// schemaRegion.createLogicalView( SchemaRegionWritePlanFactory.getCreateLogicalViewPlan( entry.getKey(), entry.getValue())); } catch (final MetadataException e) { - logger.error("{}: MetaData error: ", IoTDBConstant.GLOBAL_DB_NAME, e); - failingStatus.add(RpcUtils.getStatus(e.getErrorCode(), e.getMessage())); - } - } - if (!failingStatus.isEmpty()) { - return RpcUtils.getStatus(failingStatus); - } - return RpcUtils.getStatus(TSStatusCode.SUCCESS_STATUS, "Execute successfully"); - } - +// logger.error("{}: MetaData error: ", IoTDBConstant.GLOBAL_DB_NAME, e); +// failingStatus.add(RpcUtils.getStatus(e.getErrorCode(), e.getMessage())); +// } +// } +// if (!failingStatus.isEmpty()) { +// return RpcUtils.getStatus(failingStatus); +// } +// return RpcUtils.getStatus(TSStatusCode.SUCCESS_STATUS, "Execute successfully"); +// } +// @Override public TSStatus visitAlterLogicalView( final AlterLogicalViewNode node, final ISchemaRegion schemaRegion) { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/DuplicateInsertException.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/DuplicateInsertException.java index be55fdf810e2c..46e5cdfea8809 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/DuplicateInsertException.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/DuplicateInsertException.java @@ -1,36 +1,36 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ -package org.apache.iotdb.db.exception.metadata; - -import org.apache.iotdb.commons.exception.MetadataException; -import org.apache.iotdb.rpc.TSStatusCode; - -public class DuplicateInsertException extends MetadataException { - - private static final String DUPLICATE_INSERTION_WRONG_MESSAGE = - "Insertion is illegal because measurement [%s] under device [%s] is duplicate."; - - public DuplicateInsertException(String device, String measurement) { - super( - String.format(DUPLICATE_INSERTION_WRONG_MESSAGE, measurement, device), - TSStatusCode.UNSUPPORTED_OPERATION.getStatusCode(), - true); - } -} +// package org.apache.iotdb.db.exception.metadata; +// +// import org.apache.iotdb.commons.exception.MetadataException; +// import org.apache.iotdb.rpc.TSStatusCode; +// +// public class DuplicateInsertException extends MetadataException { +// +// private static final String DUPLICATE_INSERTION_WRONG_MESSAGE = +// "Insertion is illegal because measurement [%s] under device [%s] is duplicate."; +// +// public DuplicateInsertException(String device, String measurement) { +// super( +// String.format(DUPLICATE_INSERTION_WRONG_MESSAGE, measurement, device), +// TSStatusCode.UNSUPPORTED_OPERATION.getStatusCode(), +// true); +// } +// } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/BrokenViewException.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/BrokenViewException.java index fe7eccb8dbd9f..23f1017be296a 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/BrokenViewException.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/BrokenViewException.java @@ -1,39 +1,39 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ -package org.apache.iotdb.db.exception.metadata.view; - -import org.apache.iotdb.commons.exception.MetadataException; -import org.apache.iotdb.commons.path.MeasurementPath; - -import java.util.List; - -public class BrokenViewException extends MetadataException { +// package org.apache.iotdb.db.exception.metadata.view; +// +// import org.apache.iotdb.commons.exception.MetadataException; +// import org.apache.iotdb.commons.path.MeasurementPath; +// +// import java.util.List; +// +// public class BrokenViewException extends MetadataException { public BrokenViewException(String sourcePath) { super(String.format("The source path [%s] is deleted", sourcePath)); } - public BrokenViewException(String sourcePath, List matchedPaths) { - super( - String.format( - "View is broken! The source path [%s] maps to unmatched %s path(s): %s.", +// public BrokenViewException(String sourcePath, List matchedPaths) { +// super( +// String.format( +// "View is broken! The source path [%s] maps to unmatched %s path(s): %s.", sourcePath, matchedPaths.size(), matchedPaths)); - } -} +// } +// } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/InsertNonWritableViewException.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/InsertNonWritableViewException.java index cec8d52dd9cd7..17fbf2bd060e2 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/InsertNonWritableViewException.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/InsertNonWritableViewException.java @@ -1,34 +1,34 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ -package org.apache.iotdb.db.exception.metadata.view; - -import org.apache.iotdb.commons.exception.MetadataException; - -public class InsertNonWritableViewException extends MetadataException { - public InsertNonWritableViewException(String path) { - super( - String.format( - "Can not insert data to a view which is not alias series. (View path: %s)", path)); - } - - public InsertNonWritableViewException() { - super("Can not insert data to a view which is not alias series."); - } -} +// package org.apache.iotdb.db.exception.metadata.view; +// +// import org.apache.iotdb.commons.exception.MetadataException; +// +// public class InsertNonWritableViewException extends MetadataException { +// public InsertNonWritableViewException(String path) { +// super( +// String.format( +// "Can not insert data to a view which is not alias series. (View path: %s)", path)); +// } +// +// public InsertNonWritableViewException() { +// super("Can not insert data to a view which is not alias series."); +// } +// } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/UnsupportedViewException.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/UnsupportedViewException.java index 4f8f333b6b61c..658f3b28af30c 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/UnsupportedViewException.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/UnsupportedViewException.java @@ -1,41 +1,41 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ -package org.apache.iotdb.db.exception.metadata.view; - -import org.apache.iotdb.commons.exception.MetadataException; -import org.apache.iotdb.rpc.TSStatusCode; - -public class UnsupportedViewException extends MetadataException { - - private static final String VIEW_IS_UNSUPPORTED = "View unsupported, because: %s"; - - public UnsupportedViewException(String message) { - super( - String.format(VIEW_IS_UNSUPPORTED, message), - TSStatusCode.UNSUPPORTED_OPERATION.getStatusCode()); - } - - public UnsupportedViewException(String message, boolean isUserException) { - super( - String.format(VIEW_IS_UNSUPPORTED, message), - TSStatusCode.UNSUPPORTED_OPERATION.getStatusCode(), - isUserException); - } -} +// package org.apache.iotdb.db.exception.metadata.view; +// +// import org.apache.iotdb.commons.exception.MetadataException; +// import org.apache.iotdb.rpc.TSStatusCode; +// +// public class UnsupportedViewException extends MetadataException { +// +// private static final String VIEW_IS_UNSUPPORTED = "View unsupported, because: %s"; +// +// public UnsupportedViewException(String message) { +// super( +// String.format(VIEW_IS_UNSUPPORTED, message), +// TSStatusCode.UNSUPPORTED_OPERATION.getStatusCode()); +// } +// +// public UnsupportedViewException(String message, boolean isUserException) { +// super( +// String.format(VIEW_IS_UNSUPPORTED, message), +// TSStatusCode.UNSUPPORTED_OPERATION.getStatusCode(), +// isUserException); +// } +// } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/ViewContainsAggregationException.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/ViewContainsAggregationException.java index 291e9dab0ea9f..87d0078388402 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/ViewContainsAggregationException.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/ViewContainsAggregationException.java @@ -1,30 +1,30 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ -package org.apache.iotdb.db.exception.metadata.view; - -public class ViewContainsAggregationException extends UnsupportedViewException { - - private static final String VIEW_CONTAINS_AGGREGATION_FUNCTION = - "This view contains aggregation function(s) named [%s]"; - - public ViewContainsAggregationException(String namesOfAggregationFunctions) { - super(String.format(VIEW_CONTAINS_AGGREGATION_FUNCTION, namesOfAggregationFunctions), true); - } -} +// package org.apache.iotdb.db.exception.metadata.view; +// +// public class ViewContainsAggregationException extends UnsupportedViewException { +// +// private static final String VIEW_CONTAINS_AGGREGATION_FUNCTION = +// "This view contains aggregation function(s) named [%s]"; +// +// public ViewContainsAggregationException(String namesOfAggregationFunctions) { +// super(String.format(VIEW_CONTAINS_AGGREGATION_FUNCTION, namesOfAggregationFunctions), true); +// } +// } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/ViewNotExistException.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/ViewNotExistException.java index dfa92696dc6ea..9c60b61aee8e2 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/ViewNotExistException.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/ViewNotExistException.java @@ -1,46 +1,46 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ -package org.apache.iotdb.db.exception.metadata.view; - -import org.apache.iotdb.commons.exception.MetadataException; -import org.apache.iotdb.rpc.TSStatusCode; - -import java.util.List; - -public class ViewNotExistException extends MetadataException { - - private static final String VIEW_NOT_EXIST_WRONG_MESSAGE = "View [%s] does not exist"; - - public ViewNotExistException(String path) { - super( - String.format(VIEW_NOT_EXIST_WRONG_MESSAGE, path), - TSStatusCode.PATH_NOT_EXIST.getStatusCode()); - } - - public ViewNotExistException(List paths) { - super( - String.format( - VIEW_NOT_EXIST_WRONG_MESSAGE, - paths.size() == 1 - ? paths.get(0) - : paths.get(0) + " ... " + paths.get(paths.size() - 1)), - TSStatusCode.PATH_NOT_EXIST.getStatusCode()); - } -} +// package org.apache.iotdb.db.exception.metadata.view; +// +// import org.apache.iotdb.commons.exception.MetadataException; +// import org.apache.iotdb.rpc.TSStatusCode; +// +// import java.util.List; +// +// public class ViewNotExistException extends MetadataException { +// +// private static final String VIEW_NOT_EXIST_WRONG_MESSAGE = "View [%s] does not exist"; +// +// public ViewNotExistException(String path) { +// super( +// String.format(VIEW_NOT_EXIST_WRONG_MESSAGE, path), +// TSStatusCode.PATH_NOT_EXIST.getStatusCode()); +// } +// +// public ViewNotExistException(List paths) { +// super( +// String.format( +// VIEW_NOT_EXIST_WRONG_MESSAGE, +// paths.size() == 1 +// ? paths.get(0) +// : paths.get(0) + " ... " + paths.get(paths.size() - 1)), +// TSStatusCode.PATH_NOT_EXIST.getStatusCode()); +// } +// } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/ClusterSchemaTree.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/ClusterSchemaTree.java index 05932e78b95a3..38f646fd31262 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/ClusterSchemaTree.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/ClusterSchemaTree.java @@ -21,10 +21,10 @@ import org.apache.iotdb.commons.path.MeasurementPath; import org.apache.iotdb.commons.path.PartialPath; -import org.apache.iotdb.commons.schema.view.LogicalViewSchema; +// import org.apache.iotdb.commons.schema.view.LogicalViewSchema; import org.apache.iotdb.commons.utils.PathUtils; import org.apache.iotdb.commons.utils.TestOnly; -import org.apache.iotdb.db.exception.metadata.PathNotExistException; +// import org.apache.iotdb.db.exception.metadata.PathNotExistException; import org.apache.iotdb.db.exception.sql.SemanticException; import org.apache.iotdb.db.queryengine.common.schematree.node.SchemaEntityNode; import org.apache.iotdb.db.queryengine.common.schematree.node.SchemaInternalNode; @@ -73,14 +73,14 @@ public class ClusterSchemaTree implements ISchemaTree { private final SchemaNode root; - /** a flag recording whether there is logical view in this schema tree. */ - private boolean hasLogicalMeasurementPath = false; +// /** a flag recording whether there is logical view in this schema tree. */ +// private boolean hasLogicalMeasurementPath = false; /** used to judge schema tree type */ private boolean hasNormalTimeSeries = false; private Map templateMap = new HashMap<>(); - +// private long ramBytesUsed; public ClusterSchemaTree() { @@ -205,7 +205,7 @@ public List compute( return indexOfTargetMeasurements; } SchemaEntityNode entityNode = cur.getAsEntityNode(); - boolean firstNonViewMeasurement = true; +// boolean firstNonViewMeasurement = true; List indexOfMissingMeasurements = new ArrayList<>(); for (int index : indexOfTargetMeasurements) { IMeasurementSchemaInfo measurementSchemaInfo = @@ -216,42 +216,42 @@ public List compute( if (firstNonViewMeasurement && !measurementSchemaInfo.isLogicalView()) { schemaComputation.computeDevice(cur.getAsEntityNode().isAligned()); firstNonViewMeasurement = false; - } +// } schemaComputation.computeMeasurement(index, measurementSchemaInfo); } } return indexOfMissingMeasurements; } - /** - * This function compute logical view and fill source of these views. It returns nothing ! If some - * source paths are missed, throw errors. - * - * @param schemaComputation the statement - * @param indexOfTargetLogicalView the index list of logicalViewSchemaList that you want to check +// /** +// * This function compute logical view and fill source of these views. It returns nothing ! If some +// * source paths are missed, throw errors. +// * +// * @param schemaComputation the statement +// * @param indexOfTargetLogicalView the index list of logicalViewSchemaList that you want to check * @throws SemanticException path not exist or different source path of view - */ - public void computeSourceOfLogicalView( +// */ +// public void computeSourceOfLogicalView( ISchemaComputation schemaComputation, List indexOfTargetLogicalView) throws SemanticException { - if (!schemaComputation.hasLogicalViewNeedProcess()) { - return; - } - List logicalViewSchemaList = schemaComputation.getLogicalViewSchemaList(); - for (Integer index : indexOfTargetLogicalView) { - LogicalViewSchema logicalViewSchema = logicalViewSchemaList.get(index); - PartialPath fullPath = logicalViewSchema.getSourcePathIfWritable(); - Pair, Integer> searchResult = this.searchMeasurementPaths(fullPath); - List measurementPathList = searchResult.left; +// if (!schemaComputation.hasLogicalViewNeedProcess()) { +// return; +// } +// List logicalViewSchemaList = schemaComputation.getLogicalViewSchemaList(); +// for (Integer index : indexOfTargetLogicalView) { +// LogicalViewSchema logicalViewSchema = logicalViewSchemaList.get(index); +// PartialPath fullPath = logicalViewSchema.getSourcePathIfWritable(); +// Pair, Integer> searchResult = this.searchMeasurementPaths(fullPath); +// List measurementPathList = searchResult.left; if (measurementPathList.isEmpty()) { throw new SemanticException( - new PathNotExistException( +// new PathNotExistException( fullPath.getFullPath(), schemaComputation .getDevicePath() .concatAsMeasurementPath(logicalViewSchema.getMeasurementName()) .getFullPath())); - } else if (measurementPathList.size() > 1) { +// } else if (measurementPathList.size() > 1) { throw new SemanticException( String.format( "The source paths [%s] of view [%s] are multiple.", @@ -259,22 +259,22 @@ public void computeSourceOfLogicalView( schemaComputation .getDevicePath() .concatAsMeasurementPath(logicalViewSchema.getMeasurementName()))); - } else { - Integer realIndex = schemaComputation.getIndexListOfLogicalViewPaths().get(index); - MeasurementPath measurementPath = measurementPathList.get(0); - schemaComputation.computeMeasurementOfView( - realIndex, - new MeasurementSchemaInfo( +// } else { +// Integer realIndex = schemaComputation.getIndexListOfLogicalViewPaths().get(index); +// MeasurementPath measurementPath = measurementPathList.get(0); +// schemaComputation.computeMeasurementOfView( +// realIndex, +// new MeasurementSchemaInfo( measurementPath.getMeasurement(), measurementPath.getMeasurementSchema(), null, measurementPath.getTagMap(), null), - measurementPath.isUnderAlignedEntity()); - } - } - } - +// measurementPath.isUnderAlignedEntity()); +// } +// } +// } +// /** * Append a template device to the schema tree. * @@ -327,7 +327,7 @@ public void appendMeasurementPaths(List measurementPathList) { public void appendSingleMeasurementPath(MeasurementPath measurementPath) { appendSingleMeasurement( measurementPath, - measurementPath.getMeasurementSchema(), +// measurementPath.getMeasurementSchema(), measurementPath.getTagMap(), null, measurementPath.isMeasurementAliasExists() ? measurementPath.getMeasurementAlias() : null, @@ -336,7 +336,7 @@ public void appendSingleMeasurementPath(MeasurementPath measurementPath) { public void appendSingleMeasurement( PartialPath path, - IMeasurementSchema schema, +// IMeasurementSchema schema, Map tagMap, Map attributeMap, String alias, @@ -380,13 +380,13 @@ public void appendSingleMeasurement( hasNormalTimeSeries = true; } - @Override - public void mergeSchemaTree(ISchemaTree schemaTree) { - if (schemaTree instanceof ClusterSchemaTree) { - this.mergeSchemaTree((ClusterSchemaTree) schemaTree); - } - } - +// @Override +// public void mergeSchemaTree(ISchemaTree schemaTree) { +// if (schemaTree instanceof ClusterSchemaTree) { +// this.mergeSchemaTree((ClusterSchemaTree) schemaTree); +// } +// } +// @Override public boolean hasNormalTimeSeries() { return hasNormalTimeSeries; @@ -407,8 +407,8 @@ public List getDeviceUsingTemplate(int templateId) { } public void mergeSchemaTree(ClusterSchemaTree schemaTree) { - this.hasLogicalMeasurementPath = - this.hasLogicalMeasurementPath || schemaTree.hasLogicalViewMeasurement(); +// this.hasLogicalMeasurementPath = +// this.hasLogicalMeasurementPath || schemaTree.hasLogicalViewMeasurement(); traverseAndMerge(this.root, null, schemaTree.root); this.templateMap.putAll(schemaTree.templateMap); this.hasNormalTimeSeries |= schemaTree.hasNormalTimeSeries; @@ -553,7 +553,7 @@ private void prepareNext() { stack.pop(); nextNode = currentNode; return; - } +// } } } } @@ -675,7 +675,7 @@ public Set getDatabases() { return databases; } - @Override +// @Override public void setDatabases(Set databases) { this.databases = databases; } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/DeviceSchemaInfo.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/DeviceSchemaInfo.java index ead892f3e62ef..83e7b8e440428 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/DeviceSchemaInfo.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/DeviceSchemaInfo.java @@ -64,9 +64,9 @@ public List getMeasurementSchemaList() { return measurementSchemaInfoList.stream() .map( measurementSchemaInfo -> - measurementSchemaInfo == null - ? null - : measurementSchemaInfo.getSchemaAsMeasurementSchema()) +// measurementSchemaInfo == null +// ? null +// : measurementSchemaInfo.getSchemaAsMeasurementSchema()) .collect(Collectors.toList()); } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/IMeasurementSchemaInfo.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/IMeasurementSchemaInfo.java index 5636363f800f4..6219fe5e1c898 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/IMeasurementSchemaInfo.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/IMeasurementSchemaInfo.java @@ -19,7 +19,7 @@ package org.apache.iotdb.db.queryengine.common.schematree; -import org.apache.iotdb.commons.schema.view.LogicalViewSchema; +// import org.apache.iotdb.commons.schema.view.LogicalViewSchema; import org.apache.tsfile.write.schema.IMeasurementSchema; import org.apache.tsfile.write.schema.MeasurementSchema; @@ -30,22 +30,22 @@ public interface IMeasurementSchemaInfo { String getName(); - IMeasurementSchema getSchema(); - +// IMeasurementSchema getSchema(); +// /** * If the IMeasurementSchema is MeasurementSchema, return itself; else return null. * * @return measurementSchema or null if IMeasurementSchema is not MeasurementSchema */ - MeasurementSchema getSchemaAsMeasurementSchema(); - - LogicalViewSchema getSchemaAsLogicalViewSchema(); +// MeasurementSchema getSchemaAsMeasurementSchema(); +// LogicalViewSchema getSchemaAsLogicalViewSchema(); +// Map getTagMap(); Map getAttributeMap(); String getAlias(); - - boolean isLogicalView(); +// +// boolean isLogicalView(); } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/ISchemaTree.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/ISchemaTree.java index 543991a6ff72c..43c2eb5eaf9c1 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/ISchemaTree.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/ISchemaTree.java @@ -75,12 +75,12 @@ Pair, Integer> searchMeasurementPaths( Set getDatabases(); - void setDatabases(Set databases); - +// void setDatabases(Set databases); +// boolean isEmpty(); - - void mergeSchemaTree(ISchemaTree schemaTree); - +// +// void mergeSchemaTree(ISchemaTree schemaTree); +// /** * Check whether this schema tree has normal series(not template series). * @@ -108,7 +108,7 @@ Pair, Integer> searchMeasurementPaths( * * @return whether there's view in this schema tree */ - boolean hasLogicalViewMeasurement(); +// boolean hasLogicalViewMeasurement(); void removeLogicalView(); } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/MeasurementSchemaInfo.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/MeasurementSchemaInfo.java index 9db3ebadbfded..0908f8a518902 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/MeasurementSchemaInfo.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/MeasurementSchemaInfo.java @@ -19,7 +19,7 @@ package org.apache.iotdb.db.queryengine.common.schematree; -import org.apache.iotdb.commons.schema.view.LogicalViewSchema; +// import org.apache.iotdb.commons.schema.view.LogicalViewSchema; import org.apache.tsfile.write.schema.IMeasurementSchema; import org.apache.tsfile.write.schema.MeasurementSchema; @@ -32,13 +32,13 @@ * measurement name, alias and MeasurementSchema, which are necessary to construct schemaTree for * Query and Insertion. */ -public class MeasurementSchemaInfo implements IMeasurementSchemaInfo { +// public class MeasurementSchemaInfo implements IMeasurementSchemaInfo { private final String name; private final String alias; private Map tagMap; private Map attributeMap; - private final IMeasurementSchema schema; +// private final IMeasurementSchema schema; public MeasurementSchemaInfo( String name, @@ -57,18 +57,18 @@ public String getName() { return name; } - public IMeasurementSchema getSchema() { +// public IMeasurementSchema getSchema() { return schema; } - public MeasurementSchema getSchemaAsMeasurementSchema() { - if (this.isLogicalView()) { - return null; - } else { - return (MeasurementSchema) this.schema; - } - } - +// public MeasurementSchema getSchemaAsMeasurementSchema() { +// if (this.isLogicalView()) { +// return null; +// } else { +// return (MeasurementSchema) this.schema; +// } +// } +// @Override public Map getTagMap() { return tagMap; @@ -79,20 +79,20 @@ public Map getAttributeMap() { return attributeMap; } - @Override - public LogicalViewSchema getSchemaAsLogicalViewSchema() { - if (this.isLogicalView()) { - return (LogicalViewSchema) this.schema; - } - return null; - } - +// @Override +// public LogicalViewSchema getSchemaAsLogicalViewSchema() { +// if (this.isLogicalView()) { +// return (LogicalViewSchema) this.schema; +// } +// return null; +// } +// public String getAlias() { return alias; } - - @Override - public boolean isLogicalView() { - return this.schema.isLogicalView(); - } +// +// @Override +// public boolean isLogicalView() { +// return this.schema.isLogicalView(); +// } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/node/SchemaMeasurementNode.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/node/SchemaMeasurementNode.java index 6f5bd07f08f05..3ba8cc9239294 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/node/SchemaMeasurementNode.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/node/SchemaMeasurementNode.java @@ -19,7 +19,7 @@ package org.apache.iotdb.db.queryengine.common.schematree.node; -import org.apache.iotdb.commons.schema.view.LogicalViewSchema; +// import org.apache.iotdb.commons.schema.view.LogicalViewSchema; import org.apache.iotdb.db.queryengine.common.schematree.IMeasurementSchemaInfo; import org.apache.tsfile.utils.RamUsageEstimator; @@ -39,11 +39,11 @@ public class SchemaMeasurementNode extends SchemaNode implements IMeasurementSch RamUsageEstimator.shallowSizeOfInstance(SchemaMeasurementNode.class); private String alias; - private IMeasurementSchema schema; +// private IMeasurementSchema schema; private Map tagMap; private Map attributeMap; - public SchemaMeasurementNode(String name, IMeasurementSchema schema) { +// public SchemaMeasurementNode(String name, IMeasurementSchema schema) { super(name); this.schema = schema; } @@ -68,35 +68,35 @@ public String getAlias() { return alias; } - @Override - public boolean isLogicalView() { - return this.schema.isLogicalView(); - } - +// @Override +// public boolean isLogicalView() { +// return this.schema.isLogicalView(); +// } +// public void setAlias(String alias) { this.alias = alias; } - public IMeasurementSchema getSchema() { +// public IMeasurementSchema getSchema() { return schema; } - @Override - public MeasurementSchema getSchemaAsMeasurementSchema() { - if (this.schema instanceof MeasurementSchema) { - return (MeasurementSchema) this.getSchema(); - } - return null; - } - - @Override - public LogicalViewSchema getSchemaAsLogicalViewSchema() { - if (this.schema instanceof LogicalViewSchema) { - return (LogicalViewSchema) this.getSchema(); - } - return null; - } - +// @Override +// public MeasurementSchema getSchemaAsMeasurementSchema() { +// if (this.schema instanceof MeasurementSchema) { +// return (MeasurementSchema) this.getSchema(); +// } +// return null; +// } +// +// @Override +// public LogicalViewSchema getSchemaAsLogicalViewSchema() { +// if (this.schema instanceof LogicalViewSchema) { +// return (LogicalViewSchema) this.getSchema(); +// } +// return null; +// } +// @Override public Map getTagMap() { return tagMap; @@ -138,7 +138,7 @@ public void copyDataTo(SchemaNode schemaNode) { measurementNode.setAlias(alias); } - private void setSchema(IMeasurementSchema schema) { +// private void setSchema(IMeasurementSchema schema) { this.schema = schema; } @@ -170,12 +170,12 @@ public void serializeNodeOwnContent(OutputStream outputStream) throws IOExceptio ReadWriteIOUtils.write(getType(), outputStream); ReadWriteIOUtils.write(name, outputStream); ReadWriteIOUtils.write(alias, outputStream); - - MeasurementSchemaType measurementSchemaType = schema.getSchemaType(); - ReadWriteIOUtils.write( - measurementSchemaType.getMeasurementSchemaTypeInByteEnum(), outputStream); +// +// MeasurementSchemaType measurementSchemaType = schema.getSchemaType(); +// ReadWriteIOUtils.write( +// measurementSchemaType.getMeasurementSchemaTypeInByteEnum(), outputStream); schema.serializeTo(outputStream); - +// ReadWriteIOUtils.write(tagMap, outputStream); ReadWriteIOUtils.write(attributeMap, outputStream); } @@ -183,17 +183,17 @@ public void serializeNodeOwnContent(OutputStream outputStream) throws IOExceptio public static SchemaMeasurementNode deserialize(InputStream inputStream) throws IOException { String name = ReadWriteIOUtils.readString(inputStream); String alias = ReadWriteIOUtils.readString(inputStream); - - IMeasurementSchema schema = null; +// +// IMeasurementSchema schema = null; byte measurementSchemaType = ReadWriteIOUtils.readByte(inputStream); - if (measurementSchemaType - == MeasurementSchemaType.MEASUREMENT_SCHEMA.getMeasurementSchemaTypeInByteEnum()) { - schema = MeasurementSchema.deserializeFrom(inputStream); - } else if (measurementSchemaType - == MeasurementSchemaType.LOGICAL_VIEW_SCHEMA.getMeasurementSchemaTypeInByteEnum()) { - schema = LogicalViewSchema.deserializeFrom(inputStream); - } - +// if (measurementSchemaType +// == MeasurementSchemaType.MEASUREMENT_SCHEMA.getMeasurementSchemaTypeInByteEnum()) { +// schema = MeasurementSchema.deserializeFrom(inputStream); +// } else if (measurementSchemaType +// == MeasurementSchemaType.LOGICAL_VIEW_SCHEMA.getMeasurementSchemaTypeInByteEnum()) { +// schema = LogicalViewSchema.deserializeFrom(inputStream); +// } +// Map tagMap = ReadWriteIOUtils.readMap(inputStream); Map attributeMap = ReadWriteIOUtils.readMap(inputStream); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/executor/RegionWriteExecutor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/executor/RegionWriteExecutor.java index f4aca5e157e1a..b8ff8f3f6990d 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/executor/RegionWriteExecutor.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/executor/RegionWriteExecutor.java @@ -1028,9 +1028,9 @@ private RegionExecutionResult executeInternalBatchActivateTemplate( context.getRegionWriteValidationRWLock().readLock().unlock(); } } - - @Override - public RegionExecutionResult visitCreateLogicalView( +// +// @Override +// public RegionExecutionResult visitCreateLogicalView( final CreateLogicalViewNode node, final WritePlanNodeExecutionContext context) { return executeCreateLogicalView(node, context, false); } @@ -1042,48 +1042,48 @@ private RegionExecutionResult executeCreateLogicalView( final ISchemaRegion schemaRegion = schemaEngine.getSchemaRegion((SchemaRegionId) context.getRegionId()); if (CONFIG.getSchemaRegionConsensusProtocolClass().equals(ConsensusFactory.RATIS_CONSENSUS)) { - context.getRegionWriteValidationRWLock().writeLock().lock(); - try { +// context.getRegionWriteValidationRWLock().writeLock().lock(); +// try { // step 1. make sure all target paths do NOT exist. final List targetPaths = node.getViewPathList(); final List failingMetadataException = new ArrayList<>(); for (final PartialPath thisPath : targetPaths) { - // no alias list for a view, so the third parameter is null +// // no alias list for a view, so the third parameter is null final Map failingMeasurementMap = - schemaRegion.checkMeasurementExistence( - thisPath.getDevicePath(), - Collections.singletonList(thisPath.getMeasurement()), - null); +// schemaRegion.checkMeasurementExistence( +// thisPath.getDevicePath(), +// Collections.singletonList(thisPath.getMeasurement()), +// null); // merge all exceptions into one map for (final Map.Entry entry : failingMeasurementMap.entrySet()) { - failingMetadataException.add(entry.getValue()); - } - } +// failingMetadataException.add(entry.getValue()); +// } +// } // if there are some exceptions, handle each exception and return first of them. - if (!failingMetadataException.isEmpty()) { +// if (!failingMetadataException.isEmpty()) { final MetadataException metadataException = failingMetadataException.get(0); LOGGER.info(METADATA_ERROR_MSG, metadataException.getMessage()); return RegionExecutionResult.create( false, metadataException.getMessage(), - RpcUtils.getStatus( - metadataException.getErrorCode(), metadataException.getMessage())); - } +// RpcUtils.getStatus( +// metadataException.getErrorCode(), metadataException.getMessage())); +// } // step 2. make sure all source paths exist. return receivedFromPipe ? super.visitPipeEnrichedWritePlanNode(new PipeEnrichedWritePlanNode(node), context) : super.visitCreateLogicalView(node, context); - } finally { - context.getRegionWriteValidationRWLock().writeLock().unlock(); - } - } else { +// } finally { +// context.getRegionWriteValidationRWLock().writeLock().unlock(); +// } +// } else { return receivedFromPipe ? super.visitPipeEnrichedWritePlanNode(new PipeEnrichedWritePlanNode(node), context) : super.visitCreateLogicalView(node, context); - } - // end of visitCreateLogicalView - } +// } +// // end of visitCreateLogicalView +// } @Override public RegionExecutionResult visitCreateOrUpdateTableDevice( diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/schema/source/LogicalViewSchemaSource.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/schema/source/LogicalViewSchemaSource.java index f1eaaebbd1ddc..b9cf02cf88454 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/schema/source/LogicalViewSchemaSource.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/schema/source/LogicalViewSchemaSource.java @@ -50,7 +50,7 @@ public class LogicalViewSchemaSource implements ISchemaSource templateMap; private final boolean needViewDetail; - +// TimeSeriesSchemaSource( PartialPath pathPattern, boolean isPrefixMatch, @@ -104,7 +104,7 @@ public void transformToTsBlockColumns( builder.writeNullableText(0, series.getFullPath()); builder.writeNullableText(1, series.getAlias()); builder.writeNullableText(2, database); - builder.writeNullableText(3, series.getSchema().getType().toString()); +// builder.writeNullableText(3, series.getSchema().getType().toString()); if (series.isLogicalView()) { builder.writeNullableText(4, null); builder.writeNullableText(5, null); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/Analysis.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/Analysis.java index 9235bc350889a..23d6850e65a76 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/Analysis.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/Analysis.java @@ -280,14 +280,14 @@ aggregation results last_value(temperature) and last_value(status), whereas buck // generated by combine the input path pattern and template set path private List specifiedTemplateRelatedPathPatternList; - ///////////////////////////////////////////////////////////////////////////////////////////////// - // Logical View Analysis - ///////////////////////////////////////////////////////////////////////////////////////////////// - +// ///////////////////////////////////////////////////////////////////////////////////////////////// +// // Logical View Analysis +// ///////////////////////////////////////////////////////////////////////////////////////////////// +// private boolean useLogicalView = false; - private List> outputExpressions = null; - +// private List> outputExpressions = null; +// ///////////////////////////////////////////////////////////////////////////////////////////////// // Show Queries Analysis ///////////////////////////////////////////////////////////////////////////////////////////////// @@ -871,26 +871,26 @@ public Map> getDeviceToSortItems() { public void setDeviceToSortItems(Map> deviceToSortItems) { this.deviceToSortItems = deviceToSortItems; } - - ///////////////////////////////////////////////////////////////////////////////////////////////// - // Logical View Analysis - ///////////////////////////////////////////////////////////////////////////////////////////////// - +// +// ///////////////////////////////////////////////////////////////////////////////////////////////// +// // Logical View Analysis +// ///////////////////////////////////////////////////////////////////////////////////////////////// +// public void setUseLogicalView(boolean useLogicalView) { this.useLogicalView = useLogicalView; - } - +// } +// public boolean useLogicalView() { return this.useLogicalView; - } - - public void setOutputExpressions(List> outputExpressions) { - this.outputExpressions = outputExpressions; - } - - public List> getOutputExpressions() { - return this.outputExpressions; - } +// } +// +// public void setOutputExpressions(List> outputExpressions) { +// this.outputExpressions = outputExpressions; +// } +// +// public List> getOutputExpressions() { +// return this.outputExpressions; +// } public Ordering getTimeseriesOrderingForLastQuery() { return timeseriesOrderingForLastQuery; diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/AnalyzeVisitor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/AnalyzeVisitor.java index 30e8426c707e3..d0e5643fdc67c 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/AnalyzeVisitor.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/AnalyzeVisitor.java @@ -36,14 +36,14 @@ import org.apache.iotdb.commons.path.PathPatternTree; import org.apache.iotdb.commons.schema.column.ColumnHeader; import org.apache.iotdb.commons.schema.column.ColumnHeaderConstant; -import org.apache.iotdb.commons.schema.view.LogicalViewSchema; -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.LogicalViewSchema; +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; import org.apache.iotdb.commons.utils.TimePartitionUtils; import org.apache.iotdb.db.conf.IoTDBConfig; import org.apache.iotdb.db.conf.IoTDBDescriptor; import org.apache.iotdb.db.exception.ainode.GetModelInfoException; import org.apache.iotdb.db.exception.metadata.template.TemplateIncompatibleException; -import org.apache.iotdb.db.exception.metadata.view.UnsupportedViewException; +// import org.apache.iotdb.db.exception.metadata.view.UnsupportedViewException; import org.apache.iotdb.db.exception.sql.SemanticException; import org.apache.iotdb.db.exception.sql.StatementAnalyzeException; import org.apache.iotdb.db.queryengine.common.DeviceContext; @@ -701,9 +701,9 @@ private void updateSchemaTreeByViews( for (PartialPath path : pathsNeedToReFetch) { patternTree.appendFullPath(path); needToReFetch = true; - } - } - } +// } +// } +// } } catch (Exception e) { throw new SemanticException(e); } @@ -721,9 +721,9 @@ private void updateSchemaTreeByViews( Set allDatabases = viewSchemaTree.getDatabases(); allDatabases.addAll(originSchemaTree.getDatabases()); originSchemaTree.setDatabases(allDatabases); - } - } - +// } +// } +// /** process select component for align by time + group by level. */ private List> analyzeGroupByLevelSelect( Analysis analysis, @@ -799,7 +799,7 @@ private List> analyzeSelect( Set aliasSet = new HashSet<>(); int columnIndex = 0; - +// for (ResultColumn resultColumn : queryStatement.getSelectComponent().getResultColumns()) { List> outputExpressions = new ArrayList<>(); List resultExpressions = @@ -2893,20 +2893,20 @@ public Analysis visitInsertRow(InsertRowStatement insertRowStatement, MPPQueryCo } analysis.setRealStatement(realInsertStatement); - if (realInsertStatement instanceof InsertRowStatement) { - InsertRowStatement realInsertRowStatement = (InsertRowStatement) realInsertStatement; - DataPartitionQueryParam dataPartitionQueryParam = new DataPartitionQueryParam(); +// if (realInsertStatement instanceof InsertRowStatement) { +// InsertRowStatement realInsertRowStatement = (InsertRowStatement) realInsertStatement; +// DataPartitionQueryParam dataPartitionQueryParam = new DataPartitionQueryParam(); dataPartitionQueryParam.setDeviceID( realInsertRowStatement.getDevicePath().getIDeviceIDAsFullDevice()); - dataPartitionQueryParam.setTimePartitionSlotList( - Collections.singletonList(realInsertRowStatement.getTimePartitionSlot())); +// dataPartitionQueryParam.setTimePartitionSlotList( +// Collections.singletonList(realInsertRowStatement.getTimePartitionSlot())); AnalyzeUtils.analyzeDataPartition( analysis, Collections.singletonList(dataPartitionQueryParam), context.getSession().getUserName(), partitionFetcher::getOrCreateDataPartition); - } else { +// } else { AnalyzeUtils.analyzeDataPartition( analysis, AnalyzeUtils.computeTreeDataPartitionParams(realInsertStatement, context), @@ -2917,8 +2917,8 @@ public Analysis visitInsertRow(InsertRowStatement insertRowStatement, MPPQueryCo } @Override - public Analysis visitInsertRows( - InsertRowsStatement insertRowsStatement, MPPQueryContext context) { +// public Analysis visitInsertRows( +// InsertRowsStatement insertRowsStatement, MPPQueryContext context) { context.setQueryType(QueryType.WRITE); insertRowsStatement.semanticCheck(); Analysis analysis = new Analysis(); @@ -2926,7 +2926,7 @@ public Analysis visitInsertRows( analysis, insertRowsStatement, () -> SchemaValidator.validate(schemaFetcher, insertRowsStatement, context)); - InsertRowsStatement realInsertRowsStatement = +// InsertRowsStatement realInsertRowsStatement = (InsertRowsStatement) removeLogicalView(analysis, insertRowsStatement); if (analysis.isFinishQueryAfterAnalyze()) { return analysis; @@ -2941,31 +2941,31 @@ public Analysis visitInsertRows( return analysis; } - @Override - public Analysis visitInsertMultiTablets( - InsertMultiTabletsStatement insertMultiTabletsStatement, MPPQueryContext context) { - context.setQueryType(QueryType.WRITE); +// @Override +// public Analysis visitInsertMultiTablets( +// InsertMultiTabletsStatement insertMultiTabletsStatement, MPPQueryContext context) { +// context.setQueryType(QueryType.WRITE); insertMultiTabletsStatement.semanticCheck(); - Analysis analysis = new Analysis(); +// Analysis analysis = new Analysis(); validateSchema( analysis, insertMultiTabletsStatement, () -> SchemaValidator.validate(schemaFetcher, insertMultiTabletsStatement, context)); - InsertMultiTabletsStatement realStatement = +// InsertMultiTabletsStatement realStatement = (InsertMultiTabletsStatement) removeLogicalView(analysis, insertMultiTabletsStatement); - if (analysis.isFinishQueryAfterAnalyze()) { - return analysis; - } +// if (analysis.isFinishQueryAfterAnalyze()) { +// return analysis; +// } analysis.setRealStatement(realStatement); - +// AnalyzeUtils.analyzeDataPartition( analysis, AnalyzeUtils.computeTreeDataPartitionParams(realStatement, context), context.getSession().getUserName(), partitionFetcher::getOrCreateDataPartition); return analysis; - } - +// } +// @Override public Analysis visitInsertRowsOfOneDevice( InsertRowsOfOneDeviceStatement insertRowsOfOneDeviceStatement, MPPQueryContext context) { @@ -2983,25 +2983,25 @@ public Analysis visitInsertRowsOfOneDevice( } analysis.setRealStatement(realInsertStatement); - if (realInsertStatement instanceof InsertRowsOfOneDeviceStatement) { - InsertRowsOfOneDeviceStatement realStatement = - (InsertRowsOfOneDeviceStatement) realInsertStatement; - DataPartitionQueryParam dataPartitionQueryParam = new DataPartitionQueryParam(); +// if (realInsertStatement instanceof InsertRowsOfOneDeviceStatement) { +// InsertRowsOfOneDeviceStatement realStatement = +// (InsertRowsOfOneDeviceStatement) realInsertStatement; +// DataPartitionQueryParam dataPartitionQueryParam = new DataPartitionQueryParam(); dataPartitionQueryParam.setDeviceID(realStatement.getDevicePath().getIDeviceIDAsFullDevice()); - dataPartitionQueryParam.setTimePartitionSlotList(realStatement.getTimePartitionSlots()); +// dataPartitionQueryParam.setTimePartitionSlotList(realStatement.getTimePartitionSlots()); AnalyzeUtils.analyzeDataPartition( analysis, Collections.singletonList(dataPartitionQueryParam), context.getSession().getUserName(), partitionFetcher::getOrCreateDataPartition); - } else { +// } else { AnalyzeUtils.analyzeDataPartition( analysis, AnalyzeUtils.computeTreeDataPartitionParams(realInsertStatement, context), context.getSession().getUserName(), partitionFetcher::getOrCreateDataPartition); - } +// } return analysis; } @@ -3803,9 +3803,9 @@ private void analyzeWhere(Analysis analysis, ShowQueriesStatement showQueriesSta analysis.setWhereExpression(whereExpression); } - +// // Region view - +// // Create Logical View @Override public Analysis visitCreateLogicalView( @@ -3852,61 +3852,61 @@ public Analysis visitCreateLogicalView( if (analysis.isFinishQueryAfterAnalyze()) { return analysis; } - } - +// } +// // Check target paths. checkTargetPathsInCreateLogicalView(analysis, createLogicalViewStatement, context); if (analysis.isFinishQueryAfterAnalyze()) { return analysis; - } - +// } +// // Set schema partition info, this info will be used to split logical plan node. PathPatternTree patternTree = new PathPatternTree(); for (PartialPath thisFullPath : createLogicalViewStatement.getTargetPathList()) { patternTree.appendFullPath(thisFullPath); - } +// } SchemaPartition schemaPartitionInfo = partitionFetcher.getOrCreateSchemaPartition( patternTree, context.getSession().getUserName()); analysis.setSchemaPartitionInfo(schemaPartitionInfo); return analysis; - } - - private Pair, Analysis> analyzeQueryInLogicalViewStatement( - Analysis analysis, QueryStatement queryStatement, MPPQueryContext context) { - Analysis queryAnalysis = this.visitQuery(queryStatement, context); +// } +// +// private Pair, Analysis> analyzeQueryInLogicalViewStatement( +// Analysis analysis, QueryStatement queryStatement, MPPQueryContext context) { +// Analysis queryAnalysis = this.visitQuery(queryStatement, context); analysis.setSchemaTree(queryAnalysis.getSchemaTree()); - // get all expression from resultColumns - List> outputExpressions = queryAnalysis.getOutputExpressions(); - if (queryAnalysis.isFailed()) { - analysis.setFinishQueryAfterAnalyze(true); - analysis.setFailStatus(queryAnalysis.getFailStatus()); - return new Pair<>(null, analysis); - } - if (outputExpressions == null) { - analysis.setFinishQueryAfterAnalyze(true); - analysis.setFailStatus( - RpcUtils.getStatus( - TSStatusCode.UNSUPPORTED_OPERATION.getStatusCode(), - "Columns in the query statement is empty. Please check your SQL.")); - return new Pair<>(null, analysis); - } +// // get all expression from resultColumns +// List> outputExpressions = queryAnalysis.getOutputExpressions(); +// if (queryAnalysis.isFailed()) { +// analysis.setFinishQueryAfterAnalyze(true); +// analysis.setFailStatus(queryAnalysis.getFailStatus()); +// return new Pair<>(null, analysis); +// } +// if (outputExpressions == null) { +// analysis.setFinishQueryAfterAnalyze(true); +// analysis.setFailStatus( +// RpcUtils.getStatus( +// TSStatusCode.UNSUPPORTED_OPERATION.getStatusCode(), +// "Columns in the query statement is empty. Please check your SQL.")); +// return new Pair<>(null, analysis); +// } if (queryAnalysis.useLogicalView()) { - analysis.setFinishQueryAfterAnalyze(true); - analysis.setFailStatus( - RpcUtils.getStatus( - TSStatusCode.UNSUPPORTED_OPERATION.getStatusCode(), - "Can not create a view based on existing views. Check the query in your SQL.")); - return new Pair<>(null, analysis); - } - List expressionList = new ArrayList<>(); - for (Pair thisPair : outputExpressions) { - expressionList.add(thisPair.left); - } - return new Pair<>(expressionList, analysis); - } - +// analysis.setFinishQueryAfterAnalyze(true); +// analysis.setFailStatus( +// RpcUtils.getStatus( +// TSStatusCode.UNSUPPORTED_OPERATION.getStatusCode(), +// "Can not create a view based on existing views. Check the query in your SQL.")); +// return new Pair<>(null, analysis); +// } +// List expressionList = new ArrayList<>(); +// for (Pair thisPair : outputExpressions) { +// expressionList.add(thisPair.left); +// } +// return new Pair<>(expressionList, analysis); +// } +// private void checkSourcePathsInCreateLogicalView( Analysis analysis, CreateLogicalViewStatement createLogicalViewStatement) { Pair checkResult = @@ -3938,46 +3938,47 @@ private void checkViewsInSource( List sourceExpressionList, MPPQueryContext context, boolean canSeeAuditDB) { - List pathsNeedCheck = new ArrayList<>(); - for (Expression expression : sourceExpressionList) { - if (expression instanceof TimeSeriesOperand) { - pathsNeedCheck.add(((TimeSeriesOperand) expression).getPath()); - } - } - Pair schemaOfNeedToCheck = - fetchSchemaOfPathsAndCount(pathsNeedCheck, analysis, context, canSeeAuditDB); - if (schemaOfNeedToCheck.right != pathsNeedCheck.size()) { +// Analysis analysis, List sourceExpressionList, MPPQueryContext context) { +// List pathsNeedCheck = new ArrayList<>(); +// for (Expression expression : sourceExpressionList) { +// if (expression instanceof TimeSeriesOperand) { +// pathsNeedCheck.add(((TimeSeriesOperand) expression).getPath()); +// } +// } +// Pair schemaOfNeedToCheck = + fetchSchemaOfPathsAndCount(pathsNeedCheck, analysis, context); +// if (schemaOfNeedToCheck.right != pathsNeedCheck.size()) { // Some source paths is not exist, and could not fetch schema. - analysis.setFinishQueryAfterAnalyze(true); - analysis.setFailStatus( - RpcUtils.getStatus( - TSStatusCode.UNSUPPORTED_OPERATION.getStatusCode(), - "Can not create a view based on non-exist time series.")); +// analysis.setFinishQueryAfterAnalyze(true); +// analysis.setFailStatus( +// RpcUtils.getStatus( +// TSStatusCode.UNSUPPORTED_OPERATION.getStatusCode(), +// "Can not create a view based on non-exist time series.")); return; - } - Pair, PartialPath> viewInSourceCheckResult = - findAllViewsInPaths(pathsNeedCheck, schemaOfNeedToCheck.left); - if (viewInSourceCheckResult.right != null) { +// } +// Pair, PartialPath> viewInSourceCheckResult = +// findAllViewsInPaths(pathsNeedCheck, schemaOfNeedToCheck.left); +// if (viewInSourceCheckResult.right != null) { // Some source paths is not exist - analysis.setFinishQueryAfterAnalyze(true); - analysis.setFailStatus( - RpcUtils.getStatus( - TSStatusCode.UNSUPPORTED_OPERATION.getStatusCode(), - "Path " - + viewInSourceCheckResult.right.toString() - + " does not exist! You can not create a view based on non-exist time series.")); +// analysis.setFinishQueryAfterAnalyze(true); +// analysis.setFailStatus( +// RpcUtils.getStatus( +// TSStatusCode.UNSUPPORTED_OPERATION.getStatusCode(), +// "Path " +// + viewInSourceCheckResult.right.toString() +// + " does not exist! You can not create a view based on non-exist time series.")); return; - } +// } if (!viewInSourceCheckResult.left.isEmpty()) { // Some source paths is logical view - analysis.setFinishQueryAfterAnalyze(true); - analysis.setFailStatus( - RpcUtils.getStatus( - TSStatusCode.UNSUPPORTED_OPERATION.getStatusCode(), - "Can not create a view based on existing views.")); - } - } - +// analysis.setFinishQueryAfterAnalyze(true); +// analysis.setFailStatus( +// RpcUtils.getStatus( +// TSStatusCode.UNSUPPORTED_OPERATION.getStatusCode(), +// "Can not create a view based on existing views.")); +// } +// } +// /** * Compute how many paths exist, get the schema tree and the number of existed paths. * @@ -4037,42 +4038,42 @@ private void checkTargetPathsInCreateLogicalView( final MPPQueryContext context) { final Pair checkResult = createLogicalViewStatement.checkTargetPaths(); if (Boolean.FALSE.equals(checkResult.left)) { - analysis.setFinishQueryAfterAnalyze(true); - analysis.setFailStatus( - RpcUtils.getStatus( - TSStatusCode.ILLEGAL_PATH.getStatusCode(), - "The path " + checkResult.right + " is illegal.")); +// analysis.setFinishQueryAfterAnalyze(true); +// analysis.setFailStatus( +// RpcUtils.getStatus( +// TSStatusCode.ILLEGAL_PATH.getStatusCode(), +// "The path " + checkResult.right + " is illegal.")); return; - } +// } // Make sure there are no redundant paths in targets. Note that redundant paths in source // are legal. final List targetPathList = createLogicalViewStatement.getTargetPathList(); final Set targetStringSet = new HashSet<>(); for (final PartialPath path : targetPathList) { final boolean repeatPathNotExist = targetStringSet.add(path.toString()); - if (!repeatPathNotExist) { - analysis.setFinishQueryAfterAnalyze(true); - analysis.setFailStatus( - RpcUtils.getStatus( - TSStatusCode.ILLEGAL_PATH.getStatusCode(), - String.format("Path [%s] is redundant in target paths.", path))); - return; - } - } +// if (!repeatPathNotExist) { +// analysis.setFinishQueryAfterAnalyze(true); +// analysis.setFailStatus( +// RpcUtils.getStatus( +// TSStatusCode.ILLEGAL_PATH.getStatusCode(), +// String.format("Path [%s] is redundant in target paths.", path))); +// return; +// } +// } // Make sure all paths are not under any templates - try { +// try { for (final PartialPath path : createLogicalViewStatement.getTargetPathList()) { checkIsTemplateCompatible(path, null, context); - } +// } } catch (final Exception e) { - analysis.setFinishQueryAfterAnalyze(true); - analysis.setFailStatus( - RpcUtils.getStatus( - TSStatusCode.UNSUPPORTED_OPERATION.getStatusCode(), - "Can not create view under template.")); - } - } - +// analysis.setFinishQueryAfterAnalyze(true); +// analysis.setFailStatus( +// RpcUtils.getStatus( +// TSStatusCode.UNSUPPORTED_OPERATION.getStatusCode(), +// "Can not create view under template.")); +// } +// } +// @Override public Analysis visitShowLogicalView( final ShowLogicalViewStatement showLogicalViewStatement, final MPPQueryContext context) { @@ -4089,7 +4090,7 @@ public Analysis visitShowLogicalView( return analysis; } - // endregion view +// // endregion view @Override public Analysis visitShowCurrentTimestamp( diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/ExpressionAnalyzer.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/ExpressionAnalyzer.java index a53ee3f7d323e..ae9b0b23624c0 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/ExpressionAnalyzer.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/ExpressionAnalyzer.java @@ -403,14 +403,14 @@ public static void constructPatternTreeFromExpression( } } - /** - * Bind schema ({@link PartialPath} -> {@link MeasurementPath}) and removes wildcards in - * Expression. And all logical view will be replaced. - * - * @param schemaTree interface for querying schema information - * @return the expression list after binding schema and whether there is logical view in - * expressions - */ +// /** +// * Bind schema ({@link PartialPath} -> {@link MeasurementPath}) and removes wildcards in +// * Expression. And all logical view will be replaced. +// * +// * @param schemaTree interface for querying schema information +// * @return the expression list after binding schema and whether there is logical view in +// * expressions +// */ public static List bindSchemaForExpression( final Expression expression, final ISchemaTree schemaTree, @@ -419,15 +419,15 @@ public static List bindSchemaForExpression( .process(expression, new BindSchemaForExpressionVisitor.Context(schemaTree, queryContext)); } - /** - * Concat suffix path in WHERE and HAVING clause with the prefix path in the FROM clause. And - * then, bind schema ({@link PartialPath} -> {@link MeasurementPath}) and removes wildcards in - * Expression. Logical view will be replaced. - * - * @param prefixPaths prefix paths in the FROM clause - * @param schemaTree interface for querying schema information - * @return the expression list with full path and after binding schema - */ +// /** +// * Concat suffix path in WHERE and HAVING clause with the prefix path in the FROM clause. And +// * then, bind schema ({@link PartialPath} -> {@link MeasurementPath}) and removes wildcards in +// * Expression. Logical view will be replaced. +// * +// * @param prefixPaths prefix paths in the FROM clause +// * @param schemaTree interface for querying schema information +// * @return the expression list with full path and after binding schema +// */ public static List bindSchemaForPredicate( final Expression predicate, final List prefixPaths, @@ -435,12 +435,12 @@ public static List bindSchemaForPredicate( final boolean isRoot, final MPPQueryContext queryContext) { return new BindSchemaForPredicateVisitor() - .process( +// .process( predicate, new BindSchemaForPredicateVisitor.Context( prefixPaths, schemaTree, isRoot, queryContext)); - } - +// } +// public static Expression replaceRawPathWithGroupedPath( Expression expression, GroupByLevelHelper.RawPathToGroupedPathMap rawPathToGroupedPathMap, diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/ClusterSchemaFetchExecutor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/ClusterSchemaFetchExecutor.java index 1a2b10d34489a..7c4a777054308 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/ClusterSchemaFetchExecutor.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/ClusterSchemaFetchExecutor.java @@ -19,7 +19,7 @@ package org.apache.iotdb.db.queryengine.plan.analyze.schema; -import org.apache.iotdb.commons.exception.IllegalPathException; +// import org.apache.iotdb.commons.exception.IllegalPathException; import org.apache.iotdb.commons.exception.IoTDBException; import org.apache.iotdb.commons.exception.MetadataException; import org.apache.iotdb.commons.exception.QuerySchemaFetchFailedException; @@ -208,24 +208,24 @@ ClusterSchemaTree fetchSchemaOfMultiDevices( } ClusterSchemaTree fetchSchemaWithFullPaths(List fullPathList, MPPQueryContext context) { - PathPatternTree patternTree = new PathPatternTree(); - for (String fullPath : fullPathList) { - try { +// PathPatternTree patternTree = new PathPatternTree(); +// for (String fullPath : fullPathList) { +// try { patternTree.appendFullPath(new MeasurementPath(fullPath)); - } catch (IllegalPathException e) { - throw new RuntimeException(e); - } - } - patternTree.constructTree(); +// } catch (IllegalPathException e) { +// throw new RuntimeException(e); +// } +// } +// patternTree.constructTree(); return fetchSchemaAndCacheResult(patternTree, context); - } - +// } +// ClusterSchemaTree fetchSchemaWithPatternTreeAndCache( PathPatternTree patternTree, MPPQueryContext context) { - patternTree.constructTree(); +// patternTree.constructTree(); return fetchSchemaAndCacheResult(patternTree, context); - } - +// } +// private ClusterSchemaTree fetchSchemaAndCacheResult( PathPatternTree patternTree, MPPQueryContext context) { ClusterSchemaTree schemaTree = @@ -338,8 +338,8 @@ private void parseFetchedData( } } catch (MemoryNotEnoughException e) { throw e; - } catch (Exception e) { - throw new RuntimeException(e); +// } catch (Exception e) { +// throw new RuntimeException(e); } } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/ISchemaComputation.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/ISchemaComputation.java index c0934b2dcc5ce..125a9b69687e7 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/ISchemaComputation.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/ISchemaComputation.java @@ -20,12 +20,12 @@ package org.apache.iotdb.db.queryengine.plan.analyze.schema; import org.apache.iotdb.commons.path.PartialPath; -import org.apache.iotdb.commons.schema.view.LogicalViewSchema; +// import org.apache.iotdb.commons.schema.view.LogicalViewSchema; import org.apache.iotdb.db.queryengine.common.schematree.IMeasurementSchemaInfo; import org.apache.tsfile.utils.Pair; - -import java.util.List; +// +// import java.util.List; /** * This interface defines the required behaviour invoked during schema fetch/computation, which is @@ -47,41 +47,41 @@ public interface ISchemaComputation { * @param measurementSchemaInfo the measurement schema of fetched measurement */ void computeMeasurement(int index, IMeasurementSchemaInfo measurementSchemaInfo); - - // region used by logical view - boolean hasLogicalViewNeedProcess(); - - /** - * @return the logical view schema list recorded by this statement. It may be NULL if it is not - * used before. - */ - List getLogicalViewSchemaList(); - - /** - * @return the index list of logical view paths, where source of views should be placed. For - * example, IndexListOfLogicalViewPaths[alpha] = beta, then you should use - * LogicalViewSchemaList[alpha] to fill measurementSchema[beta]. - */ - List getIndexListOfLogicalViewPaths(); - - /** - * Record the beginning and ending of logical schema list. After calling this interface, the range - * should be record. For example, the range is [0,4) which means 4 schemas exist. Later, more 3 - * schemas are added, this function is called, then it records [4,7). - */ - void recordRangeOfLogicalViewSchemaListNow(); - +// +// // region used by logical view +// boolean hasLogicalViewNeedProcess(); +// +// /** +// * @return the logical view schema list recorded by this statement. It may be NULL if it is not +// * used before. +// */ +// List getLogicalViewSchemaList(); +// +// /** +// * @return the index list of logical view paths, where source of views should be placed. For +// * example, IndexListOfLogicalViewPaths[alpha] = beta, then you should use +// * LogicalViewSchemaList[alpha] to fill measurementSchema[beta]. +// */ +// List getIndexListOfLogicalViewPaths(); +// +// /** +// * Record the beginning and ending of logical schema list. After calling this interface, the range +// * should be record. For example, the range is [0,4) which means 4 schemas exist. Later, more 3 +// * schemas are added, this function is called, then it records [4,7). +// */ +// void recordRangeOfLogicalViewSchemaListNow(); +// /** * @return the recorded range of logical view schema list. */ - Pair getRangeOfLogicalViewSchemaListRecorded(); - - /** - * @param index the index of fetched measurement in array returned by getMeasurements - * @param measurementSchemaInfo the measurement schema of source of the logical view - * @param isAligned whether the source of this view is aligned. - */ - void computeMeasurementOfView( - int index, IMeasurementSchemaInfo measurementSchemaInfo, boolean isAligned); - // endregion +// Pair getRangeOfLogicalViewSchemaListRecorded(); +// +// /** +// * @param index the index of fetched measurement in array returned by getMeasurements +// * @param measurementSchemaInfo the measurement schema of source of the logical view +// * @param isAligned whether the source of this view is aligned. +// */ +// void computeMeasurementOfView( +// int index, IMeasurementSchemaInfo measurementSchemaInfo, boolean isAligned); +// // endregion } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/ISchemaValidation.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/ISchemaValidation.java index 658cd2ef79d29..86fcd7a032a63 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/ISchemaValidation.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/ISchemaValidation.java @@ -34,22 +34,22 @@ default void computeMeasurement(int index, IMeasurementSchemaInfo measurementSch validateMeasurementSchema(index, measurementSchemaInfo); } - @Override - default void computeMeasurementOfView( - int index, IMeasurementSchemaInfo measurementSchemaInfo, boolean isAligned) { - validateMeasurementSchema(index, measurementSchemaInfo, isAligned); - } - - /** - * Record the real value of isAligned of this device. This will change the value of - * isAligned in this insert statement. - * - * @param isAligned The real value of attribute isAligned of this device schema - */ +// @Override +// default void computeMeasurementOfView( +// int index, IMeasurementSchemaInfo measurementSchemaInfo, boolean isAligned) { +// validateMeasurementSchema(index, measurementSchemaInfo, isAligned); +// } +// +// /** +// * Record the real value of isAligned of this device. This will change the value of +// * isAligned in this insert statement. +// * +// * @param isAligned The real value of attribute isAligned of this device schema +// */ void validateDeviceSchema(boolean isAligned); void validateMeasurementSchema(int index, IMeasurementSchemaInfo measurementSchemaInfo); - - void validateMeasurementSchema( - int index, IMeasurementSchemaInfo measurementSchemaInfo, boolean isAligned); +// +// void validateMeasurementSchema( +// int index, IMeasurementSchemaInfo measurementSchemaInfo, boolean isAligned); } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/NormalSchemaFetcher.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/NormalSchemaFetcher.java index 59bb199acf0e6..6673205610d62 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/NormalSchemaFetcher.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/NormalSchemaFetcher.java @@ -19,13 +19,15 @@ package org.apache.iotdb.db.queryengine.plan.analyze.schema; -import org.apache.iotdb.commons.exception.IllegalPathException; +// import org.apache.iotdb.commons.exception.IllegalPathException; import org.apache.iotdb.commons.path.MeasurementPath; -import org.apache.iotdb.commons.path.PartialPath; -import org.apache.iotdb.commons.path.PathPatternTree; +// import org.apache.iotdb.commons.path.PartialPath; +// import org.apache.iotdb.commons.path.PathPatternTree; import org.apache.iotdb.commons.pipe.config.constant.SystemConstant; import org.apache.iotdb.db.conf.IoTDBConfig; import org.apache.iotdb.db.conf.IoTDBDescriptor; +// import org.apache.iotdb.db.exception.metadata.AlignedTimeseriesException; +import org.apache.iotdb.db.exception.sql.SemanticException; import org.apache.iotdb.db.queryengine.common.MPPQueryContext; import org.apache.iotdb.db.queryengine.common.schematree.ClusterSchemaTree; import org.apache.iotdb.db.queryengine.plan.relational.metadata.fetcher.cache.TreeDeviceSchemaCacheManager; @@ -55,121 +57,121 @@ class NormalSchemaFetcher { this.clusterSchemaFetchExecutor = clusterSchemaFetchExecutor; } - /** Given full paths will be */ - private void computePatternTreeNeededReFetch( - PathPatternTree patternTree, List fullPaths) { - for (String fullPath : fullPaths) { - try { +// /** Given full paths will be */ +// private void computePatternTreeNeededReFetch( +// PathPatternTree patternTree, List fullPaths) { +// for (String fullPath : fullPaths) { +// try { patternTree.appendFullPath(new MeasurementPath(fullPath)); - } catch (IllegalPathException e) { - throw new RuntimeException(e); - } - } - } - - private PathPatternTree computePatternTreeNeededReFetch( - PartialPath devicePath, - String[] measurementList, - List indexOfMissingMeasurements, - List fullPaths) { - PathPatternTree patternTree = new PathPatternTree(); - for (int index : indexOfMissingMeasurements) { - patternTree.appendFullPath(devicePath, measurementList[index]); - } - for (String fullPath : fullPaths) { - try { +// } catch (IllegalPathException e) { +// throw new RuntimeException(e); +// } +// } +// } +// +// private PathPatternTree computePatternTreeNeededReFetch( +// PartialPath devicePath, +// String[] measurementList, +// List indexOfMissingMeasurements, +// List fullPaths) { +// PathPatternTree patternTree = new PathPatternTree(); +// for (int index : indexOfMissingMeasurements) { +// patternTree.appendFullPath(devicePath, measurementList[index]); +// } +// for (String fullPath : fullPaths) { +// try { patternTree.appendFullPath(new MeasurementPath(fullPath)); - } catch (IllegalPathException e) { - throw new RuntimeException(e); - } - } - return patternTree; - } - - private PathPatternTree computePatternTreeNeededReFetch( - List devicePathList, - List measurementsList, - List indexOfTargetDevices, - List> indexOfTargetMeasurementsList) { - PathPatternTree patternTree = new PathPatternTree(); - int deviceIndex; - for (int i = 0, size = indexOfTargetDevices.size(); i < size; i++) { - deviceIndex = indexOfTargetDevices.get(i); - for (int measurementIndex : indexOfTargetMeasurementsList.get(i)) { - patternTree.appendFullPath( - devicePathList.get(deviceIndex), measurementsList.get(deviceIndex)[measurementIndex]); - } - } - return patternTree; - } - +// } catch (IllegalPathException e) { +// throw new RuntimeException(e); +// } +// } +// return patternTree; +// } +// +// private PathPatternTree computePatternTreeNeededReFetch( +// List devicePathList, +// List measurementsList, +// List indexOfTargetDevices, +// List> indexOfTargetMeasurementsList) { +// PathPatternTree patternTree = new PathPatternTree(); +// int deviceIndex; +// for (int i = 0, size = indexOfTargetDevices.size(); i < size; i++) { +// deviceIndex = indexOfTargetDevices.get(i); +// for (int measurementIndex : indexOfTargetMeasurementsList.get(i)) { +// patternTree.appendFullPath( +// devicePathList.get(deviceIndex), measurementsList.get(deviceIndex)[measurementIndex]); +// } +// } +// return patternTree; +// } +// List processNormalTimeSeries( ISchemaComputationWithAutoCreation schemaComputationWithAutoCreation, MPPQueryContext context) { - // [Step 0] Record the input value. - boolean isAlignedPutIn = schemaComputationWithAutoCreation.isAligned(); - - // [Step 1] Cache 1. compute measurements and record logical views. +// // [Step 0] Record the input value. +// boolean isAlignedPutIn = schemaComputationWithAutoCreation.isAligned(); +// +// // [Step 1] Cache 1. compute measurements and record logical views. List indexOfMissingMeasurements = schemaCache.computeWithoutTemplate(schemaComputationWithAutoCreation); - // [Step 2] Cache 2. process recorded logical views. If there is no views now, it returns empty - // lists. - Pair, List> missedIndexAndPathString = - schemaCache.computeSourceOfLogicalView(schemaComputationWithAutoCreation); - List indexOfMissingLogicalView = missedIndexAndPathString.left; - List missedPathStringOfLogicalView = missedIndexAndPathString.right; +// // [Step 2] Cache 2. process recorded logical views. If there is no views now, it returns empty +// // lists. +// Pair, List> missedIndexAndPathString = +// schemaCache.computeSourceOfLogicalView(schemaComputationWithAutoCreation); +// List indexOfMissingLogicalView = missedIndexAndPathString.left; +// List missedPathStringOfLogicalView = missedIndexAndPathString.right; // all schema can be taken from cache - if (indexOfMissingMeasurements.isEmpty() && indexOfMissingLogicalView.isEmpty()) { +// if (indexOfMissingMeasurements.isEmpty() && indexOfMissingLogicalView.isEmpty()) { return indexOfMissingMeasurements; } - // [Step 3] Fetch 1. fetch schema from remote. Process logical view first; then process - // measurements. - // try fetch the missing raw schema from remote and cache fetched schema - ClusterSchemaTree remoteSchemaTree; - if (missedPathStringOfLogicalView.isEmpty()) { - remoteSchemaTree = - clusterSchemaFetchExecutor.fetchSchemaOfOneDevice( - schemaComputationWithAutoCreation.getDevicePath(), - schemaComputationWithAutoCreation.getMeasurements(), +// // [Step 3] Fetch 1. fetch schema from remote. Process logical view first; then process +// // measurements. +// // try fetch the missing raw schema from remote and cache fetched schema +// ClusterSchemaTree remoteSchemaTree; +// if (missedPathStringOfLogicalView.isEmpty()) { +// remoteSchemaTree = +// clusterSchemaFetchExecutor.fetchSchemaOfOneDevice( +// schemaComputationWithAutoCreation.getDevicePath(), +// schemaComputationWithAutoCreation.getMeasurements(), indexOfMissingMeasurements, context); - } else { - PathPatternTree patternTree = - computePatternTreeNeededReFetch( - schemaComputationWithAutoCreation.getDevicePath(), - schemaComputationWithAutoCreation.getMeasurements(), - indexOfMissingMeasurements, - missedPathStringOfLogicalView); +// } else { +// PathPatternTree patternTree = +// computePatternTreeNeededReFetch( +// schemaComputationWithAutoCreation.getDevicePath(), +// schemaComputationWithAutoCreation.getMeasurements(), +// indexOfMissingMeasurements, +// missedPathStringOfLogicalView); remoteSchemaTree = clusterSchemaFetchExecutor.fetchSchemaWithPatternTreeAndCache(patternTree, context); - } - // make sure all missed views are computed. - remoteSchemaTree.computeSourceOfLogicalView( - schemaComputationWithAutoCreation, indexOfMissingLogicalView); +// } +// // make sure all missed views are computed. +// remoteSchemaTree.computeSourceOfLogicalView( +// schemaComputationWithAutoCreation, indexOfMissingLogicalView); // check and compute the fetched schema indexOfMissingMeasurements = remoteSchemaTree.compute(schemaComputationWithAutoCreation, indexOfMissingMeasurements); - schemaComputationWithAutoCreation.recordRangeOfLogicalViewSchemaListNow(); - - // [Step 4] Fetch 2. Some fetched measurements in [Step 3] are views. Process them. - missedIndexAndPathString = - schemaCache.computeSourceOfLogicalView(schemaComputationWithAutoCreation); - indexOfMissingLogicalView = missedIndexAndPathString.left; - missedPathStringOfLogicalView = missedIndexAndPathString.right; - if (!missedPathStringOfLogicalView.isEmpty()) { - ClusterSchemaTree viewSchemaTree = +// schemaComputationWithAutoCreation.recordRangeOfLogicalViewSchemaListNow(); +// +// // [Step 4] Fetch 2. Some fetched measurements in [Step 3] are views. Process them. +// missedIndexAndPathString = +// schemaCache.computeSourceOfLogicalView(schemaComputationWithAutoCreation); +// indexOfMissingLogicalView = missedIndexAndPathString.left; +// missedPathStringOfLogicalView = missedIndexAndPathString.right; +// if (!missedPathStringOfLogicalView.isEmpty()) { +// ClusterSchemaTree viewSchemaTree = clusterSchemaFetchExecutor.fetchSchemaWithFullPaths( missedPathStringOfLogicalView, context); - viewSchemaTree.computeSourceOfLogicalView( - schemaComputationWithAutoCreation, indexOfMissingLogicalView); - } +// viewSchemaTree.computeSourceOfLogicalView( +// schemaComputationWithAutoCreation, indexOfMissingLogicalView); +// } // all schema has been taken and processed if (indexOfMissingMeasurements.isEmpty()) { return indexOfMissingMeasurements; } - // [Step 5] Auto Create and process the missing schema +// // [Step 5] Auto Create and process the missing schema if (config.isAutoCreateSchemaEnabled() || schemaComputationWithAutoCreation .getDevicePath() @@ -177,13 +179,16 @@ List processNormalTimeSeries( || schemaComputationWithAutoCreation .getDevicePath() .startsWith("root." + SystemConstant.AUDIT_PREFIX_KEY)) { - // Check the isAligned value. If the input value is different from the actual value of the - // existing device, throw exception. - PartialPath devicePath = schemaComputationWithAutoCreation.getDevicePath(); + .startsWith("root." + SystemConstant.SYSTEM_PREFIX_KEY)) { +// // Check the isAligned value. If the input value is different from the actual value of the +// // existing device, throw exception. +// PartialPath devicePath = schemaComputationWithAutoCreation.getDevicePath(); +// validateIsAlignedValueIfAutoCreate( +// schemaComputationWithAutoCreation.isAligned(), isAlignedPutIn, devicePath); ClusterSchemaTree schemaTree = new ClusterSchemaTree(); autoCreateSchemaExecutor.autoCreateTimeSeries( schemaTree, - devicePath, +// devicePath, indexOfMissingMeasurements, schemaComputationWithAutoCreation.getMeasurements(), schemaComputationWithAutoCreation::getDataType, @@ -199,84 +204,84 @@ List processNormalTimeSeries( void processNormalTimeSeries( List schemaComputationWithAutoCreationList, MPPQueryContext context) { - // [Step 0] Record the input value. +// // [Step 0] Record the input value. List isAlignedPutInList = schemaComputationWithAutoCreationList.stream() .map(ISchemaComputationWithAutoCreation::isAligned) .collect(Collectors.toList()); - - // [Step 1] Cache 1. compute measurements and record logical views. +// +// // [Step 1] Cache 1. compute measurements and record logical views. List indexOfDevicesWithMissingMeasurements = new ArrayList<>(); List> indexOfMissingMeasurementsList = new ArrayList<>(schemaComputationWithAutoCreationList.size()); List indexOfMissingMeasurements; for (int i = 0, size = schemaComputationWithAutoCreationList.size(); i < size; i++) { indexOfMissingMeasurements = - schemaCache.computeWithoutTemplate(schemaComputationWithAutoCreationList.get(i)); +// schemaCache.computeWithoutTemplate(schemaComputationWithAutoCreationList.get(i)); if (!indexOfMissingMeasurements.isEmpty()) { indexOfDevicesWithMissingMeasurements.add(i); indexOfMissingMeasurementsList.add(indexOfMissingMeasurements); } } - // [Step 2] Cache 2. process recorded logical views. - boolean hasUnFetchedLogicalView = false; - List, List>> missedIndexAndPathStringOfViewList = - new ArrayList<>(schemaComputationWithAutoCreationList.size()); - for (ISchemaComputationWithAutoCreation iSchemaComputationWithAutoCreation : - schemaComputationWithAutoCreationList) { - Pair, List> missedIndexAndPathString = - schemaCache.computeSourceOfLogicalView(iSchemaComputationWithAutoCreation); - if (!missedIndexAndPathString.left.isEmpty()) { - hasUnFetchedLogicalView = true; - } - missedIndexAndPathStringOfViewList.add(missedIndexAndPathString); - } +// // [Step 2] Cache 2. process recorded logical views. +// boolean hasUnFetchedLogicalView = false; +// List, List>> missedIndexAndPathStringOfViewList = +// new ArrayList<>(schemaComputationWithAutoCreationList.size()); +// for (ISchemaComputationWithAutoCreation iSchemaComputationWithAutoCreation : +// schemaComputationWithAutoCreationList) { +// Pair, List> missedIndexAndPathString = +// schemaCache.computeSourceOfLogicalView(iSchemaComputationWithAutoCreation); +// if (!missedIndexAndPathString.left.isEmpty()) { +// hasUnFetchedLogicalView = true; +// } +// missedIndexAndPathStringOfViewList.add(missedIndexAndPathString); +// } // all schema can be taken from cache - if (indexOfDevicesWithMissingMeasurements.isEmpty() && (!hasUnFetchedLogicalView)) { +// if (indexOfDevicesWithMissingMeasurements.isEmpty() && (!hasUnFetchedLogicalView)) { return; } - // [Step 3] Fetch 1.fetch schema from remote. Process logical view first; then process - // measurements. +// // [Step 3] Fetch 1.fetch schema from remote. Process logical view first; then process +// // measurements. // try fetch the missing schema from remote - ISchemaComputationWithAutoCreation schemaComputationWithAutoCreation; - ClusterSchemaTree remoteSchemaTree; - if (!hasUnFetchedLogicalView) { - remoteSchemaTree = - clusterSchemaFetchExecutor.fetchSchemaOfMultiDevices( - schemaComputationWithAutoCreationList.stream() - .map(ISchemaComputationWithAutoCreation::getDevicePath) - .collect(Collectors.toList()), - schemaComputationWithAutoCreationList.stream() - .map(ISchemaComputationWithAutoCreation::getMeasurements) - .collect(Collectors.toList()), - indexOfDevicesWithMissingMeasurements, +// ISchemaComputationWithAutoCreation schemaComputationWithAutoCreation; +// ClusterSchemaTree remoteSchemaTree; +// if (!hasUnFetchedLogicalView) { +// remoteSchemaTree = +// clusterSchemaFetchExecutor.fetchSchemaOfMultiDevices( +// schemaComputationWithAutoCreationList.stream() +// .map(ISchemaComputationWithAutoCreation::getDevicePath) +// .collect(Collectors.toList()), +// schemaComputationWithAutoCreationList.stream() +// .map(ISchemaComputationWithAutoCreation::getMeasurements) +// .collect(Collectors.toList()), +// indexOfDevicesWithMissingMeasurements, indexOfMissingMeasurementsList, context); - } else { - PathPatternTree patternTree = - computePatternTreeNeededReFetch( - schemaComputationWithAutoCreationList.stream() - .map(ISchemaComputationWithAutoCreation::getDevicePath) - .collect(Collectors.toList()), - schemaComputationWithAutoCreationList.stream() - .map(ISchemaComputationWithAutoCreation::getMeasurements) - .collect(Collectors.toList()), - indexOfDevicesWithMissingMeasurements, - indexOfMissingMeasurementsList); - List fullPathsNeedReFetch = new ArrayList<>(); - for (Pair, List> pair : missedIndexAndPathStringOfViewList) { - fullPathsNeedReFetch.addAll(pair.right); - } - computePatternTreeNeededReFetch(patternTree, fullPathsNeedReFetch); +// } else { +// PathPatternTree patternTree = +// computePatternTreeNeededReFetch( +// schemaComputationWithAutoCreationList.stream() +// .map(ISchemaComputationWithAutoCreation::getDevicePath) +// .collect(Collectors.toList()), +// schemaComputationWithAutoCreationList.stream() +// .map(ISchemaComputationWithAutoCreation::getMeasurements) +// .collect(Collectors.toList()), +// indexOfDevicesWithMissingMeasurements, +// indexOfMissingMeasurementsList); +// List fullPathsNeedReFetch = new ArrayList<>(); +// for (Pair, List> pair : missedIndexAndPathStringOfViewList) { +// fullPathsNeedReFetch.addAll(pair.right); +// } +// computePatternTreeNeededReFetch(patternTree, fullPathsNeedReFetch); remoteSchemaTree = clusterSchemaFetchExecutor.fetchSchemaWithPatternTreeAndCache(patternTree, context); - } - // make sure all missed views are computed. - for (int i = 0; i < schemaComputationWithAutoCreationList.size(); i++) { - schemaComputationWithAutoCreation = schemaComputationWithAutoCreationList.get(i); - remoteSchemaTree.computeSourceOfLogicalView( - schemaComputationWithAutoCreation, missedIndexAndPathStringOfViewList.get(i).left); - } +// } +// // make sure all missed views are computed. +// for (int i = 0; i < schemaComputationWithAutoCreationList.size(); i++) { +// schemaComputationWithAutoCreation = schemaComputationWithAutoCreationList.get(i); +// remoteSchemaTree.computeSourceOfLogicalView( +// schemaComputationWithAutoCreation, missedIndexAndPathStringOfViewList.get(i).left); +// } // check and compute the fetched schema List indexOfDevicesNeedAutoCreateSchema = new ArrayList<>(); List> indexOfMeasurementsNeedAutoCreate = new ArrayList<>(); @@ -286,38 +291,38 @@ void processNormalTimeSeries( indexOfMissingMeasurements = remoteSchemaTree.compute( schemaComputationWithAutoCreation, indexOfMissingMeasurementsList.get(i)); - schemaComputationWithAutoCreation.recordRangeOfLogicalViewSchemaListNow(); +// schemaComputationWithAutoCreation.recordRangeOfLogicalViewSchemaListNow(); if (!indexOfMissingMeasurements.isEmpty()) { indexOfDevicesNeedAutoCreateSchema.add(indexOfDevicesWithMissingMeasurements.get(i)); indexOfMeasurementsNeedAutoCreate.add(indexOfMissingMeasurements); } } - // [Step 4] Fetch 2. Some fetched measurements in [Step 3] are views. Process them. - hasUnFetchedLogicalView = false; - for (int i = 0, size = schemaComputationWithAutoCreationList.size(); i < size; i++) { - Pair, List> missedIndexAndPathString = - schemaCache.computeSourceOfLogicalView(schemaComputationWithAutoCreationList.get(i)); +// // [Step 4] Fetch 2. Some fetched measurements in [Step 3] are views. Process them. +// hasUnFetchedLogicalView = false; +// for (int i = 0, size = schemaComputationWithAutoCreationList.size(); i < size; i++) { +// Pair, List> missedIndexAndPathString = +// schemaCache.computeSourceOfLogicalView(schemaComputationWithAutoCreationList.get(i)); if (!missedIndexAndPathString.left.isEmpty()) { - hasUnFetchedLogicalView = true; - } - missedIndexAndPathStringOfViewList.get(i).left = missedIndexAndPathString.left; - missedIndexAndPathStringOfViewList.get(i).right = missedIndexAndPathString.right; - } - if (hasUnFetchedLogicalView) { - List fullPathsNeedRefetch = new ArrayList<>(); - for (Pair, List> pair : missedIndexAndPathStringOfViewList) { - fullPathsNeedRefetch.addAll(pair.right); - } - ClusterSchemaTree viewSchemaTree = +// hasUnFetchedLogicalView = true; +// } +// missedIndexAndPathStringOfViewList.get(i).left = missedIndexAndPathString.left; +// missedIndexAndPathStringOfViewList.get(i).right = missedIndexAndPathString.right; +// } +// if (hasUnFetchedLogicalView) { +// List fullPathsNeedRefetch = new ArrayList<>(); +// for (Pair, List> pair : missedIndexAndPathStringOfViewList) { +// fullPathsNeedRefetch.addAll(pair.right); +// } +// ClusterSchemaTree viewSchemaTree = clusterSchemaFetchExecutor.fetchSchemaWithFullPaths(fullPathsNeedRefetch, context); - for (int i = 0, size = schemaComputationWithAutoCreationList.size(); i < size; i++) { - schemaComputationWithAutoCreation = schemaComputationWithAutoCreationList.get(i); - viewSchemaTree.computeSourceOfLogicalView( - schemaComputationWithAutoCreation, missedIndexAndPathStringOfViewList.get(i).left); - } - } - +// for (int i = 0, size = schemaComputationWithAutoCreationList.size(); i < size; i++) { +// schemaComputationWithAutoCreation = schemaComputationWithAutoCreationList.get(i); +// viewSchemaTree.computeSourceOfLogicalView( +// schemaComputationWithAutoCreation, missedIndexAndPathStringOfViewList.get(i).left); +// } +// } +// // all schema has been taken and processed if (indexOfDevicesNeedAutoCreateSchema.isEmpty()) { return; @@ -341,17 +346,24 @@ void processNormalTimeSeries( .startsWith("root." + SystemConstant.AUDIT_PREFIX_KEY)); } - // [Step 5] Auto Create and process the missing schema +// // [Step 5] Auto Create and process the missing schema if (!indexOfMeasurementsNeedAutoCreate.isEmpty()) { - List devicePathList = - schemaComputationWithAutoCreationList.stream() - .map(ISchemaComputationWithAutoCreation::getDevicePath) - .collect(Collectors.toList()); - +// List devicePathList = +// schemaComputationWithAutoCreationList.stream() +// .map(ISchemaComputationWithAutoCreation::getDevicePath) +// .collect(Collectors.toList()); +// List isAlignedRealList = +// schemaComputationWithAutoCreationList.stream() +// .map(ISchemaComputationWithAutoCreation::isAligned) +// .collect(Collectors.toList()); +// // Check the isAligned value. If the input value is different from the actual value of the +// // existing device, throw exception. +// validateIsAlignedValueIfAutoCreate(isAlignedRealList, isAlignedPutInList, devicePathList); +// ClusterSchemaTree schemaTree = new ClusterSchemaTree(); autoCreateSchemaExecutor.autoCreateTimeSeries( schemaTree, - devicePathList, +// devicePathList, indexOfDevicesNeedAutoCreateSchema, indexOfMeasurementsNeedAutoCreate, schemaComputationWithAutoCreationList.stream() @@ -403,4 +415,29 @@ void processNormalTimeSeries( } } } +// +// private void validateIsAlignedValueIfAutoCreate( +// List realValueList, List putInValueList, List devicePathList) { +// int checkLen = +// Math.min(Math.min(realValueList.size(), putInValueList.size()), devicePathList.size()); +// for (int i = 0; i < checkLen; i++) { +// validateIsAlignedValueIfAutoCreate( +// realValueList.get(i), putInValueList.get(i), devicePathList.get(i)); +// } +// } +// +// private void validateIsAlignedValueIfAutoCreate( +// boolean realValue, boolean putInValue, PartialPath devicePath) { +// if (realValue != putInValue) { +// String msg; +// if (realValue) { +// msg = +// "Timeseries under this device is aligned, please use createTimeseries or change device."; +// } else { +// msg = +// "Timeseries under this device is not aligned, please use createTimeseries or change device."; +// } + throw new SemanticException(new AlignedTimeseriesException(msg, devicePath.getFullPath())); +// } +// } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java index 8770ed2873ce0..0c3c06e999348 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java @@ -2863,7 +2863,7 @@ public SettableFuture renameLogicalView( final PartialPath oldName = renameLogicalViewStatement.getOldName(); if (oldName.hasWildcard()) { future.setException( - new MetadataException("Rename view doesn't support path pattern with wildcard.")); +// new MetadataException("Rename view doesn't support path pattern with wildcard.")); return future; } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/Expression.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/Expression.java index 9b89a122b06d4..daf34d27185d8 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/Expression.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/Expression.java @@ -19,7 +19,7 @@ package org.apache.iotdb.db.queryengine.plan.expression; -import org.apache.iotdb.commons.path.PartialPath; +// import org.apache.iotdb.commons.path.PartialPath; import org.apache.iotdb.db.queryengine.common.NodeRef; import org.apache.iotdb.db.queryengine.plan.expression.binary.AdditionExpression; import org.apache.iotdb.db.queryengine.plan.expression.binary.DivisionExpression; diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/binary/BinaryExpression.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/binary/BinaryExpression.java index 39189759a60f1..413ccd55268ca 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/binary/BinaryExpression.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/binary/BinaryExpression.java @@ -152,12 +152,12 @@ protected void serialize(DataOutputStream stream) throws IOException { Expression.serialize(leftExpression, stream); Expression.serialize(rightExpression, stream); } - - @Override +// +// @Override public String getOutputSymbolInternal() { String left = this.getLeftExpression().getOutputSymbol(); String right = this.getRightExpression().getOutputSymbol(); - +// return buildExpression(left, right); } @@ -169,20 +169,20 @@ public long ramBytesUsed() { } private String buildExpression(String left, String right) { - StringBuilder builder = new StringBuilder(); - if (leftExpression.getExpressionType().getPriority() < this.getExpressionType().getPriority()) { - builder.append("(").append(left).append(")"); - } else { - builder.append(left); - } - builder.append(" ").append(operator()).append(" "); - if (rightExpression.getExpressionType().getPriority() - < this.getExpressionType().getPriority()) { - builder.append("(").append(right).append(")"); - } else { - builder.append(right); - } - - return builder.toString(); - } +// StringBuilder builder = new StringBuilder(); +// if (leftExpression.getExpressionType().getPriority() < this.getExpressionType().getPriority()) { +// builder.append("(").append(left).append(")"); +// } else { +// builder.append(left); +// } +// builder.append(" ").append(operator()).append(" "); +// if (rightExpression.getExpressionType().getPriority() +// < this.getExpressionType().getPriority()) { +// builder.append("(").append(right).append(")"); +// } else { +// builder.append(right); +// } +// +// return builder.toString(); +// } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/binary/WhenThenExpression.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/binary/WhenThenExpression.java index c12c09852af24..555432244348c 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/binary/WhenThenExpression.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/binary/WhenThenExpression.java @@ -69,13 +69,13 @@ public String getExpressionStringInternal() { + this.getThen().getExpressionString(); } - @Override +// @Override public String getOutputSymbolInternal() { String when = this.getWhen().getOutputSymbol(); String then = this.getThen().getOutputSymbol(); - return "WHEN " + when + " THEN " + then; - } - +// return "WHEN " + when + " THEN " + then; +// } +// @Override public R accept(ExpressionVisitor visitor, C context) { return visitor.visitWhenThenExpression(this, context); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/leaf/LeafOperand.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/leaf/LeafOperand.java index 31d8aa4ff07a0..64e383997069f 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/leaf/LeafOperand.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/leaf/LeafOperand.java @@ -47,9 +47,9 @@ public final void constructUdfExecutors( public boolean isMappable(Map, TSDataType> expressionTypes) { return true; } - - @Override +// +// @Override public String getOutputSymbolInternal() { - return this.getExpressionString(); - } +// return this.getExpressionString(); +// } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/multi/FunctionExpression.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/multi/FunctionExpression.java index 957856f409313..da491fc3655b7 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/multi/FunctionExpression.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/multi/FunctionExpression.java @@ -214,27 +214,27 @@ public List getExpressions() { return expressions; } - @Override +// @Override public String getOutputSymbolInternal() { - StringBuilder builder = new StringBuilder(); - if (!expressions.isEmpty()) { +// StringBuilder builder = new StringBuilder(); +// if (!expressions.isEmpty()) { builder.append(expressions.get(0).getOutputSymbol()); - for (int i = 1; i < expressions.size(); ++i) { +// for (int i = 1; i < expressions.size(); ++i) { builder.append(", ").append(expressions.get(i).getOutputSymbol()); - } - } - if (!functionAttributes.isEmpty()) { - // Some built-in scalar functions may have different header. - if (BuiltinScalarFunction.contains(functionName)) { - BuiltInScalarFunctionHelperFactory.createHelper(functionName) - .appendFunctionAttributes(!expressions.isEmpty(), builder, functionAttributes); - } else { - appendAttributes(!expressions.isEmpty(), builder, functionAttributes); - } - } - return functionName + "(" + builder + ")"; - } - +// } +// } +// if (!functionAttributes.isEmpty()) { +// // Some built-in scalar functions may have different header. +// if (BuiltinScalarFunction.contains(functionName)) { +// BuiltInScalarFunctionHelperFactory.createHelper(functionName) +// .appendFunctionAttributes(!expressions.isEmpty(), builder, functionAttributes); +// } else { +// appendAttributes(!expressions.isEmpty(), builder, functionAttributes); +// } +// } +// return functionName + "(" + builder + ")"; +// } +// @Override public void constructUdfExecutors( Map expressionName2Executor, ZoneId zoneId) { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/other/CaseWhenThenExpression.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/other/CaseWhenThenExpression.java index c0a30bb685430..9290c241f330c 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/other/CaseWhenThenExpression.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/other/CaseWhenThenExpression.java @@ -170,20 +170,20 @@ public List getExpressions() { return result; } - @Override +// @Override public String getOutputSymbolInternal() { - StringBuilder builder = new StringBuilder(); - builder.append("CASE "); - for (Expression expression : this.whenThenExpressions) { +// StringBuilder builder = new StringBuilder(); +// builder.append("CASE "); +// for (Expression expression : this.whenThenExpressions) { builder.append(expression.getOutputSymbol()).append(" "); - } - if (!(this.elseExpression instanceof NullOperand)) { +// } +// if (!(this.elseExpression instanceof NullOperand)) { builder.append("ELSE ").append(this.elseExpression.getOutputSymbol()).append(" "); - } - builder.append("END"); - return builder.toString(); - } - +// } +// builder.append("END"); +// return builder.toString(); +// } +// @Override public R accept(ExpressionVisitor visitor, C context) { return visitor.visitCaseWhenThenExpression(this, context); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/ternary/BetweenExpression.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/ternary/BetweenExpression.java index 00b307df3409c..a4fa881731488 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/ternary/BetweenExpression.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/ternary/BetweenExpression.java @@ -95,15 +95,15 @@ protected void serialize(DataOutputStream stream) throws IOException { ReadWriteIOUtils.write(isNotBetween, stream); } - @Override +// @Override public String getOutputSymbolInternal() { return firstExpression.getOutputSymbol() + (isNotBetween ? " NOT BETWEEN " : " BETWEEN ") + secondExpression.getOutputSymbol() - + " AND " +// + " AND " + thirdExpression.getOutputSymbol(); - } - +// } +// @Override public R accept(ExpressionVisitor visitor, C context) { return visitor.visitBetweenExpression(this, context); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/ternary/TernaryExpression.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/ternary/TernaryExpression.java index 3fb533a9f00f0..957be777065ab 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/ternary/TernaryExpression.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/ternary/TernaryExpression.java @@ -39,32 +39,32 @@ import java.util.Map; public abstract class TernaryExpression extends Expression { - protected Expression firstExpression; - protected Expression secondExpression; - protected Expression thirdExpression; +// protected Expression firstExpression; +// protected Expression secondExpression; +// protected Expression thirdExpression; public Expression getFirstExpression() { return firstExpression; } - public void setFirstExpression(Expression expression) { - this.firstExpression = expression; - } - +// public void setFirstExpression(Expression expression) { +// this.firstExpression = expression; +// } +// public Expression getSecondExpression() { return secondExpression; } - public void setSecondExpression(Expression expression) { - this.secondExpression = expression; - } - +// public void setSecondExpression(Expression expression) { +// this.secondExpression = expression; +// } +// public Expression getThirdExpression() { return thirdExpression; - } - - public void setThirdExpression(Expression expression) { - this.thirdExpression = expression; +// } +// +// public void setThirdExpression(Expression expression) { +// this.thirdExpression = expression; } protected TernaryExpression( diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/InExpression.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/InExpression.java index 0ace411cd94ef..7425c28aaab01 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/InExpression.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/InExpression.java @@ -32,7 +32,7 @@ import org.apache.tsfile.utils.ReadWriteIOUtils; import javax.validation.constraints.NotNull; - +// import java.io.DataOutputStream; import java.io.IOException; import java.nio.ByteBuffer; @@ -82,11 +82,11 @@ protected String getExpressionStringInternal() { .append(')') .append(operator); } - return appendValuesToBuild(stringBuilder).toString(); - } - - @NotNull - private StringBuilder appendValuesToBuild(StringBuilder stringBuilder) { +// return appendValuesToBuild(stringBuilder).toString(); +// } +// +// @NotNull +// private StringBuilder appendValuesToBuild(StringBuilder stringBuilder) { Iterator iterator = values.iterator(); if (iterator.hasNext()) { stringBuilder.append(iterator.next()); @@ -95,7 +95,7 @@ private StringBuilder appendValuesToBuild(StringBuilder stringBuilder) { stringBuilder.append(',').append(iterator.next()); } stringBuilder.append(')'); - return stringBuilder; +// return stringBuilder; } @Override @@ -123,20 +123,20 @@ protected void serialize(DataOutputStream stream) throws IOException { } } - @Override +// @Override public String getOutputSymbolInternal() { String operator = isNotIn ? " NOT IN (" : " IN ("; - StringBuilder stringBuilder = new StringBuilder(); - if (expression instanceof FunctionExpression - || expression instanceof ConstantOperand - || expression instanceof TimeSeriesOperand) { +// StringBuilder stringBuilder = new StringBuilder(); +// if (expression instanceof FunctionExpression +// || expression instanceof ConstantOperand +// || expression instanceof TimeSeriesOperand) { stringBuilder.append(expression.getOutputSymbol()).append(operator); - } else { +// } else { stringBuilder.append('(').append(expression.getOutputSymbol()).append(')').append(operator); - } - return appendValuesToBuild(stringBuilder).toString(); - } - +// } +// return appendValuesToBuild(stringBuilder).toString(); +// } +// @Override public R accept(ExpressionVisitor visitor, C context) { return visitor.visitInExpression(this, context); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/IsNullExpression.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/IsNullExpression.java index 9542b29e2da8f..35254e0ccb56d 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/IsNullExpression.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/IsNullExpression.java @@ -73,11 +73,11 @@ protected void serialize(DataOutputStream stream) throws IOException { ReadWriteIOUtils.write(isNot, stream); } - @Override +// @Override public String getOutputSymbolInternal() { return expression.getOutputSymbol() + " IS " + (isNot ? "NOT " : "") + "NULL"; - } - +// } +// @Override public R accept(ExpressionVisitor visitor, C context) { return visitor.visitIsNullExpression(this, context); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/LikeExpression.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/LikeExpression.java index f9cdf0427bf0e..e71263aeedc81 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/LikeExpression.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/LikeExpression.java @@ -123,7 +123,7 @@ protected void serialize(DataOutputStream stream) throws IOException { ReadWriteIOUtils.write(isNot, stream); } - @Override +// @Override public String getOutputSymbolInternal() { String res = expression.getOutputSymbol() @@ -136,8 +136,8 @@ public String getOutputSymbolInternal() { res = res + " escape = '" + escape.get() + "'"; } return res; - } - +// } +// @Override public R accept(ExpressionVisitor visitor, C context) { return visitor.visitLikeExpression(this, context); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/LogicNotExpression.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/LogicNotExpression.java index 9797376e54588..833c529816e87 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/LogicNotExpression.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/LogicNotExpression.java @@ -52,15 +52,15 @@ public String getExpressionStringInternal() { : "!(" + expression.getExpressionString() + ")"; } - @Override +// @Override public String getOutputSymbolInternal() { - return expression instanceof FunctionExpression - || expression instanceof ConstantOperand - || expression instanceof TimeSeriesOperand +// return expression instanceof FunctionExpression +// || expression instanceof ConstantOperand +// || expression instanceof TimeSeriesOperand ? "!" + expression.getOutputSymbol() : "!(" + expression.getOutputSymbol() + ")"; - } - +// } +// @Override public ExpressionType getExpressionType() { return ExpressionType.LOGIC_NOT; diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/NegationExpression.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/NegationExpression.java index d496a05c2617a..bdedbae4ac32d 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/NegationExpression.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/NegationExpression.java @@ -56,17 +56,17 @@ public String getExpressionStringInternal() { : "-(" + expression.getExpressionString() + ")"; } - @Override +// @Override public String getOutputSymbolInternal() { - return expression instanceof TimeSeriesOperand - || expression instanceof FunctionExpression - || expression instanceof NullOperand - || (expression instanceof ConstantOperand - && !((ConstantOperand) expression).isNegativeNumber()) +// return expression instanceof TimeSeriesOperand +// || expression instanceof FunctionExpression +// || expression instanceof NullOperand +// || (expression instanceof ConstantOperand +// && !((ConstantOperand) expression).isNegativeNumber()) ? "-" + expression.getOutputSymbol() : "-(" + expression.getOutputSymbol() + ")"; - } - +// } +// @Override public ExpressionType getExpressionType() { return ExpressionType.NEGATION; diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/RegularExpression.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/RegularExpression.java index 06194ef5bc776..f1f2f14f9235a 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/RegularExpression.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/RegularExpression.java @@ -105,11 +105,11 @@ protected void serialize(DataOutputStream stream) throws IOException { ReadWriteIOUtils.write(isNot, stream); } - @Override +// @Override public String getOutputSymbolInternal() { return expression.getOutputSymbol() + (isNot ? " NOT" : "") + " REGEXP '" + patternString + "'"; - } - +// } +// @Override public R accept(ExpressionVisitor visitor, C context) { return visitor.visitRegularExpression(this, context); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/UnaryExpression.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/UnaryExpression.java index 8b0689299ffcb..6c541b96ad5d5 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/UnaryExpression.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/UnaryExpression.java @@ -38,7 +38,7 @@ public abstract class UnaryExpression extends Expression { - protected Expression expression; +// protected Expression expression; protected UnaryExpression(Expression expression) { this.expression = expression; @@ -48,10 +48,10 @@ public final Expression getExpression() { return expression; } - public void setExpression(Expression expression) { - this.expression = expression; - } - +// public void setExpression(Expression expression) { +// this.expression = expression; +// } +// @Override public R accept(ExpressionVisitor visitor, C context) { return visitor.visitUnaryExpression(this, context); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/visitor/CompleteMeasurementSchemaVisitor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/visitor/CompleteMeasurementSchemaVisitor.java index f8bb7b8dbe7bd..46339fcc771c8 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/visitor/CompleteMeasurementSchemaVisitor.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/visitor/CompleteMeasurementSchemaVisitor.java @@ -1,27 +1,27 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// package org.apache.iotdb.db.queryengine.plan.expression.visitor; - -import org.apache.iotdb.commons.path.MeasurementPath; -import org.apache.iotdb.commons.path.PartialPath; -import org.apache.iotdb.db.exception.metadata.view.BrokenViewException; +// +// import org.apache.iotdb.commons.path.MeasurementPath; +// import org.apache.iotdb.commons.path.PartialPath; +// import org.apache.iotdb.db.exception.metadata.view.BrokenViewException; import org.apache.iotdb.db.exception.sql.SemanticException; import org.apache.iotdb.db.queryengine.common.schematree.ISchemaTree; import org.apache.iotdb.db.queryengine.plan.expression.Expression; @@ -30,67 +30,67 @@ import org.apache.iotdb.db.queryengine.plan.expression.multi.FunctionExpression; import org.apache.iotdb.db.queryengine.plan.expression.ternary.TernaryExpression; import org.apache.iotdb.db.queryengine.plan.expression.unary.UnaryExpression; - -import java.util.ArrayList; -import java.util.List; - -public class CompleteMeasurementSchemaVisitor extends ExpressionVisitor { - - @Override - public Expression process(Expression expression, ISchemaTree schemaTree) { - return expression.accept(this, schemaTree); - } - - @Override - public Expression visitExpression(Expression expression, ISchemaTree schemaTree) { - return expression; - } - - @Override - public Expression visitUnaryExpression(UnaryExpression unaryExpression, ISchemaTree schemaTree) { - unaryExpression.setExpression(this.process(unaryExpression.getExpression(), schemaTree)); - return unaryExpression; - } - - @Override - public Expression visitBinaryExpression( - BinaryExpression binaryExpression, ISchemaTree schemaTree) { - binaryExpression.setLeftExpression( - this.process(binaryExpression.getLeftExpression(), schemaTree)); - binaryExpression.setRightExpression( - this.process(binaryExpression.getRightExpression(), schemaTree)); - return binaryExpression; - } - - @Override - public Expression visitTernaryExpression( - TernaryExpression ternaryExpression, ISchemaTree schemaTree) { - ternaryExpression.setFirstExpression( - this.process(ternaryExpression.getFirstExpression(), schemaTree)); - ternaryExpression.setSecondExpression( - this.process(ternaryExpression.getSecondExpression(), schemaTree)); - ternaryExpression.setThirdExpression( - this.process(ternaryExpression.getThirdExpression(), schemaTree)); - return ternaryExpression; - } - - @Override - public Expression visitFunctionExpression( - FunctionExpression functionExpression, ISchemaTree schemaTree) { - List children = functionExpression.getExpressions(); - List replacedChildren = new ArrayList<>(); - for (Expression child : children) { - replacedChildren.add(this.process(child, schemaTree)); - } - functionExpression.setExpressions(replacedChildren); - return functionExpression; - } - - @Override - public Expression visitTimeSeriesOperand( - TimeSeriesOperand timeSeriesOperand, ISchemaTree schemaTree) { - PartialPath path = timeSeriesOperand.getPath(); - try { +// +// import java.util.ArrayList; +// import java.util.List; +// +// public class CompleteMeasurementSchemaVisitor extends ExpressionVisitor { +// +// @Override +// public Expression process(Expression expression, ISchemaTree schemaTree) { +// return expression.accept(this, schemaTree); +// } +// +// @Override +// public Expression visitExpression(Expression expression, ISchemaTree schemaTree) { +// return expression; +// } +// +// @Override +// public Expression visitUnaryExpression(UnaryExpression unaryExpression, ISchemaTree schemaTree) { +// unaryExpression.setExpression(this.process(unaryExpression.getExpression(), schemaTree)); +// return unaryExpression; +// } +// +// @Override +// public Expression visitBinaryExpression( +// BinaryExpression binaryExpression, ISchemaTree schemaTree) { +// binaryExpression.setLeftExpression( +// this.process(binaryExpression.getLeftExpression(), schemaTree)); +// binaryExpression.setRightExpression( +// this.process(binaryExpression.getRightExpression(), schemaTree)); +// return binaryExpression; +// } +// +// @Override +// public Expression visitTernaryExpression( +// TernaryExpression ternaryExpression, ISchemaTree schemaTree) { +// ternaryExpression.setFirstExpression( +// this.process(ternaryExpression.getFirstExpression(), schemaTree)); +// ternaryExpression.setSecondExpression( +// this.process(ternaryExpression.getSecondExpression(), schemaTree)); +// ternaryExpression.setThirdExpression( +// this.process(ternaryExpression.getThirdExpression(), schemaTree)); +// return ternaryExpression; +// } +// +// @Override +// public Expression visitFunctionExpression( +// FunctionExpression functionExpression, ISchemaTree schemaTree) { +// List children = functionExpression.getExpressions(); +// List replacedChildren = new ArrayList<>(); +// for (Expression child : children) { +// replacedChildren.add(this.process(child, schemaTree)); +// } +// functionExpression.setExpressions(replacedChildren); +// return functionExpression; +// } +// +// @Override +// public Expression visitTimeSeriesOperand( +// TimeSeriesOperand timeSeriesOperand, ISchemaTree schemaTree) { +// PartialPath path = timeSeriesOperand.getPath(); +// try { path.getMeasurementSchema(); } catch (Exception notAMeasurementPath) { List actualPaths = schemaTree.searchMeasurementPaths(path).left; @@ -100,9 +100,9 @@ public Expression visitTimeSeriesOperand( } else { throw new SemanticException(new BrokenViewException(path.getFullPath(), actualPaths)); } - } +// } return new TimeSeriesOperand(actualPaths.get(0)); - } - return timeSeriesOperand; - } -} +// } +// return timeSeriesOperand; +// } +// } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/visitor/ReplaceLogicalViewVisitor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/visitor/ReplaceLogicalViewVisitor.java index 39fe3c637c938..44a82b70e1d3d 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/visitor/ReplaceLogicalViewVisitor.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/visitor/ReplaceLogicalViewVisitor.java @@ -1,28 +1,28 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// package org.apache.iotdb.db.queryengine.plan.expression.visitor; - +// import org.apache.iotdb.commons.path.MeasurementPath; -import org.apache.iotdb.commons.path.PartialPath; -import org.apache.iotdb.commons.schema.view.LogicalViewSchema; -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.path.PartialPath; +// import org.apache.iotdb.commons.schema.view.LogicalViewSchema; +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; import org.apache.iotdb.db.queryengine.plan.expression.Expression; import org.apache.iotdb.db.queryengine.plan.expression.binary.BinaryExpression; import org.apache.iotdb.db.queryengine.plan.expression.leaf.TimeSeriesOperand; @@ -34,146 +34,146 @@ import org.apache.tsfile.utils.Pair; import org.apache.tsfile.write.schema.IMeasurementSchema; - -import java.util.ArrayList; -import java.util.List; - -/** - * step 1. check whether this expression contains logical view, that means check TimeSeriesOperand - * which has the LogicalViewSchema. - * - *

step 2. replace that TimeSeriesOperand with expression recorded in LogicalViewSchema (view - * expression). - * - *

step 3. record paths that appeared in view expression. They should be fetched later. - */ -public class ReplaceLogicalViewVisitor extends ExpressionVisitor> { - - private TransformToExpressionVisitor transformToExpressionVisitor = null; - - private GetSourcePathsVisitor getSourcePathsVisitor = null; - - private boolean hasProcessedAggregationFunction = false; - - /** The paths that are new added, which should be re-fetched. */ - private List newAddedPathList = null; - - public ReplaceLogicalViewVisitor() { - this.transformToExpressionVisitor = new TransformToExpressionVisitor(); - this.getSourcePathsVisitor = new GetSourcePathsVisitor(); - this.resetHadProcessedAggregationFunction(); - this.newAddedPathList = new ArrayList<>(); - } - - /** - * This function will check the expression you put in, find the TimeSeriesOperand which has - * LogicalViewSchema. These TimeSeriesOperand will be replaced with logical view expression, and - * this function will record paths that appeared in view expression. The logical view you replaced - * have INCOMPLETE path information, and use PartialPath in TimeSeriesOperand. This may cause - * ERROR, therefore you should call completeMeasurementPathCausedByView() later, make sure the - * path info is complete and using MeasurementPath with full MeasurementSchema. - * - * @param expression the expression you want to check. - * @return pair of replaced expression and whether replacement was happened. 'True' means the - * expression you put in contains logical view, and has been replaced. 'False' means there is - * no need to modify the expression you put in. - */ - public Pair replaceViewInThisExpression(Expression expression) { - // step 1. check whether this expression contains logical view, that means finding - // TimeSeriesOperand which has - // the LogicalViewSchema. - // step 2. replace that TimeSeriesOperand with expression recorded in LogicalViewSchema (view - // expression). - // step 3. record paths that appeared in view expression. They should be fetched, then you can - // use fetched schema - // to complete new added TimeSeriesOperand. - int oldSize = this.newAddedPathList.size(); - Expression result = this.process(expression, this.newAddedPathList); - int newSize = this.newAddedPathList.size(); - if (oldSize != newSize) { - return new Pair<>(result, true); - } - return new Pair<>(expression, false); - } - - public List getNewAddedPathList() { - return this.newAddedPathList; - } - - private Expression transform(ViewExpression viewExpression) { - return this.transformToExpressionVisitor.process(viewExpression, null); - } - - private List collectSourcePaths(ViewExpression viewExpression) { - return this.getSourcePathsVisitor.process(viewExpression, null); - } - - public boolean getHadProcessedAggregationFunction() { - return this.hasProcessedAggregationFunction; - } - - public void resetHadProcessedAggregationFunction() { - this.hasProcessedAggregationFunction = false; - } - - @Override - public Expression process(Expression expression, List context) { - return expression.accept(this, context); - } - - @Override - public Expression visitExpression(Expression expression, List context) { - return expression; - } - - @Override - public Expression visitUnaryExpression( - UnaryExpression unaryExpression, List context) { - unaryExpression.setExpression(this.process(unaryExpression.getExpression(), context)); - return unaryExpression; - } - - @Override - public Expression visitBinaryExpression( - BinaryExpression binaryExpression, List context) { - binaryExpression.setLeftExpression(this.process(binaryExpression.getLeftExpression(), context)); - binaryExpression.setRightExpression( - this.process(binaryExpression.getRightExpression(), context)); - return binaryExpression; - } - - @Override - public Expression visitTernaryExpression( - TernaryExpression ternaryExpression, List context) { - ternaryExpression.setFirstExpression( - this.process(ternaryExpression.getFirstExpression(), context)); - ternaryExpression.setSecondExpression( - this.process(ternaryExpression.getSecondExpression(), context)); - ternaryExpression.setThirdExpression( - this.process(ternaryExpression.getThirdExpression(), context)); - return ternaryExpression; - } - - @Override - public Expression visitFunctionExpression( - FunctionExpression functionExpression, List context) { - List children = functionExpression.getExpressions(); - List replacedChildren = new ArrayList<>(); - for (Expression child : children) { - replacedChildren.add(this.process(child, context)); - } - functionExpression.setExpressions(replacedChildren); +// +// import java.util.ArrayList; +// import java.util.List; +// +// /** +// * step 1. check whether this expression contains logical view, that means check TimeSeriesOperand +// * which has the LogicalViewSchema. +// * +// *

step 2. replace that TimeSeriesOperand with expression recorded in LogicalViewSchema (view +// * expression). +// * +// *

step 3. record paths that appeared in view expression. They should be fetched later. +// */ +// public class ReplaceLogicalViewVisitor extends ExpressionVisitor> { +// +// private TransformToExpressionVisitor transformToExpressionVisitor = null; +// +// private GetSourcePathsVisitor getSourcePathsVisitor = null; +// +// private boolean hasProcessedAggregationFunction = false; +// +// /** The paths that are new added, which should be re-fetched. */ +// private List newAddedPathList = null; +// +// public ReplaceLogicalViewVisitor() { +// this.transformToExpressionVisitor = new TransformToExpressionVisitor(); +// this.getSourcePathsVisitor = new GetSourcePathsVisitor(); +// this.resetHadProcessedAggregationFunction(); +// this.newAddedPathList = new ArrayList<>(); +// } +// +// /** +// * This function will check the expression you put in, find the TimeSeriesOperand which has +// * LogicalViewSchema. These TimeSeriesOperand will be replaced with logical view expression, and +// * this function will record paths that appeared in view expression. The logical view you replaced +// * have INCOMPLETE path information, and use PartialPath in TimeSeriesOperand. This may cause +// * ERROR, therefore you should call completeMeasurementPathCausedByView() later, make sure the +// * path info is complete and using MeasurementPath with full MeasurementSchema. +// * +// * @param expression the expression you want to check. +// * @return pair of replaced expression and whether replacement was happened. 'True' means the +// * expression you put in contains logical view, and has been replaced. 'False' means there is +// * no need to modify the expression you put in. +// */ +// public Pair replaceViewInThisExpression(Expression expression) { +// // step 1. check whether this expression contains logical view, that means finding +// // TimeSeriesOperand which has +// // the LogicalViewSchema. +// // step 2. replace that TimeSeriesOperand with expression recorded in LogicalViewSchema (view +// // expression). +// // step 3. record paths that appeared in view expression. They should be fetched, then you can +// // use fetched schema +// // to complete new added TimeSeriesOperand. +// int oldSize = this.newAddedPathList.size(); +// Expression result = this.process(expression, this.newAddedPathList); +// int newSize = this.newAddedPathList.size(); +// if (oldSize != newSize) { +// return new Pair<>(result, true); +// } +// return new Pair<>(expression, false); +// } +// +// public List getNewAddedPathList() { +// return this.newAddedPathList; +// } +// +// private Expression transform(ViewExpression viewExpression) { +// return this.transformToExpressionVisitor.process(viewExpression, null); +// } +// +// private List collectSourcePaths(ViewExpression viewExpression) { +// return this.getSourcePathsVisitor.process(viewExpression, null); +// } +// +// public boolean getHadProcessedAggregationFunction() { +// return this.hasProcessedAggregationFunction; +// } +// +// public void resetHadProcessedAggregationFunction() { +// this.hasProcessedAggregationFunction = false; +// } +// +// @Override +// public Expression process(Expression expression, List context) { +// return expression.accept(this, context); +// } +// +// @Override +// public Expression visitExpression(Expression expression, List context) { +// return expression; +// } +// +// @Override +// public Expression visitUnaryExpression( +// UnaryExpression unaryExpression, List context) { +// unaryExpression.setExpression(this.process(unaryExpression.getExpression(), context)); +// return unaryExpression; +// } +// +// @Override +// public Expression visitBinaryExpression( +// BinaryExpression binaryExpression, List context) { +// binaryExpression.setLeftExpression(this.process(binaryExpression.getLeftExpression(), context)); +// binaryExpression.setRightExpression( +// this.process(binaryExpression.getRightExpression(), context)); +// return binaryExpression; +// } +// +// @Override +// public Expression visitTernaryExpression( +// TernaryExpression ternaryExpression, List context) { +// ternaryExpression.setFirstExpression( +// this.process(ternaryExpression.getFirstExpression(), context)); +// ternaryExpression.setSecondExpression( +// this.process(ternaryExpression.getSecondExpression(), context)); +// ternaryExpression.setThirdExpression( +// this.process(ternaryExpression.getThirdExpression(), context)); +// return ternaryExpression; +// } +// +// @Override +// public Expression visitFunctionExpression( +// FunctionExpression functionExpression, List context) { +// List children = functionExpression.getExpressions(); +// List replacedChildren = new ArrayList<>(); +// for (Expression child : children) { +// replacedChildren.add(this.process(child, context)); +// } +// functionExpression.setExpressions(replacedChildren); if (functionExpression.isAggregationFunctionExpression()) { - this.hasProcessedAggregationFunction = true; - } - return functionExpression; - } - - @Override - public Expression visitTimeSeriesOperand( - TimeSeriesOperand timeSeriesOperand, List context) { - PartialPath path = timeSeriesOperand.getPath(); - try { +// this.hasProcessedAggregationFunction = true; +// } +// return functionExpression; +// } +// +// @Override +// public Expression visitTimeSeriesOperand( +// TimeSeriesOperand timeSeriesOperand, List context) { +// PartialPath path = timeSeriesOperand.getPath(); +// try { if (path instanceof MeasurementPath) { IMeasurementSchema measurementSchema = path.getMeasurementSchema(); if (measurementSchema.isLogicalView()) { @@ -183,10 +183,10 @@ public Expression visitTimeSeriesOperand( context.addAll(this.collectSourcePaths(viewExpression)); return result; } - } - } catch (Exception e) { - throw new RuntimeException(e); - } - return timeSeriesOperand; - } -} +// } +// } catch (Exception e) { +// throw new RuntimeException(e); +// } +// return timeSeriesOperand; +// } +// } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/visitor/TransformToViewExpressionVisitor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/visitor/TransformToViewExpressionVisitor.java index 27befb28c9066..0b381c5e02c9a 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/visitor/TransformToViewExpressionVisitor.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/visitor/TransformToViewExpressionVisitor.java @@ -1,50 +1,50 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// package org.apache.iotdb.db.queryengine.plan.expression.visitor; - -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.AdditionViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.DivisionViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.ModuloViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.MultiplicationViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.SubtractionViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.EqualToViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.GreaterEqualViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.GreaterThanViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.LessEqualViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.LessThanViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.NonEqualViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.logic.LogicAndViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.logic.LogicOrViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.leaf.ConstantViewOperand; -import org.apache.iotdb.commons.schema.view.viewExpression.leaf.NullViewOperand; -import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimeSeriesViewOperand; -import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimestampViewOperand; -import org.apache.iotdb.commons.schema.view.viewExpression.multi.FunctionViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.ternary.BetweenViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.unary.InViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.unary.IsNullViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.unary.LikeViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.unary.LogicNotViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.unary.NegationViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.unary.RegularViewExpression; +// +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.AdditionViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.DivisionViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.ModuloViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.MultiplicationViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.SubtractionViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.EqualToViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.GreaterEqualViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.GreaterThanViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.LessEqualViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.LessThanViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.NonEqualViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.logic.LogicAndViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.logic.LogicOrViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.leaf.ConstantViewOperand; +// import org.apache.iotdb.commons.schema.view.viewExpression.leaf.NullViewOperand; +// import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimeSeriesViewOperand; +// import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimestampViewOperand; +// import org.apache.iotdb.commons.schema.view.viewExpression.multi.FunctionViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.ternary.BetweenViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.unary.InViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.unary.IsNullViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.unary.LikeViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.unary.LogicNotViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.unary.NegationViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.unary.RegularViewExpression; import org.apache.iotdb.db.queryengine.plan.expression.Expression; import org.apache.iotdb.db.queryengine.plan.expression.binary.AdditionExpression; import org.apache.iotdb.db.queryengine.plan.expression.binary.BinaryExpression; @@ -74,252 +74,252 @@ import org.apache.iotdb.db.queryengine.plan.expression.unary.RegularExpression; import org.apache.tsfile.utils.Pair; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -public class TransformToViewExpressionVisitor extends ExpressionVisitor { - - @Override - public ViewExpression process(Expression expression, Void context) { - return expression.accept(this, context); - } - - @Override - public ViewExpression visitExpression(Expression expression, Void context) { +// +// import java.util.ArrayList; +// import java.util.LinkedHashMap; +// import java.util.List; +// import java.util.Map; +// +// public class TransformToViewExpressionVisitor extends ExpressionVisitor { +// +// @Override +// public ViewExpression process(Expression expression, Void context) { +// return expression.accept(this, context); +// } +// +// @Override +// public ViewExpression visitExpression(Expression expression, Void context) { throw new UnsupportedOperationException( "Unsupported expression type in TransformToViewExpressionVisitor: " + expression.getExpressionType()); - } - - // region leaf operand - - @Override - public ViewExpression visitConstantOperand(ConstantOperand constantOperand, Void context) { - return new ConstantViewOperand(constantOperand.getDataType(), constantOperand.getValueString()); - } - - @Override - public ViewExpression visitNullOperand(NullOperand nullOperand, Void context) { - return new NullViewOperand(); - } - - @Override - public ViewExpression visitTimeSeriesOperand(TimeSeriesOperand timeSeriesOperand, Void context) { - return new TimeSeriesViewOperand(timeSeriesOperand.getPath().toString()); - } - - @Override - public ViewExpression visitTimeStampOperand(TimestampOperand timestampOperand, Void context) { - return new TimestampViewOperand(); - } - - // endregion - - // region Unary Expressions - - @Override - public ViewExpression visitInExpression(InExpression inExpression, Void context) { - ViewExpression child = this.process(inExpression.getExpression(), context); - List valueList = new ArrayList<>(inExpression.getValues()); - return new InViewExpression(child, inExpression.isNotIn(), valueList); - } - - @Override - public ViewExpression visitIsNullExpression(IsNullExpression isNullExpression, Void context) { - ViewExpression child = this.process(isNullExpression.getExpression(), context); - return new IsNullViewExpression(child, isNullExpression.isNot()); - } - - @Override - public ViewExpression visitLikeExpression(LikeExpression likeExpression, Void context) { - ViewExpression child = this.process(likeExpression.getExpression(), context); - return new LikeViewExpression( +// } +// +// // region leaf operand +// +// @Override +// public ViewExpression visitConstantOperand(ConstantOperand constantOperand, Void context) { +// return new ConstantViewOperand(constantOperand.getDataType(), constantOperand.getValueString()); +// } +// +// @Override +// public ViewExpression visitNullOperand(NullOperand nullOperand, Void context) { +// return new NullViewOperand(); +// } +// +// @Override +// public ViewExpression visitTimeSeriesOperand(TimeSeriesOperand timeSeriesOperand, Void context) { +// return new TimeSeriesViewOperand(timeSeriesOperand.getPath().toString()); +// } +// +// @Override +// public ViewExpression visitTimeStampOperand(TimestampOperand timestampOperand, Void context) { +// return new TimestampViewOperand(); +// } + +// // endregion +// +// // region Unary Expressions +// +// @Override +// public ViewExpression visitInExpression(InExpression inExpression, Void context) { +// ViewExpression child = this.process(inExpression.getExpression(), context); +// List valueList = new ArrayList<>(inExpression.getValues()); +// return new InViewExpression(child, inExpression.isNotIn(), valueList); +// } +// +// @Override +// public ViewExpression visitIsNullExpression(IsNullExpression isNullExpression, Void context) { +// ViewExpression child = this.process(isNullExpression.getExpression(), context); +// return new IsNullViewExpression(child, isNullExpression.isNot()); +// } +// +// @Override +// public ViewExpression visitLikeExpression(LikeExpression likeExpression, Void context) { +// ViewExpression child = this.process(likeExpression.getExpression(), context); +// return new LikeViewExpression( child, likeExpression.getPattern(), likeExpression.getEscape(), likeExpression.isNot()); - } - - @Override - public ViewExpression visitLogicNotExpression( - LogicNotExpression logicNotExpression, Void context) { - ViewExpression child = this.process(logicNotExpression.getExpression(), context); - return new LogicNotViewExpression(child); - } - - @Override - public ViewExpression visitNegationExpression( - NegationExpression negationExpression, Void context) { - ViewExpression child = this.process(negationExpression.getExpression(), context); - return new NegationViewExpression(child); - } - - @Override - public ViewExpression visitRegularExpression(RegularExpression regularExpression, Void context) { - ViewExpression child = this.process(regularExpression.getExpression(), context); - return new RegularViewExpression( +// } +// +// @Override +// public ViewExpression visitLogicNotExpression( +// LogicNotExpression logicNotExpression, Void context) { +// ViewExpression child = this.process(logicNotExpression.getExpression(), context); +// return new LogicNotViewExpression(child); +// } +// +// @Override +// public ViewExpression visitNegationExpression( +// NegationExpression negationExpression, Void context) { +// ViewExpression child = this.process(negationExpression.getExpression(), context); +// return new NegationViewExpression(child); +// } +// +// @Override +// public ViewExpression visitRegularExpression(RegularExpression regularExpression, Void context) { +// ViewExpression child = this.process(regularExpression.getExpression(), context); +// return new RegularViewExpression( child, regularExpression.getPatternString(), regularExpression.getPattern(), regularExpression.isNot()); - } - - // endregion - - // region Binary Expressions - - private Pair getExpressionsForBinaryExpression( - BinaryExpression binaryExpression) { - ViewExpression left = this.process(binaryExpression.getLeftExpression(), null); - ViewExpression right = this.process(binaryExpression.getRightExpression(), null); - return new Pair<>(left, right); - } - - // region Binary : Arithmetic Binary Expression +// } + +// // endregion +// +// // region Binary Expressions +// +// private Pair getExpressionsForBinaryExpression( +// BinaryExpression binaryExpression) { +// ViewExpression left = this.process(binaryExpression.getLeftExpression(), null); +// ViewExpression right = this.process(binaryExpression.getRightExpression(), null); +// return new Pair<>(left, right); +// } +// +// // region Binary : Arithmetic Binary Expression +// @Override +// public ViewExpression visitAdditionExpression( +// AdditionExpression additionExpression, Void context) { +// Pair pair = +// this.getExpressionsForBinaryExpression(additionExpression); +// return new AdditionViewExpression(pair.left, pair.right); +// } +// @Override - public ViewExpression visitAdditionExpression( - AdditionExpression additionExpression, Void context) { - Pair pair = - this.getExpressionsForBinaryExpression(additionExpression); - return new AdditionViewExpression(pair.left, pair.right); - } - - @Override - public ViewExpression visitDivisionExpression( - DivisionExpression divisionExpression, Void context) { - Pair pair = - this.getExpressionsForBinaryExpression(divisionExpression); - return new DivisionViewExpression(pair.left, pair.right); - } - +// public ViewExpression visitDivisionExpression( +// DivisionExpression divisionExpression, Void context) { +// Pair pair = +// this.getExpressionsForBinaryExpression(divisionExpression); +// return new DivisionViewExpression(pair.left, pair.right); +// } +// @Override - public ViewExpression visitModuloExpression(ModuloExpression moduloExpression, Void context) { - Pair pair = - this.getExpressionsForBinaryExpression(moduloExpression); - return new ModuloViewExpression(pair.left, pair.right); - } - +// public ViewExpression visitModuloExpression(ModuloExpression moduloExpression, Void context) { +// Pair pair = +// this.getExpressionsForBinaryExpression(moduloExpression); +// return new ModuloViewExpression(pair.left, pair.right); +// } +// @Override - public ViewExpression visitMultiplicationExpression( - MultiplicationExpression multiplicationExpression, Void context) { - Pair pair = - this.getExpressionsForBinaryExpression(multiplicationExpression); - return new MultiplicationViewExpression(pair.left, pair.right); - } - - @Override - public ViewExpression visitSubtractionExpression( - SubtractionExpression subtractionExpression, Void context) { - Pair pair = - this.getExpressionsForBinaryExpression(subtractionExpression); - return new SubtractionViewExpression(pair.left, pair.right); - } - - // endregion - - // region Binary: Compare Binary Expression - - @Override - public ViewExpression visitEqualToExpression(EqualToExpression equalToExpression, Void context) { - Pair pair = - this.getExpressionsForBinaryExpression(equalToExpression); - return new EqualToViewExpression(pair.left, pair.right); - } - +// public ViewExpression visitMultiplicationExpression( +// MultiplicationExpression multiplicationExpression, Void context) { +// Pair pair = +// this.getExpressionsForBinaryExpression(multiplicationExpression); +// return new MultiplicationViewExpression(pair.left, pair.right); +// } +// @Override - public ViewExpression visitGreaterEqualExpression( - GreaterEqualExpression greaterEqualExpression, Void context) { - Pair pair = - this.getExpressionsForBinaryExpression(greaterEqualExpression); - return new GreaterEqualViewExpression(pair.left, pair.right); - } - +// public ViewExpression visitSubtractionExpression( +// SubtractionExpression subtractionExpression, Void context) { +// Pair pair = +// this.getExpressionsForBinaryExpression(subtractionExpression); +// return new SubtractionViewExpression(pair.left, pair.right); +// } + +// // endregion +// +// // region Binary: Compare Binary Expression +// @Override - public ViewExpression visitGreaterThanExpression( - GreaterThanExpression greaterThanExpression, Void context) { - Pair pair = - this.getExpressionsForBinaryExpression(greaterThanExpression); - return new GreaterThanViewExpression(pair.left, pair.right); - } - +// public ViewExpression visitEqualToExpression(EqualToExpression equalToExpression, Void context) { +// Pair pair = +// this.getExpressionsForBinaryExpression(equalToExpression); +// return new EqualToViewExpression(pair.left, pair.right); +// } +// @Override - public ViewExpression visitLessEqualExpression( - LessEqualExpression lessEqualExpression, Void context) { - Pair pair = - this.getExpressionsForBinaryExpression(lessEqualExpression); - return new LessEqualViewExpression(pair.left, pair.right); - } - +// public ViewExpression visitGreaterEqualExpression( +// GreaterEqualExpression greaterEqualExpression, Void context) { +// Pair pair = +// this.getExpressionsForBinaryExpression(greaterEqualExpression); +// return new GreaterEqualViewExpression(pair.left, pair.right); +// } +// @Override - public ViewExpression visitLessThanExpression( - LessThanExpression lessThanExpression, Void context) { - Pair pair = - this.getExpressionsForBinaryExpression(lessThanExpression); - return new LessThanViewExpression(pair.left, pair.right); - } - +// public ViewExpression visitGreaterThanExpression( +// GreaterThanExpression greaterThanExpression, Void context) { +// Pair pair = +// this.getExpressionsForBinaryExpression(greaterThanExpression); +// return new GreaterThanViewExpression(pair.left, pair.right); +// } +// @Override - public ViewExpression visitNonEqualExpression( - NonEqualExpression nonEqualExpression, Void context) { - Pair pair = - this.getExpressionsForBinaryExpression(nonEqualExpression); - return new NonEqualViewExpression(pair.left, pair.right); - } - - // endregion - - // region Binary : Logic Binary Expression - +// public ViewExpression visitLessEqualExpression( +// LessEqualExpression lessEqualExpression, Void context) { +// Pair pair = +// this.getExpressionsForBinaryExpression(lessEqualExpression); +// return new LessEqualViewExpression(pair.left, pair.right); +// } +// @Override - public ViewExpression visitLogicAndExpression( - LogicAndExpression logicAndExpression, Void context) { - Pair pair = - this.getExpressionsForBinaryExpression(logicAndExpression); - return new LogicAndViewExpression(pair.left, pair.right); - } - +// public ViewExpression visitLessThanExpression( +// LessThanExpression lessThanExpression, Void context) { +// Pair pair = +// this.getExpressionsForBinaryExpression(lessThanExpression); +// return new LessThanViewExpression(pair.left, pair.right); +// } +// @Override - public ViewExpression visitLogicOrExpression(LogicOrExpression logicOrExpression, Void context) { - Pair pair = - this.getExpressionsForBinaryExpression(logicOrExpression); - return new LogicOrViewExpression(pair.left, pair.right); - } - - // endregion - - // endregion - - // region Ternary Expressions - +// public ViewExpression visitNonEqualExpression( +// NonEqualExpression nonEqualExpression, Void context) { +// Pair pair = +// this.getExpressionsForBinaryExpression(nonEqualExpression); +// return new NonEqualViewExpression(pair.left, pair.right); +// } + +// // endregion +// +// // region Binary : Logic Binary Expression +// @Override - public ViewExpression visitBetweenExpression(BetweenExpression betweenExpression, Void context) { - ViewExpression first = this.process(betweenExpression.getFirstExpression(), null); - ViewExpression second = this.process(betweenExpression.getSecondExpression(), null); - ViewExpression third = this.process(betweenExpression.getSecondExpression(), null); - return new BetweenViewExpression(first, second, third, betweenExpression.isNotBetween()); - } - - // endregion - - // region FunctionExpression +// public ViewExpression visitLogicAndExpression( +// LogicAndExpression logicAndExpression, Void context) { +// Pair pair = +// this.getExpressionsForBinaryExpression(logicAndExpression); +// return new LogicAndViewExpression(pair.left, pair.right); +// } +// @Override - public ViewExpression visitFunctionExpression( - FunctionExpression functionExpression, Void context) { - List expressionList = functionExpression.getExpressions(); - List viewExpressionList = new ArrayList<>(); - for (Expression expression : expressionList) { - viewExpressionList.add(this.process(expression, null)); - } - LinkedHashMap map = functionExpression.getFunctionAttributes(); - List keyList = new ArrayList<>(); - List valueList = new ArrayList<>(); - for (Map.Entry entry : map.entrySet()) { - keyList.add(entry.getKey()); - valueList.add(entry.getValue()); - } - return new FunctionViewExpression( - functionExpression.getFunctionName(), keyList, valueList, viewExpressionList); - } - // endregion - -} +// public ViewExpression visitLogicOrExpression(LogicOrExpression logicOrExpression, Void context) { +// Pair pair = +// this.getExpressionsForBinaryExpression(logicOrExpression); +// return new LogicOrViewExpression(pair.left, pair.right); +// } + +// // endregion +// +// // endregion +// +// // region Ternary Expressions +// +// @Override +// public ViewExpression visitBetweenExpression(BetweenExpression betweenExpression, Void context) { +// ViewExpression first = this.process(betweenExpression.getFirstExpression(), null); +// ViewExpression second = this.process(betweenExpression.getSecondExpression(), null); +// ViewExpression third = this.process(betweenExpression.getSecondExpression(), null); +// return new BetweenViewExpression(first, second, third, betweenExpression.isNotBetween()); +// } + +// // endregion +// +// // region FunctionExpression +// @Override +// public ViewExpression visitFunctionExpression( +// FunctionExpression functionExpression, Void context) { +// List expressionList = functionExpression.getExpressions(); +// List viewExpressionList = new ArrayList<>(); +// for (Expression expression : expressionList) { +// viewExpressionList.add(this.process(expression, null)); +// } +// LinkedHashMap map = functionExpression.getFunctionAttributes(); +// List keyList = new ArrayList<>(); +// List valueList = new ArrayList<>(); +// for (Map.Entry entry : map.entrySet()) { +// keyList.add(entry.getKey()); +// valueList.add(entry.getValue()); +// } +// return new FunctionViewExpression( +// functionExpression.getFunctionName(), keyList, valueList, viewExpressionList); +// } +// // endregion +// +// } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/LogicalPlanVisitor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/LogicalPlanVisitor.java index fa39b3ba7dcef..800e23804ae85 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/LogicalPlanVisitor.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/LogicalPlanVisitor.java @@ -20,7 +20,7 @@ import org.apache.iotdb.commons.path.PartialPath; import org.apache.iotdb.commons.schema.column.ColumnHeaderConstant; -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; import org.apache.iotdb.db.queryengine.common.MPPQueryContext; import org.apache.iotdb.db.queryengine.plan.analyze.Analysis; import org.apache.iotdb.db.queryengine.plan.expression.Expression; @@ -954,11 +954,11 @@ public PlanNode visitShowQueries( .planLimit(showQueriesStatement.getRowLimit()); return planBuilder.getRoot(); } - - @Override - public PlanNode visitCreateLogicalView( - CreateLogicalViewStatement createLogicalViewStatement, MPPQueryContext context) { - List viewExpressionList = new ArrayList<>(); +// +// @Override +// public PlanNode visitCreateLogicalView( +// CreateLogicalViewStatement createLogicalViewStatement, MPPQueryContext context) { +// List viewExpressionList = new ArrayList<>(); if (createLogicalViewStatement.getViewExpressions() == null) { // Transform all Expressions into ViewExpressions. TransformToViewExpressionVisitor transformToViewExpressionVisitor = @@ -969,13 +969,13 @@ public PlanNode visitCreateLogicalView( } } else { viewExpressionList = createLogicalViewStatement.getViewExpressions(); - } +// } - return new CreateLogicalViewNode( - context.getQueryId().genPlanNodeId(), - createLogicalViewStatement.getTargetPathList(), - viewExpressionList); - } +// return new CreateLogicalViewNode( +// context.getQueryId().genPlanNodeId(), +// createLogicalViewStatement.getTargetPathList(), +// viewExpressionList); +// } @Override public PlanNode visitShowLogicalView( diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/PlanNodeType.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/PlanNodeType.java index a834f7e076d2d..4b0ed3bffdf4b 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/PlanNodeType.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/PlanNodeType.java @@ -226,7 +226,7 @@ public enum PlanNodeType { INTERNAL_CREATE_MULTI_TIMESERIES((short) 69), IDENTITY_SINK((short) 70), SHUFFLE_SINK((short) 71), - BATCH_ACTIVATE_TEMPLATE((short) 72), +// BATCH_ACTIVATE_TEMPLATE((short) 72), CREATE_LOGICAL_VIEW((short) 73), CONSTRUCT_LOGICAL_VIEW_BLACK_LIST((short) 74), ROLLBACK_LOGICAL_VIEW_BLACK_LIST((short) 75), @@ -534,8 +534,8 @@ public static PlanNode deserialize(ByteBuffer buffer, short nodeType) { return ShuffleSinkNode.deserialize(buffer); case 72: return BatchActivateTemplateNode.deserialize(buffer); - case 73: - return CreateLogicalViewNode.deserialize(buffer); +// case 73: +// return CreateLogicalViewNode.deserialize(buffer); case 74: return ConstructLogicalViewBlackListNode.deserialize(buffer); case 75: diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/metadata/write/view/CreateLogicalViewNode.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/metadata/write/view/CreateLogicalViewNode.java index ffdd63b29a408..71934096e8c61 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/metadata/write/view/CreateLogicalViewNode.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/metadata/write/view/CreateLogicalViewNode.java @@ -1,29 +1,29 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// package org.apache.iotdb.db.queryengine.plan.planner.plan.node.metadata.write.view; - -import org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet; +// +// import org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet; import org.apache.iotdb.commons.path.MeasurementPath; -import org.apache.iotdb.commons.path.PartialPath; -import org.apache.iotdb.commons.path.PathDeserializeUtil; -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.path.PartialPath; +// import org.apache.iotdb.commons.path.PathDeserializeUtil; +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; import org.apache.iotdb.db.conf.IoTDBDescriptor; import org.apache.iotdb.db.queryengine.plan.analyze.IAnalysis; import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanNode; @@ -36,217 +36,217 @@ import org.apache.tsfile.exception.NotImplementedException; import org.apache.tsfile.utils.ReadWriteIOUtils; - -import java.io.DataOutputStream; -import java.io.IOException; -import java.nio.ByteBuffer; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -public class CreateLogicalViewNode extends WritePlanNode implements ICreateLogicalViewPlan { - - /** - * A map from target path to source expression. Yht target path is the name of this logical view, - * and the source expression is the data source of this view. - */ - private Map viewPathToSourceMap; - - /** - * This variable will be set in function splitByPartition() according to analysis. And it will be - * set when creating new split nodes. - */ - private TRegionReplicaSet regionReplicaSet = null; - - public CreateLogicalViewNode( - PlanNodeId id, List paths, List expressions) { - super(id); - this.viewPathToSourceMap = convertTargetAndSourceListsToMap(paths, expressions); - } - - public CreateLogicalViewNode( - PlanNodeId id, Map viewPathToSourceMap) { - super(id); - this.viewPathToSourceMap = viewPathToSourceMap; - } - - public CreateLogicalViewNode( - PlanNodeId id, - Map viewPathToSourceMap, - TRegionReplicaSet regionReplicaSet) { - super(id); - this.viewPathToSourceMap = viewPathToSourceMap; - this.regionReplicaSet = regionReplicaSet; - } - - protected final Map convertTargetAndSourceListsToMap( - List paths, List expressions) { - if (paths.size() != expressions.size()) { - return null; - } - Map result = new HashMap<>(); - for (int i = 0; i < paths.size(); i++) { - result.put(paths.get(i), expressions.get(i)); - } - return result; - } - - // region Interfaces in ICreateLogicalViewPlan - @Override - public int getViewSize() { - return this.viewPathToSourceMap.size(); - } - - @Override - public Map getViewPathToSourceExpressionMap() { - return this.viewPathToSourceMap; - } - - @Override - public List getViewPathList() { - List result = new ArrayList<>(this.viewPathToSourceMap.keySet()); - return result; - } - - @Override - public void setViewPathToSourceExpressionMap( - Map viewPathToSourceExpressionMap) { - this.viewPathToSourceMap = viewPathToSourceExpressionMap; - } - - @Override - public R accept(PlanVisitor visitor, C schemaRegion) { - return visitor.visitCreateLogicalView(this, schemaRegion); - } - - // endregion - - // region Interfaces in WritePlanNode or PlanNode - - @Override - public TRegionReplicaSet getRegionReplicaSet() { - return this.regionReplicaSet; - } - - @Override - public List getChildren() { - return new ArrayList<>(); - } - - @Override - public void addChild(PlanNode child) { - // do nothing. this node should never have any child - } - +// +// import java.io.DataOutputStream; +// import java.io.IOException; +// import java.nio.ByteBuffer; +// import java.util.ArrayList; +// import java.util.HashMap; +// import java.util.List; +// import java.util.Map; +// import java.util.Objects; +// +// public class CreateLogicalViewNode extends WritePlanNode implements ICreateLogicalViewPlan { +// +// /** +// * A map from target path to source expression. Yht target path is the name of this logical view, +// * and the source expression is the data source of this view. +// */ +// private Map viewPathToSourceMap; +// +// /** +// * This variable will be set in function splitByPartition() according to analysis. And it will be +// * set when creating new split nodes. +// */ +// private TRegionReplicaSet regionReplicaSet = null; +// +// public CreateLogicalViewNode( +// PlanNodeId id, List paths, List expressions) { +// super(id); +// this.viewPathToSourceMap = convertTargetAndSourceListsToMap(paths, expressions); +// } +// +// public CreateLogicalViewNode( +// PlanNodeId id, Map viewPathToSourceMap) { +// super(id); +// this.viewPathToSourceMap = viewPathToSourceMap; +// } +// +// public CreateLogicalViewNode( +// PlanNodeId id, +// Map viewPathToSourceMap, +// TRegionReplicaSet regionReplicaSet) { +// super(id); +// this.viewPathToSourceMap = viewPathToSourceMap; +// this.regionReplicaSet = regionReplicaSet; +// } +// +// protected final Map convertTargetAndSourceListsToMap( +// List paths, List expressions) { +// if (paths.size() != expressions.size()) { +// return null; +// } +// Map result = new HashMap<>(); +// for (int i = 0; i < paths.size(); i++) { +// result.put(paths.get(i), expressions.get(i)); +// } +// return result; +// } +// +// // region Interfaces in ICreateLogicalViewPlan +// @Override +// public int getViewSize() { +// return this.viewPathToSourceMap.size(); +// } +// +// @Override +// public Map getViewPathToSourceExpressionMap() { +// return this.viewPathToSourceMap; +// } +// +// @Override +// public List getViewPathList() { +// List result = new ArrayList<>(this.viewPathToSourceMap.keySet()); +// return result; +// } +// +// @Override +// public void setViewPathToSourceExpressionMap( +// Map viewPathToSourceExpressionMap) { +// this.viewPathToSourceMap = viewPathToSourceExpressionMap; +// } +// +// @Override +// public R accept(PlanVisitor visitor, C schemaRegion) { +// return visitor.visitCreateLogicalView(this, schemaRegion); +// } + +// // endregion +// +// // region Interfaces in WritePlanNode or PlanNode +// +// @Override +// public TRegionReplicaSet getRegionReplicaSet() { +// return this.regionReplicaSet; +// } +// +// @Override +// public List getChildren() { +// return new ArrayList<>(); +// } +// +// @Override +// public void addChild(PlanNode child) { +// // do nothing. this node should never have any child +// } +// @Override public PlanNodeType getType() { return PlanNodeType.CREATE_LOGICAL_VIEW; } - @Override - public PlanNode clone() { - // TODO: CRTODO, complete this method - throw new NotImplementedException("Clone of CreateMultiTimeSeriesNode is not implemented"); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null || getClass() != obj.getClass()) { - return false; - } - CreateLogicalViewNode that = (CreateLogicalViewNode) obj; - return (this.getPlanNodeId().equals(that.getPlanNodeId()) - && Objects.equals(this.viewPathToSourceMap, that.viewPathToSourceMap)); - } - +// @Override +// public PlanNode clone() { +// // TODO: CRTODO, complete this method +// throw new NotImplementedException("Clone of CreateMultiTimeSeriesNode is not implemented"); +// } +// +// @Override +// public boolean equals(Object obj) { +// if (this == obj) { +// return true; +// } +// if (obj == null || getClass() != obj.getClass()) { +// return false; +// } +// CreateLogicalViewNode that = (CreateLogicalViewNode) obj; +// return (this.getPlanNodeId().equals(that.getPlanNodeId()) +// && Objects.equals(this.viewPathToSourceMap, that.viewPathToSourceMap)); +// } +// @Override public int hashCode() { return Objects.hash(this.getPlanNodeId(), this.viewPathToSourceMap); } - @Override - public int allowedChildCount() { - // this node should never have any child - return NO_CHILD_ALLOWED; - } - - @Override - public List getOutputColumnNames() { - // TODO: CRTODO, complete this method - throw new NotImplementedException( - "getOutputColumnNames of CreateMultiTimeSeriesNode is not implemented"); - } - - @Override - protected void serializeAttributes(ByteBuffer byteBuffer) { - PlanNodeType.CREATE_LOGICAL_VIEW.serialize(byteBuffer); - // serialize other member variables for this node - ReadWriteIOUtils.write(this.viewPathToSourceMap.size(), byteBuffer); - for (Map.Entry entry : viewPathToSourceMap.entrySet()) { - entry.getKey().serialize(byteBuffer); - ViewExpression.serialize(entry.getValue(), byteBuffer); - } - } - - @Override - protected void serializeAttributes(DataOutputStream stream) throws IOException { - PlanNodeType.CREATE_LOGICAL_VIEW.serialize(stream); - // serialize other member variables for this node - ReadWriteIOUtils.write(this.viewPathToSourceMap.size(), stream); - for (Map.Entry entry : viewPathToSourceMap.entrySet()) { - entry.getKey().serialize(stream); - ViewExpression.serialize(entry.getValue(), stream); - } - } - - public static CreateLogicalViewNode deserialize(ByteBuffer byteBuffer) { - // deserialize member variables - Map viewPathToSourceMap = new HashMap<>(); - int size = byteBuffer.getInt(); - PartialPath path; - ViewExpression viewExpression; - for (int i = 0; i < size; i++) { - path = (PartialPath) PathDeserializeUtil.deserialize(byteBuffer); - viewExpression = ViewExpression.deserialize(byteBuffer); - viewPathToSourceMap.put(path, viewExpression); - } - // deserialize PlanNodeId next - PlanNodeId planNodeId = PlanNodeId.deserialize(byteBuffer); - return new CreateLogicalViewNode(planNodeId, viewPathToSourceMap); - } - - @Override +// @Override +// public int allowedChildCount() { +// // this node should never have any child +// return NO_CHILD_ALLOWED; +// } +// +// @Override +// public List getOutputColumnNames() { +// // TODO: CRTODO, complete this method +// throw new NotImplementedException( +// "getOutputColumnNames of CreateMultiTimeSeriesNode is not implemented"); +// } +// +// @Override +// protected void serializeAttributes(ByteBuffer byteBuffer) { +// PlanNodeType.CREATE_LOGICAL_VIEW.serialize(byteBuffer); +// // serialize other member variables for this node +// ReadWriteIOUtils.write(this.viewPathToSourceMap.size(), byteBuffer); +// for (Map.Entry entry : viewPathToSourceMap.entrySet()) { +// entry.getKey().serialize(byteBuffer); +// ViewExpression.serialize(entry.getValue(), byteBuffer); +// } +// } +// +// @Override +// protected void serializeAttributes(DataOutputStream stream) throws IOException { +// PlanNodeType.CREATE_LOGICAL_VIEW.serialize(stream); +// // serialize other member variables for this node +// ReadWriteIOUtils.write(this.viewPathToSourceMap.size(), stream); +// for (Map.Entry entry : viewPathToSourceMap.entrySet()) { +// entry.getKey().serialize(stream); +// ViewExpression.serialize(entry.getValue(), stream); +// } +// } +// +// public static CreateLogicalViewNode deserialize(ByteBuffer byteBuffer) { +// // deserialize member variables +// Map viewPathToSourceMap = new HashMap<>(); +// int size = byteBuffer.getInt(); +// PartialPath path; +// ViewExpression viewExpression; +// for (int i = 0; i < size; i++) { +// path = (PartialPath) PathDeserializeUtil.deserialize(byteBuffer); +// viewExpression = ViewExpression.deserialize(byteBuffer); +// viewPathToSourceMap.put(path, viewExpression); +// } +// // deserialize PlanNodeId next +// PlanNodeId planNodeId = PlanNodeId.deserialize(byteBuffer); +// return new CreateLogicalViewNode(planNodeId, viewPathToSourceMap); +// } +// +// @Override public List splitByPartition(IAnalysis analysis) { - Map> splitMap = new HashMap<>(); - for (Map.Entry entry : this.viewPathToSourceMap.entrySet()) { - // for each entry in the map for target path to source expression, - // build a map from TRegionReplicaSet to this entry. - // Please note that getSchemaRegionReplicaSet needs a device path as parameter. - TRegionReplicaSet regionReplicaSet = +// Map> splitMap = new HashMap<>(); +// for (Map.Entry entry : this.viewPathToSourceMap.entrySet()) { +// // for each entry in the map for target path to source expression, +// // build a map from TRegionReplicaSet to this entry. +// // Please note that getSchemaRegionReplicaSet needs a device path as parameter. +// TRegionReplicaSet regionReplicaSet = analysis .getSchemaPartitionInfo() .getSchemaRegionReplicaSet( new MeasurementPath(entry.getKey().getNodes()).getIDeviceID()); - - // create a map if the key(regionReplicaSet) is not exists, - // then put this entry into this map(from regionReplicaSet to this entry) - splitMap - .computeIfAbsent(regionReplicaSet, k -> new HashMap<>()) - .put(entry.getKey(), entry.getValue()); - } - - // split this node into several nodes according to their regionReplicaSet - List result = new ArrayList<>(); +// +// // create a map if the key(regionReplicaSet) is not exists, +// // then put this entry into this map(from regionReplicaSet to this entry) +// splitMap +// .computeIfAbsent(regionReplicaSet, k -> new HashMap<>()) +// .put(entry.getKey(), entry.getValue()); +// } +// +// // split this node into several nodes according to their regionReplicaSet +// List result = new ArrayList<>(); int maxSingleRequestSize = IoTDBDescriptor.getInstance().getConfig().getMaxMeasurementNumOfInternalRequest(); - for (Map.Entry> entry : - splitMap.entrySet()) { - // for each entry in splitMap, create a plan node. +// for (Map.Entry> entry : +// splitMap.entrySet()) { +// // for each entry in splitMap, create a plan node. if (entry.getValue().size() > maxSingleRequestSize) { for (Map splitRequest : splitRequest(entry.getValue(), maxSingleRequestSize)) { @@ -255,9 +255,9 @@ public List splitByPartition(IAnalysis analysis) { } else { result.add(new CreateLogicalViewNode(getPlanNodeId(), entry.getValue(), entry.getKey())); } - } - return result; - } +// } +// return result; +// } private List> splitRequest( Map rawRequest, int maxSize) { @@ -280,19 +280,19 @@ private List> splitRequest( return result; } - // endregion - - public List getAllTimeSeriesPathInSource() { - List sourceExpressions = new ArrayList<>(); - for (Map.Entry entry : this.viewPathToSourceMap.entrySet()) { - sourceExpressions.add(entry.getValue()); - } - // for each view expression, get the partial path for time series operand - List result = new ArrayList<>(); - GetSourcePathsVisitor getSourcePathsVisitor = new GetSourcePathsVisitor(); - for (ViewExpression expression : sourceExpressions) { - result.addAll(getSourcePathsVisitor.process(expression, null)); - } - return result; - } -} +// // endregion +// +// public List getAllTimeSeriesPathInSource() { +// List sourceExpressions = new ArrayList<>(); +// for (Map.Entry entry : this.viewPathToSourceMap.entrySet()) { +// sourceExpressions.add(entry.getValue()); +// } +// // for each view expression, get the partial path for time series operand +// List result = new ArrayList<>(); +// GetSourcePathsVisitor getSourcePathsVisitor = new GetSourcePathsVisitor(); +// for (ViewExpression expression : sourceExpressions) { +// result.addAll(getSourcePathsVisitor.process(expression, null)); +// } +// return result; +// } +// } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/SchemaCacheEntry.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/SchemaCacheEntry.java index d26ddd88fc162..5c46b69e00e5b 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/SchemaCacheEntry.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/SchemaCacheEntry.java @@ -19,7 +19,7 @@ package org.apache.iotdb.db.queryengine.plan.relational.metadata.fetcher.cache; -import org.apache.iotdb.commons.schema.view.LogicalViewSchema; +// import org.apache.iotdb.commons.schema.view.LogicalViewSchema; import org.apache.iotdb.db.queryengine.common.schematree.IMeasurementSchemaInfo; import org.apache.tsfile.enums.TSDataType; @@ -51,14 +51,14 @@ public class SchemaCacheEntry implements IMeasurementSchemaInfo { private static final int INSTANCE_SIZE = (int) RamUsageEstimator.shallowSizeOfInstance(SchemaCacheEntry.class) + 75; - private final IMeasurementSchema iMeasurementSchema; +// private final IMeasurementSchema iMeasurementSchema; private final Map tagMap; public SchemaCacheEntry( final @Nonnull IMeasurementSchema iMeasurementSchema, final @Nullable Map tagMap) { - this.iMeasurementSchema = iMeasurementSchema; +// this.iMeasurementSchema = iMeasurementSchema; this.tagMap = tagMap; } @@ -73,7 +73,7 @@ public Map getAttributeMap() { } public TSDataType getTsDataType() { - return iMeasurementSchema.getType(); +// return iMeasurementSchema.getType(); } public static int estimateSize(final SchemaCacheEntry schemaCacheEntry) { @@ -88,33 +88,33 @@ public String getName() { } @Override - public IMeasurementSchema getSchema() { - return iMeasurementSchema; - } - - @Override - public MeasurementSchema getSchemaAsMeasurementSchema() { - if (this.iMeasurementSchema instanceof MeasurementSchema) { - return (MeasurementSchema) this.getSchema(); - } - return null; - } - - @Override - public LogicalViewSchema getSchemaAsLogicalViewSchema() { - if (this.iMeasurementSchema instanceof LogicalViewSchema) { - return (LogicalViewSchema) this.getSchema(); - } - return null; +// public IMeasurementSchema getSchema() { +// return iMeasurementSchema; +// } +// +// @Override +// public MeasurementSchema getSchemaAsMeasurementSchema() { +// if (this.iMeasurementSchema instanceof MeasurementSchema) { +// return (MeasurementSchema) this.getSchema(); +// } +// return null; } +// @Override +// public LogicalViewSchema getSchemaAsLogicalViewSchema() { +// if (this.iMeasurementSchema instanceof LogicalViewSchema) { +// return (LogicalViewSchema) this.getSchema(); +// } +// return null; +// } +// @Override public String getAlias() { return null; } - - @Override - public boolean isLogicalView() { - return this.iMeasurementSchema.isLogicalView(); - } +// +// @Override +// public boolean isLogicalView() { +// return this.iMeasurementSchema.isLogicalView(); +// } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/StatementType.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/StatementType.java index 4284a484d573a..654554a0ecafd 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/StatementType.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/StatementType.java @@ -171,8 +171,8 @@ public enum StatementType { SHOW_SPACE_QUOTA, SET_THROTTLE_QUOTA, SHOW_THROTTLE_QUOTA, - - CREATE_LOGICAL_VIEW, +// +// CREATE_LOGICAL_VIEW, DELETE_LOGICAL_VIEW, RENAME_LOGICAL_VIEW, ALTER_LOGICAL_VIEW, diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/StatementVisitor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/StatementVisitor.java index 3bafdf8bfe0f0..3367b293d7c26 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/StatementVisitor.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/StatementVisitor.java @@ -280,12 +280,12 @@ public R visitShowPipePlugins(ShowPipePluginsStatement showPipePluginsStatement, return visitStatement(showPipePluginsStatement, context); } - // Create Logical View - public R visitCreateLogicalView( - CreateLogicalViewStatement createLogicalViewStatement, C context) { - return visitStatement(createLogicalViewStatement, context); - } - +// // Create Logical View +// public R visitCreateLogicalView( +// CreateLogicalViewStatement createLogicalViewStatement, C context) { +// return visitStatement(createLogicalViewStatement, context); +// } +// public R visitDeleteLogicalView( DeleteLogicalViewStatement deleteLogicalViewStatement, C context) { return visitStatement(deleteLogicalViewStatement, context); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertBaseStatement.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertBaseStatement.java index 177c05bde1927..f08f72cbb3d0e 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertBaseStatement.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertBaseStatement.java @@ -21,10 +21,11 @@ import org.apache.iotdb.commons.path.PartialPath; import org.apache.iotdb.commons.schema.table.column.TsTableColumnCategory; -import org.apache.iotdb.commons.schema.view.LogicalViewSchema; +// import org.apache.iotdb.commons.schema.view.LogicalViewSchema; +import org.apache.iotdb.db.auth.AuthorityChecker; import org.apache.iotdb.db.conf.IoTDBDescriptor; import org.apache.iotdb.db.exception.metadata.DataTypeMismatchException; -import org.apache.iotdb.db.exception.metadata.DuplicateInsertException; +// import org.apache.iotdb.db.exception.metadata.DuplicateInsertException; import org.apache.iotdb.db.exception.metadata.PathNotExistException; import org.apache.iotdb.db.exception.query.QueryProcessException; import org.apache.iotdb.db.exception.sql.SemanticException; @@ -46,17 +47,17 @@ import org.apache.tsfile.utils.RamUsageEstimator; import org.apache.tsfile.write.schema.MeasurementSchema; -import java.util.ArrayList; -import java.util.Arrays; +// import java.util.ArrayList; +// import java.util.Arrays; import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; +// import java.util.HashMap; +// import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Objects; import java.util.Optional; -import java.util.Set; +// import java.util.Set; import java.util.stream.Collectors; public abstract class InsertBaseStatement extends Statement implements Accountable { @@ -87,31 +88,31 @@ public abstract class InsertBaseStatement extends Statement implements Accountab protected List attrColumnIndices; protected boolean writeToTable = false; - // region params used by analyzing logical views. - - /** This param records the logical view schema appeared in this statement. */ +// // region params used by analyzing logical views. +// +// /** This param records the logical view schema appeared in this statement. */ protected List logicalViewSchemaList; - - /** - * This param records the index of the location where the source of this view should be placed. - * - *

For example, indexListOfLogicalViewPaths[alpha] = beta means source of - * logicalViewSchemaList[alpha] should be filled into measurementSchemas[beta]. - */ +// +// /** +// * This param records the index of the location where the source of this view should be placed. +// * +// *

For example, indexListOfLogicalViewPaths[alpha] = beta means source of +// * logicalViewSchemaList[alpha] should be filled into measurementSchemas[beta]. +// */ protected List indexOfSourcePathsOfLogicalViews; - - /** it is the end of last range, the beginning of current range. */ +// +// /** it is the end of last range, the beginning of current range. */ protected int recordedBeginOfLogicalViewSchemaList = 0; - - /** it is the end of current range. */ +// +// /** it is the end of current range. */ protected int recordedEndOfLogicalViewSchemaList = 0; - +// @TableModel protected String databaseName; protected long ramBytesUsed = Long.MIN_VALUE; - // endregion - +// // endregion +// public PartialPath getDevicePath() { return devicePath; } @@ -449,96 +450,96 @@ public Object getValue() { } // endregion - - // region functions used by analyzing logical views - /** - * Remove logical view in this statement according to validated schemas. So this function should - * be called after validating schemas. - */ - public abstract InsertBaseStatement removeLogicalView(); - - public void setFailedMeasurementIndex2Info( - Map failedMeasurementIndex2Info) { - this.failedMeasurementIndex2Info = failedMeasurementIndex2Info; - } - - /** - * This function is used in splitting. Traverse two lists: logicalViewSchemaList, measurements, - * then find out all devices in this statement. Those devices will map to their measurements, - * recorded in a pair of measurement name and the index of measurement schemas - * (this.measurementSchemas). - * - * @return map from device path to its measurements. - */ +// +// // region functions used by analyzing logical views +// /** +// * Remove logical view in this statement according to validated schemas. So this function should +// * be called after validating schemas. +// */ +// public abstract InsertBaseStatement removeLogicalView(); +// +// public void setFailedMeasurementIndex2Info( +// Map failedMeasurementIndex2Info) { +// this.failedMeasurementIndex2Info = failedMeasurementIndex2Info; +// } +// +// /** +// * This function is used in splitting. Traverse two lists: logicalViewSchemaList, measurements, +// * then find out all devices in this statement. Those devices will map to their measurements, +// * recorded in a pair of measurement name and the index of measurement schemas +// * (this.measurementSchemas). +// * +// * @return map from device path to its measurements. +// */ protected Map>> getMapFromDeviceToMeasurementAndIndex() { - boolean[] isLogicalView = new boolean[this.measurements.length]; - int[] indexMapToLogicalViewList = new int[this.measurements.length]; - Arrays.fill(isLogicalView, false); - if (this.indexOfSourcePathsOfLogicalViews != null) { - for (int i = 0; i < this.indexOfSourcePathsOfLogicalViews.size(); i++) { - int realIndex = this.indexOfSourcePathsOfLogicalViews.get(i); - isLogicalView[realIndex] = true; - indexMapToLogicalViewList[realIndex] = i; - } - } +// boolean[] isLogicalView = new boolean[this.measurements.length]; +// int[] indexMapToLogicalViewList = new int[this.measurements.length]; +// Arrays.fill(isLogicalView, false); +// if (this.indexOfSourcePathsOfLogicalViews != null) { +// for (int i = 0; i < this.indexOfSourcePathsOfLogicalViews.size(); i++) { +// int realIndex = this.indexOfSourcePathsOfLogicalViews.get(i); +// isLogicalView[realIndex] = true; +// indexMapToLogicalViewList[realIndex] = i; +// } +// } // construct map from device to measurements and record the index of its measurement // schema - Map>> mapFromDeviceToMeasurementAndIndex = - new HashMap<>(); - for (int i = 0; i < this.measurements.length; i++) { +// Map>> mapFromDeviceToMeasurementAndIndex = +// new HashMap<>(); +// for (int i = 0; i < this.measurements.length; i++) { PartialPath targetDevicePath; - String measurementName; - if (isLogicalView[i]) { - int viewIndex = indexMapToLogicalViewList[i]; +// String measurementName; +// if (isLogicalView[i]) { +// int viewIndex = indexMapToLogicalViewList[i]; targetDevicePath = - this.logicalViewSchemaList.get(viewIndex).getSourcePathIfWritable().getDevicePath(); - measurementName = - this.logicalViewSchemaList.get(viewIndex).getSourcePathIfWritable().getMeasurement(); - } else { +// this.logicalViewSchemaList.get(viewIndex).getSourcePathIfWritable().getDevicePath(); +// measurementName = +// this.logicalViewSchemaList.get(viewIndex).getSourcePathIfWritable().getMeasurement(); +// } else { targetDevicePath = this.devicePath; - measurementName = this.measurements[i]; - } - int index = i; - final String finalMeasurementName = measurementName; - mapFromDeviceToMeasurementAndIndex.compute( +// measurementName = this.measurements[i]; +// } +// int index = i; +// final String finalMeasurementName = measurementName; +// mapFromDeviceToMeasurementAndIndex.compute( targetDevicePath, - (k, v) -> { - if (v == null) { - List> valueList = new ArrayList<>(); - valueList.add(new Pair<>(finalMeasurementName, index)); - return valueList; - } else { - v.add(new Pair<>(finalMeasurementName, index)); - return v; - } - }); - } - // check this map, ensure that all time series (measurements in each device) only appear once - validateMapFromDeviceToMeasurement(mapFromDeviceToMeasurementAndIndex); - return mapFromDeviceToMeasurementAndIndex; - } - - protected static void validateMapFromDeviceToMeasurement( - Map>> map) { - if (map == null) { - return; - } - for (Map.Entry>> entry : map.entrySet()) { - List> measurementList = entry.getValue(); - if (measurementList.size() <= 1) { - continue; - } - Set measurementSet = new HashSet<>(); - for (Pair thisPair : measurementList) { - boolean measurementNotExists = measurementSet.add(thisPair.left); - if (!measurementNotExists) { - PartialPath devicePath = entry.getKey(); +// (k, v) -> { +// if (v == null) { +// List> valueList = new ArrayList<>(); +// valueList.add(new Pair<>(finalMeasurementName, index)); +// return valueList; +// } else { +// v.add(new Pair<>(finalMeasurementName, index)); +// return v; +// } +// }); +// } +// // check this map, ensure that all time series (measurements in each device) only appear once +// validateMapFromDeviceToMeasurement(mapFromDeviceToMeasurementAndIndex); +// return mapFromDeviceToMeasurementAndIndex; +// } +// +// protected static void validateMapFromDeviceToMeasurement( +// Map>> map) { +// if (map == null) { +// return; +// } +// for (Map.Entry>> entry : map.entrySet()) { +// List> measurementList = entry.getValue(); +// if (measurementList.size() <= 1) { +// continue; +// } +// Set measurementSet = new HashSet<>(); +// for (Pair thisPair : measurementList) { +// boolean measurementNotExists = measurementSet.add(thisPair.left); +// if (!measurementNotExists) { +// PartialPath devicePath = entry.getKey(); throw new SemanticException( - new DuplicateInsertException(devicePath.getFullPath(), thisPair.left)); - } - } - } - } +// new DuplicateInsertException(devicePath.getFullPath(), thisPair.left)); +// } +// } +// } +// } public void insertColumn(final int pos, final ColumnSchema columnSchema) { if (pos < 0 || pos > measurements.length) { @@ -633,7 +634,7 @@ public Optional getDatabaseName() { return Optional.ofNullable(databaseName); } - // endregion +// // endregion @TableModel public void toLowerCase() { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertMultiTabletsStatement.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertMultiTabletsStatement.java index f1816347c21ca..bc5989d4d571e 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertMultiTabletsStatement.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertMultiTabletsStatement.java @@ -138,23 +138,23 @@ public long getMinTime() { public Object getFirstValueOfIndex(int index) { throw new NotImplementedException(); } - - @Override - public InsertBaseStatement removeLogicalView() { - List mergedList = new ArrayList<>(); - boolean needSplit = false; - for (InsertTabletStatement child : this.insertTabletStatementList) { - List childSplitResult = child.getSplitList(); - needSplit = needSplit || child.isNeedSplit(); - mergedList.addAll(childSplitResult); - } - if (!needSplit) { - return this; - } - InsertMultiTabletsStatement splitResult = new InsertMultiTabletsStatement(); - splitResult.setInsertTabletStatementList(mergedList); - return splitResult; - } +// +// @Override +// public InsertBaseStatement removeLogicalView() { +// List mergedList = new ArrayList<>(); +// boolean needSplit = false; +// for (InsertTabletStatement child : this.insertTabletStatementList) { +// List childSplitResult = child.getSplitList(); +// needSplit = needSplit || child.isNeedSplit(); +// mergedList.addAll(childSplitResult); +// } +// if (!needSplit) { +// return this; +// } +// InsertMultiTabletsStatement splitResult = new InsertMultiTabletsStatement(); +// splitResult.setInsertTabletStatementList(mergedList); +// return splitResult; +// } @TableModel @Override diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertRowStatement.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertRowStatement.java index 52901f6f7feaf..12c3069e0763e 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertRowStatement.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertRowStatement.java @@ -22,7 +22,7 @@ import org.apache.iotdb.common.rpc.thrift.TTimePartitionSlot; import org.apache.iotdb.commons.conf.IoTDBConstant; import org.apache.iotdb.commons.path.PartialPath; -import org.apache.iotdb.commons.schema.view.LogicalViewSchema; +// import org.apache.iotdb.commons.schema.view.LogicalViewSchema; import org.apache.iotdb.commons.utils.TimePartitionUtils; import org.apache.iotdb.db.conf.IoTDBDescriptor; import org.apache.iotdb.db.exception.metadata.DataTypeMismatchException; @@ -59,11 +59,11 @@ import java.nio.ByteBuffer; import java.time.ZoneId; import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; +// import java.util.Arrays; +// import java.util.Collections; import java.util.HashMap; import java.util.List; -import java.util.Map; +// import java.util.Map; import java.util.Objects; public class InsertRowStatement extends InsertBaseStatement implements ISchemaValidation { @@ -80,19 +80,19 @@ public class InsertRowStatement extends InsertBaseStatement implements ISchemaVa protected Object[] values; protected boolean isNeedInferType = false; - /** - * This param record whether the source of logical view is aligned. Only used when there are - * views. - */ +// /** +// * This param record whether the source of logical view is aligned. Only used when there are +// * views. +// */ protected boolean[] measurementIsAligned; - +// protected IDeviceID deviceID; public InsertRowStatement() { super(); statementType = StatementType.INSERT; - this.recordedBeginOfLogicalViewSchemaList = 0; - this.recordedEndOfLogicalViewSchemaList = 0; +// this.recordedBeginOfLogicalViewSchemaList = 0; +// this.recordedEndOfLogicalViewSchemaList = 0; } @Override @@ -312,65 +312,65 @@ public void semanticCheck() { } } - public boolean isNeedSplit() { +// public boolean isNeedSplit() { return hasLogicalViewNeedProcess(); - } - - public List getSplitList() { - if (!isNeedSplit()) { - return Collections.singletonList(this); - } - Map>> mapFromDeviceToMeasurementAndIndex = - this.getMapFromDeviceToMeasurementAndIndex(); - // Reconstruct statements - List insertRowStatementList = new ArrayList<>(); - for (Map.Entry>> entry : - mapFromDeviceToMeasurementAndIndex.entrySet()) { - List> pairList = entry.getValue(); - InsertRowStatement statement = new InsertRowStatement(); - statement.setTime(this.time); - statement.setNeedInferType(this.isNeedInferType); - statement.setDevicePath(entry.getKey()); - statement.setAligned(this.isAligned); +// } +// +// public List getSplitList() { +// if (!isNeedSplit()) { +// return Collections.singletonList(this); +// } +// Map>> mapFromDeviceToMeasurementAndIndex = +// this.getMapFromDeviceToMeasurementAndIndex(); +// // Reconstruct statements +// List insertRowStatementList = new ArrayList<>(); +// for (Map.Entry>> entry : +// mapFromDeviceToMeasurementAndIndex.entrySet()) { +// List> pairList = entry.getValue(); +// InsertRowStatement statement = new InsertRowStatement(); +// statement.setTime(this.time); +// statement.setNeedInferType(this.isNeedInferType); +// statement.setDevicePath(entry.getKey()); +// statement.setAligned(this.isAligned); Object[] copiedValues = new Object[pairList.size()]; - String[] measurements = new String[pairList.size()]; - MeasurementSchema[] measurementSchemas = new MeasurementSchema[pairList.size()]; - TSDataType[] dataTypes = new TSDataType[pairList.size()]; - for (int i = 0; i < pairList.size(); i++) { - int realIndex = pairList.get(i).right; +// String[] measurements = new String[pairList.size()]; +// MeasurementSchema[] measurementSchemas = new MeasurementSchema[pairList.size()]; +// TSDataType[] dataTypes = new TSDataType[pairList.size()]; +// for (int i = 0; i < pairList.size(); i++) { +// int realIndex = pairList.get(i).right; copiedValues[i] = this.values[realIndex]; measurements[i] = Objects.nonNull(this.measurements[realIndex]) ? pairList.get(i).left : null; - measurementSchemas[i] = this.measurementSchemas[realIndex]; - dataTypes[i] = this.dataTypes[realIndex]; - if (this.measurementIsAligned != null) { - statement.setAligned(this.measurementIsAligned[realIndex]); - } - } +// measurementSchemas[i] = this.measurementSchemas[realIndex]; +// dataTypes[i] = this.dataTypes[realIndex]; +// if (this.measurementIsAligned != null) { +// statement.setAligned(this.measurementIsAligned[realIndex]); +// } +// } statement.setValues(copiedValues); - statement.setMeasurements(measurements); - statement.setMeasurementSchemas(measurementSchemas); - statement.setDataTypes(dataTypes); - statement.setFailedMeasurementIndex2Info(failedMeasurementIndex2Info); - insertRowStatementList.add(statement); - } - return insertRowStatementList; - } - - @Override - public InsertBaseStatement removeLogicalView() { - if (!isNeedSplit()) { - return this; - } - List insertRowStatementList = this.getSplitList(); - if (insertRowStatementList.size() == 1) { - return insertRowStatementList.get(0); - } - InsertRowsStatement insertRowsStatement = new InsertRowsStatement(); - insertRowsStatement.setInsertRowStatementList(insertRowStatementList); - return insertRowsStatement; - } - +// statement.setMeasurements(measurements); +// statement.setMeasurementSchemas(measurementSchemas); +// statement.setDataTypes(dataTypes); +// statement.setFailedMeasurementIndex2Info(failedMeasurementIndex2Info); +// insertRowStatementList.add(statement); +// } +// return insertRowStatementList; +// } +// +// @Override +// public InsertBaseStatement removeLogicalView() { +// if (!isNeedSplit()) { +// return this; +// } +// List insertRowStatementList = this.getSplitList(); +// if (insertRowStatementList.size() == 1) { +// return insertRowStatementList.get(0); +// } +// InsertRowsStatement insertRowsStatement = new InsertRowsStatement(); +// insertRowsStatement.setInsertRowStatementList(insertRowStatementList); +// return insertRowsStatement; +// } +// @Override public ISchemaValidation getSchemaValidation() { return this; @@ -413,7 +413,7 @@ public CompressionType getCompressionType(int index) { @Override public void validateDeviceSchema(boolean isAligned) { - this.isAligned = isAligned; +// this.isAligned = isAligned; } @Override @@ -424,17 +424,17 @@ public void validateMeasurementSchema(int index, IMeasurementSchemaInfo measurem if (measurementSchemaInfo == null) { measurementSchemas[index] = null; } else { - if (measurementSchemaInfo.isLogicalView()) { - if (logicalViewSchemaList == null || indexOfSourcePathsOfLogicalViews == null) { - logicalViewSchemaList = new ArrayList<>(); - indexOfSourcePathsOfLogicalViews = new ArrayList<>(); - } - logicalViewSchemaList.add(measurementSchemaInfo.getSchemaAsLogicalViewSchema()); - indexOfSourcePathsOfLogicalViews.add(index); - return; - } else { - measurementSchemas[index] = measurementSchemaInfo.getSchemaAsMeasurementSchema(); - } +// if (measurementSchemaInfo.isLogicalView()) { +// if (logicalViewSchemaList == null || indexOfSourcePathsOfLogicalViews == null) { +// logicalViewSchemaList = new ArrayList<>(); +// indexOfSourcePathsOfLogicalViews = new ArrayList<>(); +// } +// logicalViewSchemaList.add(measurementSchemaInfo.getSchemaAsLogicalViewSchema()); +// indexOfSourcePathsOfLogicalViews.add(index); +// return; +// } else { +// measurementSchemas[index] = measurementSchemaInfo.getSchemaAsMeasurementSchema(); +// } } if (isNeedInferType) { return; @@ -446,49 +446,49 @@ public void validateMeasurementSchema(int index, IMeasurementSchemaInfo measurem throw new SemanticException(e); } } - - @Override - public void validateMeasurementSchema( - int index, IMeasurementSchemaInfo measurementSchemaInfo, boolean isAligned) { - this.validateMeasurementSchema(index, measurementSchemaInfo); - if (this.measurementIsAligned == null) { - this.measurementIsAligned = new boolean[this.measurements.length]; - Arrays.fill(this.measurementIsAligned, this.isAligned); - } - this.measurementIsAligned[index] = isAligned; - } - - @Override - public boolean hasLogicalViewNeedProcess() { - if (this.indexOfSourcePathsOfLogicalViews == null) { - return false; - } - return !this.indexOfSourcePathsOfLogicalViews.isEmpty(); - } - - @Override - public List getLogicalViewSchemaList() { - return this.logicalViewSchemaList; - } - - @Override - public List getIndexListOfLogicalViewPaths() { - return this.indexOfSourcePathsOfLogicalViews; - } - - @Override - public void recordRangeOfLogicalViewSchemaListNow() { - if (this.logicalViewSchemaList != null) { - this.recordedBeginOfLogicalViewSchemaList = this.recordedEndOfLogicalViewSchemaList; - this.recordedEndOfLogicalViewSchemaList = this.logicalViewSchemaList.size(); - } - } - - @Override - public Pair getRangeOfLogicalViewSchemaListRecorded() { - return new Pair<>( - this.recordedBeginOfLogicalViewSchemaList, this.recordedEndOfLogicalViewSchemaList); - } +// +// @Override +// public void validateMeasurementSchema( +// int index, IMeasurementSchemaInfo measurementSchemaInfo, boolean isAligned) { +// this.validateMeasurementSchema(index, measurementSchemaInfo); +// if (this.measurementIsAligned == null) { +// this.measurementIsAligned = new boolean[this.measurements.length]; +// Arrays.fill(this.measurementIsAligned, this.isAligned); +// } +// this.measurementIsAligned[index] = isAligned; +// } +// +// @Override +// public boolean hasLogicalViewNeedProcess() { +// if (this.indexOfSourcePathsOfLogicalViews == null) { +// return false; +// } +// return !this.indexOfSourcePathsOfLogicalViews.isEmpty(); +// } +// +// @Override +// public List getLogicalViewSchemaList() { +// return this.logicalViewSchemaList; +// } +// +// @Override +// public List getIndexListOfLogicalViewPaths() { +// return this.indexOfSourcePathsOfLogicalViews; +// } +// +// @Override +// public void recordRangeOfLogicalViewSchemaListNow() { +// if (this.logicalViewSchemaList != null) { +// this.recordedBeginOfLogicalViewSchemaList = this.recordedEndOfLogicalViewSchemaList; +// this.recordedEndOfLogicalViewSchemaList = this.logicalViewSchemaList.size(); +// } +// } +// +// @Override +// public Pair getRangeOfLogicalViewSchemaListRecorded() { +// return new Pair<>( +// this.recordedBeginOfLogicalViewSchemaList, this.recordedEndOfLogicalViewSchemaList); +// } @TableModel public IDeviceID getTableDeviceID() { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertRowsOfOneDeviceStatement.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertRowsOfOneDeviceStatement.java index 69324594f78f5..f8dbdef08de3f 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertRowsOfOneDeviceStatement.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertRowsOfOneDeviceStatement.java @@ -155,27 +155,27 @@ public long getMinTime() { public Object getFirstValueOfIndex(int index) { throw new NotImplementedException(); } - - @Override - public InsertBaseStatement removeLogicalView() { - boolean needSplit = false; - for (InsertRowStatement child : this.insertRowStatementList) { - if (child.isNeedSplit()) { - needSplit = true; - } - } - if (needSplit) { - List mergedList = new ArrayList<>(); - for (InsertRowStatement child : this.insertRowStatementList) { - List childSplitResult = child.getSplitList(); - mergedList.addAll(childSplitResult); - } - InsertRowsStatement splitResult = new InsertRowsStatement(); - splitResult.setInsertRowStatementList(mergedList); - return splitResult; - } - return this; - } +// +// @Override +// public InsertBaseStatement removeLogicalView() { +// boolean needSplit = false; +// for (InsertRowStatement child : this.insertRowStatementList) { +// if (child.isNeedSplit()) { +// needSplit = true; +// } +// } +// if (needSplit) { +// List mergedList = new ArrayList<>(); +// for (InsertRowStatement child : this.insertRowStatementList) { +// List childSplitResult = child.getSplitList(); +// mergedList.addAll(childSplitResult); +// } +// InsertRowsStatement splitResult = new InsertRowsStatement(); +// splitResult.setInsertRowStatementList(mergedList); +// return splitResult; +// } +// return this; +// } @TableModel @Override diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertRowsStatement.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertRowsStatement.java index ad9e9ff454620..411e68d354bee 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertRowsStatement.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertRowsStatement.java @@ -159,23 +159,23 @@ public long getMinTime() { public Object getFirstValueOfIndex(int index) { throw new NotImplementedException(); } - - @Override - public InsertBaseStatement removeLogicalView() { - List mergedList = new ArrayList<>(); - boolean needSplit = false; - for (InsertRowStatement child : this.insertRowStatementList) { - List childSplitResult = child.getSplitList(); - needSplit = needSplit || child.isNeedSplit(); - mergedList.addAll(childSplitResult); - } - if (!needSplit) { - return this; - } - InsertRowsStatement splitResult = new InsertRowsStatement(); - splitResult.setInsertRowStatementList(mergedList); - return splitResult; - } +// +// @Override +// public InsertBaseStatement removeLogicalView() { +// List mergedList = new ArrayList<>(); +// boolean needSplit = false; +// for (InsertRowStatement child : this.insertRowStatementList) { +// List childSplitResult = child.getSplitList(); +// needSplit = needSplit || child.isNeedSplit(); +// mergedList.addAll(childSplitResult); +// } +// if (!needSplit) { +// return this; +// } +// InsertRowsStatement splitResult = new InsertRowsStatement(); +// splitResult.setInsertRowStatementList(mergedList); +// return splitResult; +// } public List getDeviceIdListNoTableName() { return insertRowStatementList.stream() diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertTabletStatement.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertTabletStatement.java index 4680c313ba556..56f8e845ee88e 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertTabletStatement.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertTabletStatement.java @@ -23,7 +23,7 @@ import org.apache.iotdb.commons.exception.MetadataException; import org.apache.iotdb.commons.path.PartialPath; import org.apache.iotdb.commons.schema.table.column.TsTableColumnCategory; -import org.apache.iotdb.commons.schema.view.LogicalViewSchema; +// import org.apache.iotdb.commons.schema.view.LogicalViewSchema; import org.apache.iotdb.commons.utils.TimePartitionUtils; import org.apache.iotdb.db.exception.metadata.DataTypeMismatchException; import org.apache.iotdb.db.exception.metadata.PathNotExistException; @@ -60,11 +60,11 @@ import java.time.LocalDate; import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; +// import java.util.Arrays; +// import java.util.Collections; import java.util.HashMap; import java.util.List; -import java.util.Map; +// import java.util.Map; import java.util.Objects; public class InsertTabletStatement extends InsertBaseStatement implements ISchemaValidation { @@ -83,17 +83,17 @@ public class InsertTabletStatement extends InsertBaseStatement implements ISchem protected int rowCount = 0; - /** - * This param record whether the source of logical view is aligned. Only used when there are - * views. - */ +// /** +// * This param record whether the source of logical view is aligned. Only used when there are +// * views. +// */ protected boolean[] measurementIsAligned; - +// public InsertTabletStatement() { super(); statementType = StatementType.BATCH_INSERT; - this.recordedBeginOfLogicalViewSchemaList = 0; - this.recordedEndOfLogicalViewSchemaList = 0; +// this.recordedBeginOfLogicalViewSchemaList = 0; +// this.recordedEndOfLogicalViewSchemaList = 0; } public InsertTabletStatement( @@ -302,72 +302,72 @@ public void semanticCheck() { } } - public boolean isNeedSplit() { +// public boolean isNeedSplit() { return hasLogicalViewNeedProcess(); - } - - public List getSplitList() { - if (!isNeedSplit()) { - return Collections.singletonList(this); - } - Map>> mapFromDeviceToMeasurementAndIndex = - this.getMapFromDeviceToMeasurementAndIndex(); - // Reconstruct statements - List insertTabletStatementList = new ArrayList<>(); - for (Map.Entry>> entry : - mapFromDeviceToMeasurementAndIndex.entrySet()) { - List> pairList = entry.getValue(); - InsertTabletStatement statement = new InsertTabletStatement(); - statement.setTimes(this.times); - statement.setDevicePath(entry.getKey()); - statement.setRowCount(this.rowCount); - statement.setAligned(this.isAligned); +// } +// +// public List getSplitList() { +// if (!isNeedSplit()) { +// return Collections.singletonList(this); +// } +// Map>> mapFromDeviceToMeasurementAndIndex = +// this.getMapFromDeviceToMeasurementAndIndex(); +// // Reconstruct statements +// List insertTabletStatementList = new ArrayList<>(); +// for (Map.Entry>> entry : +// mapFromDeviceToMeasurementAndIndex.entrySet()) { +// List> pairList = entry.getValue(); +// InsertTabletStatement statement = new InsertTabletStatement(); +// statement.setTimes(this.times); +// statement.setDevicePath(entry.getKey()); +// statement.setRowCount(this.rowCount); +// statement.setAligned(this.isAligned); Object[] copiedColumns = new Object[pairList.size()]; - String[] measurements = new String[pairList.size()]; +// String[] measurements = new String[pairList.size()]; BitMap[] copiedBitMaps = new BitMap[pairList.size()]; - MeasurementSchema[] measurementSchemas = new MeasurementSchema[pairList.size()]; - TSDataType[] dataTypes = new TSDataType[pairList.size()]; - for (int i = 0; i < pairList.size(); i++) { - int realIndex = pairList.get(i).right; +// MeasurementSchema[] measurementSchemas = new MeasurementSchema[pairList.size()]; +// TSDataType[] dataTypes = new TSDataType[pairList.size()]; +// for (int i = 0; i < pairList.size(); i++) { +// int realIndex = pairList.get(i).right; copiedColumns[i] = this.columns[realIndex]; measurements[i] = Objects.nonNull(this.measurements[realIndex]) ? pairList.get(i).left : null; - measurementSchemas[i] = this.measurementSchemas[realIndex]; - dataTypes[i] = this.dataTypes[realIndex]; +// measurementSchemas[i] = this.measurementSchemas[realIndex]; +// dataTypes[i] = this.dataTypes[realIndex]; if (this.nullBitMaps != null) { copiedBitMaps[i] = this.nullBitMaps[realIndex]; - } - if (this.measurementIsAligned != null) { - statement.setAligned(this.measurementIsAligned[realIndex]); - } - } +// } +// if (this.measurementIsAligned != null) { +// statement.setAligned(this.measurementIsAligned[realIndex]); +// } +// } statement.setColumns(copiedColumns); - statement.setMeasurements(measurements); - statement.setMeasurementSchemas(measurementSchemas); - statement.setDataTypes(dataTypes); +// statement.setMeasurements(measurements); +// statement.setMeasurementSchemas(measurementSchemas); +// statement.setDataTypes(dataTypes); if (this.nullBitMaps != null) { statement.setBitMaps(copiedBitMaps); - } - statement.setFailedMeasurementIndex2Info(failedMeasurementIndex2Info); - insertTabletStatementList.add(statement); - } - return insertTabletStatementList; - } - - @Override - public InsertBaseStatement removeLogicalView() { - if (!isNeedSplit()) { - return this; - } - List insertTabletStatementList = this.getSplitList(); - if (insertTabletStatementList.size() == 1) { - return insertTabletStatementList.get(0); - } - InsertMultiTabletsStatement insertMultiTabletsStatement = new InsertMultiTabletsStatement(); - insertMultiTabletsStatement.setInsertTabletStatementList(insertTabletStatementList); - return insertMultiTabletsStatement; - } - +// } +// statement.setFailedMeasurementIndex2Info(failedMeasurementIndex2Info); +// insertTabletStatementList.add(statement); +// } +// return insertTabletStatementList; +// } +// +// @Override +// public InsertBaseStatement removeLogicalView() { +// if (!isNeedSplit()) { +// return this; +// } +// List insertTabletStatementList = this.getSplitList(); +// if (insertTabletStatementList.size() == 1) { +// return insertTabletStatementList.get(0); +// } +// InsertMultiTabletsStatement insertMultiTabletsStatement = new InsertMultiTabletsStatement(); +// insertMultiTabletsStatement.setInsertTabletStatementList(insertTabletStatementList); +// return insertMultiTabletsStatement; +// } +// @Override public long getMinTime() { return times[0]; @@ -429,7 +429,7 @@ public CompressionType getCompressionType(int index) { @Override public void validateDeviceSchema(boolean isAligned) { - this.isAligned = isAligned; +// this.isAligned = isAligned; } @Override @@ -440,17 +440,17 @@ public void validateMeasurementSchema(int index, IMeasurementSchemaInfo measurem if (measurementSchemaInfo == null) { measurementSchemas[index] = null; } else { - if (measurementSchemaInfo.isLogicalView()) { - if (logicalViewSchemaList == null || indexOfSourcePathsOfLogicalViews == null) { - logicalViewSchemaList = new ArrayList<>(); - indexOfSourcePathsOfLogicalViews = new ArrayList<>(); - } - logicalViewSchemaList.add(measurementSchemaInfo.getSchemaAsLogicalViewSchema()); - indexOfSourcePathsOfLogicalViews.add(index); - return; - } else { - measurementSchemas[index] = measurementSchemaInfo.getSchemaAsMeasurementSchema(); - } +// if (measurementSchemaInfo.isLogicalView()) { +// if (logicalViewSchemaList == null || indexOfSourcePathsOfLogicalViews == null) { +// logicalViewSchemaList = new ArrayList<>(); +// indexOfSourcePathsOfLogicalViews = new ArrayList<>(); +// } +// logicalViewSchemaList.add(measurementSchemaInfo.getSchemaAsLogicalViewSchema()); +// indexOfSourcePathsOfLogicalViews.add(index); +// return; +// } else { +// measurementSchemas[index] = measurementSchemaInfo.getSchemaAsMeasurementSchema(); +// } } try { @@ -459,49 +459,49 @@ public void validateMeasurementSchema(int index, IMeasurementSchemaInfo measurem throw new SemanticException(e); } } - - @Override - public void validateMeasurementSchema( - int index, IMeasurementSchemaInfo measurementSchemaInfo, boolean isAligned) { - this.validateMeasurementSchema(index, measurementSchemaInfo); - if (this.measurementIsAligned == null) { - this.measurementIsAligned = new boolean[this.measurements.length]; - Arrays.fill(this.measurementIsAligned, this.isAligned); - } - this.measurementIsAligned[index] = isAligned; - } - - @Override - public boolean hasLogicalViewNeedProcess() { - if (this.indexOfSourcePathsOfLogicalViews == null) { - return false; - } - return !this.indexOfSourcePathsOfLogicalViews.isEmpty(); - } - - @Override - public List getLogicalViewSchemaList() { - return this.logicalViewSchemaList; - } - - @Override - public List getIndexListOfLogicalViewPaths() { - return this.indexOfSourcePathsOfLogicalViews; - } - - @Override - public void recordRangeOfLogicalViewSchemaListNow() { - if (this.logicalViewSchemaList != null) { - this.recordedBeginOfLogicalViewSchemaList = this.recordedEndOfLogicalViewSchemaList; - this.recordedEndOfLogicalViewSchemaList = this.logicalViewSchemaList.size(); - } - } - - @Override - public Pair getRangeOfLogicalViewSchemaListRecorded() { - return new Pair<>( - this.recordedBeginOfLogicalViewSchemaList, this.recordedEndOfLogicalViewSchemaList); - } +// +// @Override +// public void validateMeasurementSchema( +// int index, IMeasurementSchemaInfo measurementSchemaInfo, boolean isAligned) { +// this.validateMeasurementSchema(index, measurementSchemaInfo); +// if (this.measurementIsAligned == null) { +// this.measurementIsAligned = new boolean[this.measurements.length]; +// Arrays.fill(this.measurementIsAligned, this.isAligned); +// } +// this.measurementIsAligned[index] = isAligned; +// } +// +// @Override +// public boolean hasLogicalViewNeedProcess() { +// if (this.indexOfSourcePathsOfLogicalViews == null) { +// return false; +// } +// return !this.indexOfSourcePathsOfLogicalViews.isEmpty(); +// } +// +// @Override +// public List getLogicalViewSchemaList() { +// return this.logicalViewSchemaList; +// } +// +// @Override +// public List getIndexListOfLogicalViewPaths() { +// return this.indexOfSourcePathsOfLogicalViews; +// } +// +// @Override +// public void recordRangeOfLogicalViewSchemaListNow() { +// if (this.logicalViewSchemaList != null) { +// this.recordedBeginOfLogicalViewSchemaList = this.recordedEndOfLogicalViewSchemaList; +// this.recordedEndOfLogicalViewSchemaList = this.logicalViewSchemaList.size(); +// } +// } +// +// @Override +// public Pair getRangeOfLogicalViewSchemaListRecorded() { +// return new Pair<>( +// this.recordedBeginOfLogicalViewSchemaList, this.recordedEndOfLogicalViewSchemaList); +// } @Override public Statement toRelationalStatement(MPPQueryContext context) { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/metadata/view/CreateLogicalViewStatement.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/metadata/view/CreateLogicalViewStatement.java index e1a122b081620..6bb976a6634d0 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/metadata/view/CreateLogicalViewStatement.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/metadata/view/CreateLogicalViewStatement.java @@ -1,27 +1,31 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// package org.apache.iotdb.db.queryengine.plan.statement.metadata.view; - -import org.apache.iotdb.commons.path.PartialPath; +// +import org.apache.iotdb.common.rpc.thrift.TSStatus; +import org.apache.iotdb.commons.auth.entity.PrivilegeType; +import org.apache.iotdb.commons.conf.IoTDBConstant; +// import org.apache.iotdb.commons.path.PartialPath; import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; -import org.apache.iotdb.db.exception.metadata.view.UnsupportedViewException; +import org.apache.iotdb.db.auth.AuthorityChecker; +// import org.apache.iotdb.db.exception.metadata.view.UnsupportedViewException; import org.apache.iotdb.db.exception.sql.SemanticException; import org.apache.iotdb.db.queryengine.plan.analyze.SelectIntoUtils; import org.apache.iotdb.db.queryengine.plan.expression.Expression; @@ -36,41 +40,80 @@ import org.apache.iotdb.db.schemaengine.schemaregion.view.ViewPaths; import org.apache.tsfile.utils.Pair; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -/** CREATE LOGICAL VIEW statement. */ -public class CreateLogicalViewStatement extends Statement { - - // the paths of this view +// +// import java.util.ArrayList; +// import java.util.Collections; +// import java.util.List; +import java.util.Objects; +// +// /** CREATE LOGICAL VIEW statement. */ +// public class CreateLogicalViewStatement extends Statement { +// +// // the paths of this view private ViewPaths targetPaths; - private IntoItem batchGenerationItem; - - // the paths of sources +// private IntoItem batchGenerationItem; +// +// // the paths of sources private ViewPaths sourcePaths; - private QueryStatement queryStatement; - +// private QueryStatement queryStatement; +// // if not null, all related check and generation will be skipped private List viewExpressions; private boolean canSeeAuditDB; - public CreateLogicalViewStatement() { - super(); - this.statementType = StatementType.CREATE_LOGICAL_VIEW; +// public CreateLogicalViewStatement() { +// super(); +// this.statementType = StatementType.CREATE_LOGICAL_VIEW; this.sourcePaths = new ViewPaths(); this.targetPaths = new ViewPaths(); - } - - // region Interfaces about setting and getting - - // get paths - @Override - public List getPaths() { - return this.getTargetPathList(); - } - +// } +// +// // region Interfaces about setting and getting +// +// // get paths +// @Override +// public List getPaths() { +// return this.getTargetPathList(); +// } +// + public TSStatus checkPermissionBeforeProcess(String userName) { + if (AuthorityChecker.SUPER_USER.equals(userName)) { + return new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode()); + } + TSStatus status = new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode()); + List sourcePathList = sourcePaths.fullPathList; + if (sourcePathList != null) { + status = + AuthorityChecker.getTSStatus( + AuthorityChecker.checkFullPathOrPatternListPermission( + userName, sourcePathList, PrivilegeType.READ_SCHEMA), + sourcePathList, + PrivilegeType.READ_SCHEMA); + } + if (queryStatement != null && status.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()) { + sourcePathList = queryStatement.getPaths(); + status = + AuthorityChecker.getTSStatus( + AuthorityChecker.checkFullPathOrPatternListPermission( + userName, sourcePathList, PrivilegeType.READ_SCHEMA), + sourcePathList, + PrivilegeType.READ_SCHEMA); + } + final List paths = + Objects.nonNull(getTargetPathList()) + ? getTargetPathList() + : Collections.singletonList( + batchGenerationItem + .getIntoDevice() + .concatNode(IoTDBConstant.ONE_LEVEL_PATH_WILDCARD)); + if (status.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()) { + return AuthorityChecker.getTSStatus( + AuthorityChecker.checkFullPathOrPatternListPermission( + userName, paths, PrivilegeType.WRITE_SCHEMA), + paths, + PrivilegeType.WRITE_SCHEMA); + } + return status; public ViewPaths getTargetPaths() { return targetPaths; } @@ -79,182 +122,172 @@ public ViewPaths getSourcePaths() { return sourcePaths; } - public List getTargetPathList() { - return this.targetPaths.fullPathList; - } - - public List getSourceExpressionList() { - this.sourcePaths.generateExpressionsIfNecessary(); - return this.sourcePaths.expressionsList; - } - - public QueryStatement getQueryStatement() { - return this.queryStatement; - } - +// public List getTargetPathList() { +// return this.targetPaths.fullPathList; +// } +// +// public List getSourceExpressionList() { +// this.sourcePaths.generateExpressionsIfNecessary(); +// return this.sourcePaths.expressionsList; +// } +// +// public QueryStatement getQueryStatement() { +// return this.queryStatement; +// } +// public List getViewExpressions() { return viewExpressions; } - // set source paths +// // set source paths public void setSourcePaths(ViewPaths sourcePaths) { this.sourcePaths = sourcePaths; } - public void setSourceFullPaths(List paths) { - this.sourcePaths.setViewPathType(ViewPathType.FULL_PATH_LIST); - this.sourcePaths.setFullPathList(paths); - } - - public void setSourcePathsGroup(PartialPath prefixPath, List suffixPaths) { - this.sourcePaths.setViewPathType(ViewPathType.PATHS_GROUP); - this.sourcePaths.setPrefixOfPathsGroup(prefixPath); - this.sourcePaths.setSuffixOfPathsGroup(suffixPaths); - this.sourcePaths.generateFullPathsFromPathsGroup(); - } - - public void setSourceQueryStatement(QueryStatement queryStatement) { - this.sourcePaths.setViewPathType(ViewPathType.QUERY_STATEMENT); - this.queryStatement = queryStatement; - } - +// public void setSourceFullPaths(List paths) { +// this.sourcePaths.setViewPathType(ViewPathType.FULL_PATH_LIST); +// this.sourcePaths.setFullPathList(paths); +// } +// +// public void setSourcePathsGroup(PartialPath prefixPath, List suffixPaths) { +// this.sourcePaths.setViewPathType(ViewPathType.PATHS_GROUP); +// this.sourcePaths.setPrefixOfPathsGroup(prefixPath); +// this.sourcePaths.setSuffixOfPathsGroup(suffixPaths); +// this.sourcePaths.generateFullPathsFromPathsGroup(); +// } +// +// public void setSourceQueryStatement(QueryStatement queryStatement) { +// this.sourcePaths.setViewPathType(ViewPathType.QUERY_STATEMENT); +// this.queryStatement = queryStatement; +// } +// public void setQueryStatement(QueryStatement queryStatement) { this.queryStatement = queryStatement; } - /** +// /** * This function must be called after analyzing read statement. Expressions that analyzed should - * be set through here. - * - * @param expressionList - */ - public void setSourceExpressions(List expressionList) - throws UnsupportedViewException { - // check expressions, make sure no aggregation function expression - Pair checkResult = - ViewPaths.checkExpressionList(expressionList); +// * be set through here. +// * +// * @param expressionList +// */ +// public void setSourceExpressions(List expressionList) +// throws UnsupportedViewException { +// // check expressions, make sure no aggregation function expression +// Pair checkResult = +// ViewPaths.checkExpressionList(expressionList); if (Boolean.TRUE.equals(checkResult.left)) { - this.sourcePaths.setExpressionsList(expressionList); - } else { - throw checkResult.right; - } - } - - // set target paths +// this.sourcePaths.setExpressionsList(expressionList); +// } else { +// throw checkResult.right; +// } +// } +// +// // set target paths public void setTargetPaths(ViewPaths targetPaths) { this.targetPaths = targetPaths; } - public void setTargetFullPaths(List paths) { - this.targetPaths.setViewPathType(ViewPathType.FULL_PATH_LIST); - this.targetPaths.setFullPathList(paths); - } - - public void setTargetPathsGroup(PartialPath prefixPath, List suffixPaths) { - this.targetPaths.setViewPathType(ViewPathType.PATHS_GROUP); - this.targetPaths.setPrefixOfPathsGroup(prefixPath); - this.targetPaths.setSuffixOfPathsGroup(suffixPaths); - this.targetPaths.generateFullPathsFromPathsGroup(); - } - +// public void setTargetFullPaths(List paths) { +// this.targetPaths.setViewPathType(ViewPathType.FULL_PATH_LIST); +// this.targetPaths.setFullPathList(paths); +// } +// +// public void setTargetPathsGroup(PartialPath prefixPath, List suffixPaths) { +// this.targetPaths.setViewPathType(ViewPathType.PATHS_GROUP); +// this.targetPaths.setPrefixOfPathsGroup(prefixPath); +// this.targetPaths.setSuffixOfPathsGroup(suffixPaths); +// this.targetPaths.generateFullPathsFromPathsGroup(); +// } +// public void setViewExpressions(List viewExpressions) { this.viewExpressions = viewExpressions; } - public void setTargetIntoItem(IntoItem intoItem) { - this.targetPaths.setViewPathType(ViewPathType.BATCH_GENERATION); - this.batchGenerationItem = intoItem; - } - - public void parseIntoItemIfNecessary() { - if (this.batchGenerationItem != null) { - List sourceExpressionList = this.getSourceExpressionList(); - IntoComponent intoComponent = - new IntoComponent(Collections.singletonList(this.batchGenerationItem)); - intoComponent.validate(sourceExpressionList); - IntoComponent.IntoPathIterator intoPathIterator = intoComponent.getIntoPathIterator(); - List targetPathsList = new ArrayList<>(); - for (Expression sourceColumn : sourceExpressionList) { - PartialPath deviceTemplate = intoPathIterator.getDeviceTemplate(); - String measurementTemplate = intoPathIterator.getMeasurementTemplate(); - - if (sourceColumn instanceof TimeSeriesOperand) { - PartialPath sourcePath = ((TimeSeriesOperand) sourceColumn).getPath(); - targetPathsList.add( - SelectIntoUtils.constructTargetPath(sourcePath, deviceTemplate, measurementTemplate)); - } else { +// public void setTargetIntoItem(IntoItem intoItem) { +// this.targetPaths.setViewPathType(ViewPathType.BATCH_GENERATION); +// this.batchGenerationItem = intoItem; +// } +// +// public void parseIntoItemIfNecessary() { +// if (this.batchGenerationItem != null) { +// List sourceExpressionList = this.getSourceExpressionList(); +// IntoComponent intoComponent = +// new IntoComponent(Collections.singletonList(this.batchGenerationItem)); +// intoComponent.validate(sourceExpressionList); +// IntoComponent.IntoPathIterator intoPathIterator = intoComponent.getIntoPathIterator(); +// List targetPathsList = new ArrayList<>(); +// for (Expression sourceColumn : sourceExpressionList) { +// PartialPath deviceTemplate = intoPathIterator.getDeviceTemplate(); +// String measurementTemplate = intoPathIterator.getMeasurementTemplate(); +// +// if (sourceColumn instanceof TimeSeriesOperand) { +// PartialPath sourcePath = ((TimeSeriesOperand) sourceColumn).getPath(); +// targetPathsList.add( +// SelectIntoUtils.constructTargetPath(sourcePath, deviceTemplate, measurementTemplate)); +// } else { throw new SemanticException( - new UnsupportedViewException( - "Cannot create views using data sources with calculated expressions while using into item.")); - } - } - this.targetPaths.setFullPathList(targetPathsList); - } - } - public IntoItem getBatchGenerationItem() { return batchGenerationItem; } - - // endregion - - // region Interfaces for checking - /** - * Check errors in targetPaths. - * +// new UnsupportedViewException( +// "Cannot create views using data sources with calculated expressions while using into item.")); +// } +// } +// this.targetPaths.setFullPathList(targetPathsList); +// } +// } +// +// // endregion +// +// // region Interfaces for checking +// /** +// * Check errors in targetPaths. +// * * @return Pair {@literal <}Boolean, String{@literal >}. True: checks passed; False: checks * failed. If check failed, return the string of illegal path. - */ - public Pair checkTargetPaths() { - for (PartialPath thisPath : this.getTargetPathList()) { - if (thisPath.getNodeLength() < 3) { - return new Pair<>(false, thisPath.getFullPath()); - } - } - return new Pair<>(true, null); - } - - /** +// */ +// public Pair checkTargetPaths() { +// for (PartialPath thisPath : this.getTargetPathList()) { +// if (thisPath.getNodeLength() < 3) { +// return new Pair<>(false, thisPath.getFullPath()); +// } +// } +// return new Pair<>(true, null); +// } +// +// /** * Check errors in sourcePaths. Only usable when not using read statement. If this statement is * generated with a read statement, check always pass; if not, check each full paths. - * +// * * @return Pair {@literal <}Boolean, String{@literal >}. True: checks passed; False: checks * failed. If check failed, return the string of illegal path. - */ - public Pair checkSourcePathsIfNotUsingQueryStatement() { - if (this.sourcePaths.viewPathType == ViewPathType.PATHS_GROUP - || this.sourcePaths.viewPathType == ViewPathType.FULL_PATH_LIST) { - for (PartialPath thisPath : this.sourcePaths.fullPathList) { - if (thisPath.getNodeLength() < 3) { - return new Pair<>(false, thisPath.getFullPath()); - } - } - } - return new Pair<>(true, null); - } - - /** +// */ +// public Pair checkSourcePathsIfNotUsingQueryStatement() { +// if (this.sourcePaths.viewPathType == ViewPathType.PATHS_GROUP +// || this.sourcePaths.viewPathType == ViewPathType.FULL_PATH_LIST) { +// for (PartialPath thisPath : this.sourcePaths.fullPathList) { +// if (thisPath.getNodeLength() < 3) { +// return new Pair<>(false, thisPath.getFullPath()); +// } +// } +// } +// return new Pair<>(true, null); +// } +// +// /** * @return return {@link true} if checks passed; else return {@link false}. If check failed, * return the string of illegal path. - */ - public Pair checkAllPaths() { - Pair result = this.checkTargetPaths(); +// */ +// public Pair checkAllPaths() { +// Pair result = this.checkTargetPaths(); if (Boolean.FALSE.equals(result.left)) { return result; } - result = this.checkSourcePathsIfNotUsingQueryStatement(); +// result = this.checkSourcePathsIfNotUsingQueryStatement(); if (Boolean.FALSE.equals(result.left)) { return result; } - return new Pair<>(true, null); - } - - // endregion - - @Override - public R accept(StatementVisitor visitor, C context) { - return visitor.visitCreateLogicalView(this, context); - } public boolean isCanSeeAuditDB() { return canSeeAuditDB; @@ -263,4 +296,13 @@ public boolean isCanSeeAuditDB() { public void setCanSeeAuditDB(boolean canSeeAuditDB) { this.canSeeAuditDB = canSeeAuditDB; } -} +// return new Pair<>(true, null); +// } +// +// // endregion +// +// @Override +// public R accept(StatementVisitor visitor, C context) { +// return visitor.visitCreateLogicalView(this, context); +// } +// } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/ISchemaRegion.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/ISchemaRegion.java index a9b002bbd6d15..eebad32f354cb 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/ISchemaRegion.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/ISchemaRegion.java @@ -119,34 +119,34 @@ public interface ISchemaRegion { // endregion // region Interfaces for Timeseries operation - /** - * Create timeseries. - * - * @param plan a plan describes how to create the timeseries. - * @param offset - * @throws MetadataException - */ +// /** +// * Create timeseries. +// * +// * @param plan a plan describes how to create the timeseries. +// * @param offset +// * @throws MetadataException +// */ void createTimeSeries(final ICreateTimeSeriesPlan plan, final long offset) throws MetadataException; - /** - * Create aligned timeseries. - * - * @param plan a plan describes how to create the timeseries. - * @throws MetadataException - */ +// /** +// * Create aligned timeseries. +// * +// * @param plan a plan describes how to create the timeseries. +// * @throws MetadataException +// */ void createAlignedTimeSeries(final ICreateAlignedTimeSeriesPlan plan) throws MetadataException; - /** - * Check whether measurement exists. - * - * @param devicePath the path of device that you want to check - * @param measurementList a list of measurements that you want to check - * @param aliasList a list of alias that you want to check - * @return returns a map contains index of the measurements or alias that threw the exception, and - * exception details. The exceptions describe whether the measurement or alias exists. For - * example, a MeasurementAlreadyExistException means this measurement exists. - */ +// /** +// * Check whether measurement exists. +// * +// * @param devicePath the path of device that you want to check +// * @param measurementList a list of measurements that you want to check +// * @param aliasList a list of alias that you want to check +// * @return returns a map contains index of the measurements or alias that threw the exception, and +// * exception details. The exceptions describe whether the measurement or alias exists. For +// * example, a MeasurementAlreadyExistException means this measurement exists. +// */ Map checkMeasurementExistence( final PartialPath devicePath, final List measurementList, @@ -210,7 +210,7 @@ Pair constructSchemaBlackList(final PathPatternTree patternTree) // endregion - // region Interfaces for Logical View +// // region Interfaces for Logical View void createLogicalView(final ICreateLogicalViewPlan createLogicalViewPlan) throws MetadataException; @@ -222,8 +222,8 @@ void createLogicalView(final ICreateLogicalViewPlan createLogicalViewPlan) void alterLogicalView(final IAlterLogicalViewPlan alterLogicalViewPlan) throws MetadataException; - // endregion - +// // endregion +// // region Interfaces for metadata info Query // region Interfaces for timeSeries, measurement and schema info Query diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/SchemaRegionPlanType.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/SchemaRegionPlanType.java index 9808a19143b5c..bec218e6f18c2 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/SchemaRegionPlanType.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/SchemaRegionPlanType.java @@ -44,8 +44,8 @@ public enum SchemaRegionPlanType { PRE_DEACTIVATE_TEMPLATE((byte) 0), ROLLBACK_PRE_DEACTIVATE_TEMPLATE((byte) 1), DEACTIVATE_TEMPLATE((byte) 2), - // logical view - CREATE_LOGICAL_VIEW((byte) 66), +// // logical view +// CREATE_LOGICAL_VIEW((byte) 66), PRE_DELETE_LOGICAL_VIEW((byte) 67), ROLLBACK_PRE_DELETE_LOGICAL_VIEW((byte) 68), DELETE_LOGICAL_VIEW((byte) 69), diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/SchemaRegionPlanVisitor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/SchemaRegionPlanVisitor.java index b0514d7d5428e..9002982f501a9 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/SchemaRegionPlanVisitor.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/SchemaRegionPlanVisitor.java @@ -107,11 +107,11 @@ public R visitDeactivateTemplate( final IDeactivateTemplatePlan deactivateTemplatePlan, final C context) { return visitSchemaRegionPlan(deactivateTemplatePlan, context); } - +// public R visitCreateLogicalView( final ICreateLogicalViewPlan createLogicalViewPlan, final C context) { - return visitSchemaRegionPlan(createLogicalViewPlan, context); - } +// return visitSchemaRegionPlan(createLogicalViewPlan, context); +// } public R visitAlterLogicalView( final IAlterLogicalViewPlan alterLogicalViewPlan, final C context) { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionMemoryImpl.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionMemoryImpl.java index fbb407d333880..08a2d62ed3ad7 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionMemoryImpl.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionMemoryImpl.java @@ -32,7 +32,7 @@ import org.apache.iotdb.commons.schema.table.TsTable; import org.apache.iotdb.commons.schema.table.column.TsTableColumnSchema; import org.apache.iotdb.commons.schema.view.LogicalViewSchema; -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; import org.apache.iotdb.commons.utils.FileUtils; import org.apache.iotdb.commons.utils.PathUtils; import org.apache.iotdb.consensus.ConsensusFactory; @@ -956,13 +956,13 @@ public void deleteTimeseriesInBlackList(PathPatternTree patternTree) throws Meta } } - @Override +// @Override public void createLogicalView(final ICreateLogicalViewPlan plan) throws MetadataException { - if (!regionStatistics.isAllowToCreateNewSeries()) { +// if (!regionStatistics.isAllowToCreateNewSeries()) { throw new SeriesOverflowException( regionStatistics.getGlobalMemoryUsage(), regionStatistics.getGlobalSeriesNumber()); - } - +// } +// final List pathList = plan.getViewPathList(); final Map viewPathToSourceMap = plan.getViewPathToSourceExpressionMap(); @@ -973,11 +973,11 @@ public void createLogicalView(final ICreateLogicalViewPlan plan) throws Metadata // write log if (!isRecovering) { writeToMLog(plan); - } - // update statistics +// } +// // update statistics regionStatistics.addView(1L); - } - +// } +// @Override public long constructLogicalViewBlackList(PathPatternTree patternTree) throws MetadataException { long preDeletedNum = 0; @@ -1906,17 +1906,17 @@ public RecoverOperationResult visitDeactivateTemplate( return new RecoverOperationResult(e); } } - +// @Override - public RecoverOperationResult visitCreateLogicalView( +// public RecoverOperationResult visitCreateLogicalView( final ICreateLogicalViewPlan createLogicalViewPlan, final SchemaRegionMemoryImpl context) { - try { - createLogicalView(createLogicalViewPlan); - return RecoverOperationResult.SUCCESS; +// try { +// createLogicalView(createLogicalViewPlan); +// return RecoverOperationResult.SUCCESS; } catch (final MetadataException e) { - return new RecoverOperationResult(e); - } - } +// return new RecoverOperationResult(e); +// } +// } @Override public RecoverOperationResult visitPreDeleteLogicalView( diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionPBTreeImpl.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionPBTreeImpl.java index 0e180b2029b28..7f52fcad2c58c 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionPBTreeImpl.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionPBTreeImpl.java @@ -940,7 +940,7 @@ public void deleteTimeseriesInBlackList(PathPatternTree patternTree) throws Meta } } - @Override +// @Override public void createLogicalView(ICreateLogicalViewPlan plan) throws MetadataException { while (!regionStatistics.isAllowToCreateNewSeries()) { ReleaseFlushMonitor.getInstance().waitIfReleasing(); @@ -961,8 +961,8 @@ public void createLogicalView(ICreateLogicalViewPlan plan) throws MetadataExcept } catch (IOException e) { throw new MetadataException(e); } - } - +// } +// @Override public long constructLogicalViewBlackList(PathPatternTree patternTree) throws MetadataException { long preDeletedNum = 0; diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/logfile/visitor/SchemaRegionPlanDeserializer.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/logfile/visitor/SchemaRegionPlanDeserializer.java index 258f271cc9d7c..9a48b9e15fb46 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/logfile/visitor/SchemaRegionPlanDeserializer.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/logfile/visitor/SchemaRegionPlanDeserializer.java @@ -23,7 +23,7 @@ import org.apache.iotdb.commons.path.MeasurementPath; import org.apache.iotdb.commons.path.PartialPath; import org.apache.iotdb.commons.path.PathDeserializeUtil; -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanNodeType; import org.apache.iotdb.db.queryengine.plan.relational.planner.node.schema.ConstructTableDevicesBlackListNode; import org.apache.iotdb.db.queryengine.plan.relational.planner.node.schema.CreateOrUpdateTableDeviceNode; @@ -362,28 +362,28 @@ private Map> deserializeTemplateSetInfo(final ByteBuf } return result; } - - @Override - public ISchemaRegionPlan visitCreateLogicalView( +// +// @Override +// public ISchemaRegionPlan visitCreateLogicalView( final ICreateLogicalViewPlan createLogicalViewPlan, final ByteBuffer buffer) { - +// final int viewSize = buffer.getInt(); final Map viewPathToSourceMap = new HashMap<>(); - for (int i = 0; i < viewSize; i++) { +// for (int i = 0; i < viewSize; i++) { final int byteSizeOfPath = buffer.getInt(); final byte[] bytesOfPath = new byte[byteSizeOfPath]; - buffer.get(bytesOfPath); - try { +// buffer.get(bytesOfPath); +// try { final PartialPath thisPath = new PartialPath(new String(bytesOfPath)); - ViewExpression thisExp = ViewExpression.deserialize(buffer); - viewPathToSourceMap.put(thisPath, thisExp); +// ViewExpression thisExp = ViewExpression.deserialize(buffer); +// viewPathToSourceMap.put(thisPath, thisExp); } catch (final IllegalPathException e) { - LOGGER.error("Cannot deserialize SchemaRegionPlan from buffer", e); - } - } - createLogicalViewPlan.setViewPathToSourceExpressionMap(viewPathToSourceMap); - return createLogicalViewPlan; - } +// LOGGER.error("Cannot deserialize SchemaRegionPlan from buffer", e); +// } +// } +// createLogicalViewPlan.setViewPathToSourceExpressionMap(viewPathToSourceMap); +// return createLogicalViewPlan; +// } @Override public ISchemaRegionPlan visitPreDeleteLogicalView( diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/logfile/visitor/SchemaRegionPlanSerializer.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/logfile/visitor/SchemaRegionPlanSerializer.java index 63854468b347d..be8147589ef62 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/logfile/visitor/SchemaRegionPlanSerializer.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/logfile/visitor/SchemaRegionPlanSerializer.java @@ -20,7 +20,7 @@ package org.apache.iotdb.db.schemaengine.schemaregion.logfile.visitor; import org.apache.iotdb.commons.path.PartialPath; -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanNode; import org.apache.iotdb.db.queryengine.plan.relational.planner.node.schema.ConstructTableDevicesBlackListNode; import org.apache.iotdb.db.queryengine.plan.relational.planner.node.schema.CreateOrUpdateTableDeviceNode; @@ -421,32 +421,32 @@ private void serializeTemplateSetInfo( } } } - - @Override - public SchemaRegionPlanSerializationResult visitCreateLogicalView( +// +// @Override +// public SchemaRegionPlanSerializationResult visitCreateLogicalView( final ICreateLogicalViewPlan createLogicalViewPlan, final DataOutputStream dataOutputStream) { - try { +// try { final int viewSize = createLogicalViewPlan.getViewSize(); - // serialize size of views - dataOutputStream.writeInt(viewSize); +// // serialize size of views +// dataOutputStream.writeInt(viewSize); final List viewPAthList = createLogicalViewPlan.getViewPathList(); final Map viewPathToSourceMap = - createLogicalViewPlan.getViewPathToSourceExpressionMap(); - for (int i = 0; i < viewSize; i++) { +// createLogicalViewPlan.getViewPathToSourceExpressionMap(); +// for (int i = 0; i < viewSize; i++) { final PartialPath thisPath = viewPAthList.get(i); final ViewExpression thisExp = viewPathToSourceMap.get(thisPath); - // for each view, serialize info of it +// // for each view, serialize info of it final byte[] bytes = thisPath.getFullPath().getBytes(); - dataOutputStream.writeInt(bytes.length); - dataOutputStream.write(bytes); - ViewExpression.serialize(thisExp, dataOutputStream); - } - return SchemaRegionPlanSerializationResult.SUCCESS; +// dataOutputStream.writeInt(bytes.length); +// dataOutputStream.write(bytes); +// ViewExpression.serialize(thisExp, dataOutputStream); +// } +// return SchemaRegionPlanSerializationResult.SUCCESS; } catch (final IOException e) { - return new SchemaRegionPlanSerializationResult(e); - } - } +// return new SchemaRegionPlanSerializationResult(e); +// } +// } @Override public SchemaRegionPlanSerializationResult visitPreDeleteLogicalView( diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/logfile/visitor/SchemaRegionPlanTxtSerializer.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/logfile/visitor/SchemaRegionPlanTxtSerializer.java index 1dfb74b0b7553..379a27c260e24 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/logfile/visitor/SchemaRegionPlanTxtSerializer.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/logfile/visitor/SchemaRegionPlanTxtSerializer.java @@ -20,7 +20,7 @@ package org.apache.iotdb.db.schemaengine.schemaregion.logfile.visitor; import org.apache.iotdb.commons.path.PartialPath; -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; import org.apache.iotdb.db.schemaengine.schemaregion.ISchemaRegionPlan; import org.apache.iotdb.db.schemaengine.schemaregion.SchemaRegionPlanVisitor; import org.apache.iotdb.db.schemaengine.schemaregion.logfile.ISerializer; @@ -247,25 +247,25 @@ private void parseTemplateSetInfo( templateSetInfo.forEach((k, v) -> stringBuilder.append(k).append(": ").append(v).append(";")); stringBuilder.append("}"); } - - @Override - public Void visitCreateLogicalView( - ICreateLogicalViewPlan createLogicalViewPlan, StringBuilder stringBuilder) { - int viewSize = createLogicalViewPlan.getViewSize(); - List viewPathList = createLogicalViewPlan.getViewPathList(); - Map viewPathToSourceMap = - createLogicalViewPlan.getViewPathToSourceExpressionMap(); - for (int i = 0; i < viewSize; i++) { - PartialPath thisPath = viewPathList.get(i); - ViewExpression thisExp = viewPathToSourceMap.get(thisPath); - stringBuilder.append(thisPath).append(FIELD_SEPARATOR).append(thisExp.toString()); - if (i + 1 >= viewSize) { - break; - } - stringBuilder.append(FIELD_SEPARATOR); - } - return null; - } +// +// @Override +// public Void visitCreateLogicalView( +// ICreateLogicalViewPlan createLogicalViewPlan, StringBuilder stringBuilder) { +// int viewSize = createLogicalViewPlan.getViewSize(); +// List viewPathList = createLogicalViewPlan.getViewPathList(); +// Map viewPathToSourceMap = +// createLogicalViewPlan.getViewPathToSourceExpressionMap(); +// for (int i = 0; i < viewSize; i++) { +// PartialPath thisPath = viewPathList.get(i); +// ViewExpression thisExp = viewPathToSourceMap.get(thisPath); +// stringBuilder.append(thisPath).append(FIELD_SEPARATOR).append(thisExp.toString()); +// if (i + 1 >= viewSize) { +// break; +// } +// stringBuilder.append(FIELD_SEPARATOR); +// } +// return null; +// } @Override public Void visitPreDeleteLogicalView( diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/MTreeBelowSGMemoryImpl.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/MTreeBelowSGMemoryImpl.java index 387d8c6643177..72e9514f49447 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/MTreeBelowSGMemoryImpl.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/MTreeBelowSGMemoryImpl.java @@ -30,8 +30,8 @@ import org.apache.iotdb.commons.schema.node.role.IMeasurementMNode; import org.apache.iotdb.commons.schema.node.utils.IMNodeFactory; import org.apache.iotdb.commons.schema.node.utils.IMNodeIterator; -import org.apache.iotdb.commons.schema.view.LogicalViewSchema; -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.LogicalViewSchema; +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; import org.apache.iotdb.db.conf.IoTDBDescriptor; import org.apache.iotdb.db.exception.metadata.AliasAlreadyExistException; import org.apache.iotdb.db.exception.metadata.MNodeTypeMismatchException; @@ -279,6 +279,13 @@ public IMeasurementMNode createTimeSeries( } } +// if (device.isDevice() +// && device.getAsDeviceMNode().isAlignedNullable() != null +// && device.getAsDeviceMNode().isAligned()) { + throw new AlignedTimeseriesException( + "time series under this device is aligned, please use createAlignedTimeseries or change device.", + device.getFullPath()); + } final IDeviceMNode entityMNode; if (device.isDevice()) { entityMNode = device.getAsDeviceMNode(); @@ -286,11 +293,10 @@ public IMeasurementMNode createTimeSeries( entityMNode = store.setToEntity(device); } - // create a non-aligned time series - if (entityMNode.isAlignedNullable() == null) { - entityMNode.setAligned(false); - } - +// if (entityMNode.isAlignedNullable() == null) { +// entityMNode.setAligned(false); +// } +// final IMeasurementMNode measurementMNode = nodeFactory.createMeasurementMNode( entityMNode, @@ -365,6 +371,14 @@ public List> createAlignedTimeSeries( } } +// if (device.isDevice() +// && device.getAsDeviceMNode().isAlignedNullable() != null +// && !device.getAsDeviceMNode().isAligned()) { + throw new AlignedTimeseriesException( + "Time series under this device is not aligned, please use createTimeSeries or change device.", + devicePath.getFullPath()); + } + final IDeviceMNode entityMNode; if (device.isDevice()) { entityMNode = device.getAsDeviceMNode(); @@ -374,10 +388,10 @@ public List> createAlignedTimeSeries( } // create an aligned time series - if (entityMNode.isAlignedNullable() == null) { - entityMNode.setAligned(true); - } - +// if (entityMNode.isAlignedNullable() == null) { +// entityMNode.setAligned(true); +// } +// for (int i = 0; i < measurements.size(); i++) { if (existingMeasurementIndexes.contains(i)) { continue; @@ -571,17 +585,17 @@ public void deleteEmptyInternalMNode(final IDeviceMNode entityMNode) IMemMNode curNode = entityMNode.getAsMNode(); if (!entityMNode.isUseTemplate()) { boolean hasMeasurement = false; - boolean hasNonViewMeasurement = false; +// boolean hasNonViewMeasurement = false; IMemMNode child; IMNodeIterator iterator = store.getChildrenIterator(curNode); while (iterator.hasNext()) { child = iterator.next(); if (child.isMeasurement()) { hasMeasurement = true; - if (!child.getAsMeasurementMNode().isLogicalView()) { - hasNonViewMeasurement = true; - break; - } +// if (!child.getAsMeasurementMNode().isLogicalView()) { +// hasNonViewMeasurement = true; +// break; +// } } } @@ -589,9 +603,9 @@ public void deleteEmptyInternalMNode(final IDeviceMNode entityMNode) synchronized (this) { curNode = store.setToInternal(entityMNode); } - } else if (!hasNonViewMeasurement) { - // has some measurement but they are all logical view - entityMNode.setAligned(null); +// } else if (!hasNonViewMeasurement) { +// // has some measurement but they are all logical view +// entityMNode.setAligned(null); } } @@ -1361,8 +1375,8 @@ public String getAlias() { } @Override - public IMeasurementSchema getSchema() { - return node.getSchema(); +// public IMeasurementSchema getSchema() { +// return node.getSchema(); } @Override @@ -1386,11 +1400,11 @@ public boolean isUnderAlignedDevice() { return getParentOfNextMatchedNode().getAsDeviceMNode().isAligned(); } - @Override - public boolean isLogicalView() { - return node.isLogicalView(); - } - +// @Override +// public boolean isLogicalView() { +// return node.isLogicalView(); +// } +// @Override public String getFullPath() { return getPartialPathFromRootToNode(node.getAsMNode()).getFullPath(); @@ -1479,58 +1493,58 @@ public INodeSchemaInfo next() { } // endregion - - // region interfaces for logical view - public IMeasurementMNode createLogicalView( +// +// // region interfaces for logical view +// public IMeasurementMNode createLogicalView( final PartialPath path, final ViewExpression viewExpression) throws MetadataException { - // check path +// // check path final String[] nodeNames = path.getNodes(); - if (nodeNames.length <= 2) { - throw new IllegalPathException(path.getFullPath()); - } - MetaFormatUtils.checkTimeseries(path); +// if (nodeNames.length <= 2) { +// throw new IllegalPathException(path.getFullPath()); +// } +// MetaFormatUtils.checkTimeseries(path); final PartialPath devicePath = path.getDevicePath(); final IMemMNode deviceParent = checkAndAutoCreateInternalPath(devicePath); - - synchronized (this) { +// +// synchronized (this) { final String leafName = path.getMeasurement(); final IMeasurementMNode measurementMNode = nodeFactory.createLogicalViewMNode( null, leafName, new LogicalViewSchema(leafName, viewExpression)); final IMemMNode device = checkAndAutoCreateDeviceNode(devicePath.getTailNode(), deviceParent); - - // no need to check alias, because logical view has no alias - - if (device.hasChild(leafName)) { +// +// // no need to check alias, because logical view has no alias +// +// if (device.hasChild(leafName)) { final IMemMNode node = device.getChild(leafName); - if (node.isMeasurement()) { - if (node.getAsMeasurementMNode().isPreDeleted()) { - throw new MeasurementInBlackListException(path); - } else { - throw new MeasurementAlreadyExistException( - path.getFullPath(), node.getAsMeasurementMNode().getMeasurementPath()); - } - } else { - throw new PathAlreadyExistException(path.getFullPath()); - } - } - +// if (node.isMeasurement()) { +// if (node.getAsMeasurementMNode().isPreDeleted()) { +// throw new MeasurementInBlackListException(path); +// } else { +// throw new MeasurementAlreadyExistException( +// path.getFullPath(), node.getAsMeasurementMNode().getMeasurementPath()); +// } +// } else { +// throw new PathAlreadyExistException(path.getFullPath()); +// } +// } +// final IDeviceMNode entityMNode; - if (device.isDevice()) { - entityMNode = device.getAsDeviceMNode(); - } else { - entityMNode = store.setToEntity(device); - // this parent has no measurement before. The leafName is his first child who is a logical - // view. - entityMNode.setAligned(null); - } - +// if (device.isDevice()) { +// entityMNode = device.getAsDeviceMNode(); +// } else { +// entityMNode = store.setToEntity(device); +// // this parent has no measurement before. The leafName is his first child who is a logical +// // view. +// entityMNode.setAligned(null); +// } +// measurementMNode.setParent(entityMNode.getAsMNode()); - store.addChild(entityMNode.getAsMNode(), leafName, measurementMNode.getAsMNode()); - - return measurementMNode; - } - } +// store.addChild(entityMNode.getAsMNode(), leafName, measurementMNode.getAsMNode()); +// +// return measurementMNode; +// } +// } public List constructLogicalViewBlackList(final PartialPath pathPattern) throws MetadataException { @@ -1804,5 +1818,5 @@ protected void updateEntity(final IDeviceMNode node) { return true; } - // endregion +// // endregion } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/mnode/factory/MemMNodeFactory.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/mnode/factory/MemMNodeFactory.java index 19e24ed87b986..19416d049f0bf 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/mnode/factory/MemMNodeFactory.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/mnode/factory/MemMNodeFactory.java @@ -69,10 +69,10 @@ public IMemMNode createAboveDatabaseMNode(IMemMNode parent, String name) { public IMemMNode createInternalMNode(IMemMNode parent, String name) { return new BasicInternalMNode(parent, name); } - - @Override - public IMeasurementMNode createLogicalViewMNode( +// +// @Override +// public IMeasurementMNode createLogicalViewMNode( IDeviceMNode parent, String name, IMeasurementSchema measurementSchema) { throw new UnsupportedOperationException("View is not supported."); - } +// } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/mnode/impl/MeasurementMNode.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/mnode/impl/MeasurementMNode.java index a40cbe6bc0fc9..5840350670a7c 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/mnode/impl/MeasurementMNode.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/mnode/impl/MeasurementMNode.java @@ -47,9 +47,9 @@ public IMemMNode getAsMNode() { public IMNodeContainer getChildren() { return MemMNodeContainer.emptyMNodeContainer(); } - - @Override - public final boolean isLogicalView() { - return false; - } +// +// @Override +// public final boolean isLogicalView() { +// return false; +// } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/mnode/info/LogicalViewInfo.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/mnode/info/LogicalViewInfo.java index a5ab55796e439..bd9158ea8daf4 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/mnode/info/LogicalViewInfo.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/mnode/info/LogicalViewInfo.java @@ -1,170 +1,170 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// package org.apache.iotdb.db.schemaengine.schemaregion.mtree.impl.mem.mnode.info; - -import org.apache.iotdb.commons.exception.IllegalPathException; +// +// import org.apache.iotdb.commons.exception.IllegalPathException; import org.apache.iotdb.commons.exception.runtime.SchemaExecutionException; import org.apache.iotdb.commons.path.MeasurementPath; -import org.apache.iotdb.commons.path.PartialPath; -import org.apache.iotdb.commons.schema.node.info.IMeasurementInfo; -import org.apache.iotdb.commons.schema.node.role.IMeasurementMNode; -import org.apache.iotdb.commons.schema.view.LogicalViewSchema; -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; -import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimeSeriesViewOperand; +// import org.apache.iotdb.commons.path.PartialPath; +// import org.apache.iotdb.commons.schema.node.info.IMeasurementInfo; +// import org.apache.iotdb.commons.schema.node.role.IMeasurementMNode; +// import org.apache.iotdb.commons.schema.view.LogicalViewSchema; +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; +// import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimeSeriesViewOperand; import org.apache.tsfile.enums.TSDataType; import org.apache.tsfile.write.schema.IMeasurementSchema; - -/** - * This structure is used in ViewMNode. It stores all information except the name of this view. The - * name of the view is stored by ViewMNode. - */ -public class LogicalViewInfo implements IMeasurementInfo { - +// +// /** +// * This structure is used in ViewMNode. It stores all information except the name of this view. The +// * name of the view is stored by ViewMNode. +// */ +// public class LogicalViewInfo implements IMeasurementInfo { +// /** tag/attribute's start offset in tag file */ private long offset = -1; - /** whether this measurement is pre deleted and considered in black list */ - private boolean preDeleted = false; - - private LogicalViewSchema schema; - - public LogicalViewInfo(LogicalViewSchema schema) { - this.schema = schema; - } - - // region logical view interfaces - public boolean isAliasSeries() { - if (this.getExpression() != null) { - if (this.getExpression().isSourceForAliasSeries()) { - return true; - } - } - return false; - } - +// /** whether this measurement is pre deleted and considered in black list */ +// private boolean preDeleted = false; +// +// private LogicalViewSchema schema; +// +// public LogicalViewInfo(LogicalViewSchema schema) { +// this.schema = schema; +// } +// +// // region logical view interfaces +// public boolean isAliasSeries() { +// if (this.getExpression() != null) { +// if (this.getExpression().isSourceForAliasSeries()) { +// return true; +// } +// } +// return false; +// } +// /** * @return return the path of alias series if this view is alias series; else return null. */ - public PartialPath getAliasSeriesPath() { - if (this.isAliasSeries()) { - if (this.getExpression().getExpressionType() == ViewExpressionType.TIMESERIES) { - String pathString = ((TimeSeriesViewOperand) this.getExpression()).getPathString(); - try { +// public PartialPath getAliasSeriesPath() { +// if (this.isAliasSeries()) { +// if (this.getExpression().getExpressionType() == ViewExpressionType.TIMESERIES) { +// String pathString = ((TimeSeriesViewOperand) this.getExpression()).getPathString(); +// try { return new MeasurementPath(pathString); - } catch (IllegalPathException e) { - throw new RuntimeException(e); - } - } - } - return null; - } - - public ViewExpression getExpression() { - return this.schema.getExpression(); - } - - public void setExpression(ViewExpression expression) { - this.schema.setExpression(expression); - } - - // endregion - - // region IMeasurementInfo interfaces - - @Override - public IMeasurementSchema getSchema() { - return this.schema; - } - - @Override - public void setSchema(IMeasurementSchema schema) { - if (schema.isLogicalView()) { - this.schema = (LogicalViewSchema) schema; - } - } - - @Override - public TSDataType getDataType() { - return null; - } - - @Override - public String getAlias() { - return null; - } - - @Override - public void setAlias(String alias) { - // can not set alias for a logical view +// } catch (IllegalPathException e) { +// throw new RuntimeException(e); +// } +// } +// } +// return null; +// } +// +// public ViewExpression getExpression() { +// return this.schema.getExpression(); +// } +// +// public void setExpression(ViewExpression expression) { +// this.schema.setExpression(expression); +// } + +// // endregion +// +// // region IMeasurementInfo interfaces +// +// @Override +// public IMeasurementSchema getSchema() { +// return this.schema; +// } +// +// @Override +// public void setSchema(IMeasurementSchema schema) { +// if (schema.isLogicalView()) { +// this.schema = (LogicalViewSchema) schema; +// } +// } +// +// @Override +// public TSDataType getDataType() { +// return null; +// } +// +// @Override +// public String getAlias() { +// return null; +// } +// +// @Override +// public void setAlias(String alias) { +// // can not set alias for a logical view throw new UnsupportedOperationException("View doesn't support alias"); - } - - @Override - public long getOffset() { - // tag/attribute's start offset in tag file +// } +// +// @Override +// public long getOffset() { +// // tag/attribute's start offset in tag file return offset; - } - - @Override - public void setOffset(long offset) { +// } +// +// @Override +// public void setOffset(long offset) { this.offset = offset; - } - - @Override - public boolean isPreDeleted() { - return this.preDeleted; - } - - @Override - public void setPreDeleted(boolean preDeleted) { - this.preDeleted = preDeleted; - } - - /** - * The memory occupied by an MeasurementInfo based occupation - * - *

    - *
  1. object header, 8B +// } +// +// @Override +// public boolean isPreDeleted() { +// return this.preDeleted; +// } +// +// @Override +// public void setPreDeleted(boolean preDeleted) { +// this.preDeleted = preDeleted; +// } +// +// /** +// * The memory occupied by an MeasurementInfo based occupation +// * +// *
      +// *
    1. object header, 8B *
    2. offset, 8B - *
    3. boolean preDeleted, 1B - *
    4. estimated schema size, 32B - *
    5. viewExpression - *
    - */ - @Override - public int estimateSize() { +// *
  2. boolean preDeleted, 1B +// *
  3. estimated schema size, 32B +// *
  4. viewExpression +// *
+// */ +// @Override +// public int estimateSize() { return 8 + 8 + 1 + 32 + ViewExpression.getSerializeSize(schema.getExpression()); - } - - @Override - public void moveDataToNewMNode(IMeasurementMNode newMNode) { +// } +// +// @Override +// public void moveDataToNewMNode(IMeasurementMNode newMNode) { if (newMNode.isLogicalView()) { newMNode.setSchema(this.schema); newMNode.setPreDeleted(preDeleted); - } +// } throw new SchemaExecutionException( - new IllegalArgumentException( - "Type of newMNode is not LogicalViewMNode! It's " +// new IllegalArgumentException( +// "Type of newMNode is not LogicalViewMNode! It's " + newMNode.getMNodeType().toString())); - } - // endregion -} +// } +// // endregion +// } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/mnode/info/TreeDeviceInfo.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/mnode/info/TreeDeviceInfo.java index abfbd11e8a498..5c16dc4eb2f0c 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/mnode/info/TreeDeviceInfo.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/mnode/info/TreeDeviceInfo.java @@ -50,7 +50,7 @@ public class TreeDeviceInfo> implements IDeviceInfo { @SuppressWarnings("squid:S3077") private transient volatile Map> aliasChildren = null; - private volatile Boolean isAligned = false; +// private volatile Boolean isAligned = false; @Override public void moveDataToNewMNode(final IDeviceMNode newMNode) { @@ -169,7 +169,7 @@ public void setSchemaTemplateId(final int schemaTemplateId) { } @Override - public Boolean isAligned() { +// public Boolean isAligned() { return isAligned; } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/snapshot/MemMTreeSnapshotUtil.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/snapshot/MemMTreeSnapshotUtil.java index 71d78712afb72..c607a78eb2450 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/snapshot/MemMTreeSnapshotUtil.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/snapshot/MemMTreeSnapshotUtil.java @@ -29,7 +29,7 @@ import org.apache.iotdb.commons.schema.node.utils.IMNodeFactory; import org.apache.iotdb.commons.schema.node.utils.IMNodeIterator; import org.apache.iotdb.commons.schema.node.visitor.MNodeVisitor; -import org.apache.iotdb.commons.schema.view.LogicalViewSchema; +// import org.apache.iotdb.commons.schema.view.LogicalViewSchema; import org.apache.iotdb.commons.utils.FileUtils; import org.apache.iotdb.db.schemaengine.rescon.MemSchemaRegionStatistics; import org.apache.iotdb.db.schemaengine.schemaregion.mtree.impl.mem.MemMTreeStore; @@ -268,11 +268,11 @@ private static void deserializeMNode( node = deserializer.deserializeMeasurementMNode(inputStream); measurementProcess.accept(node.getAsMeasurementMNode()); break; - case LOGICAL_VIEW_MNODE_TYPE: - childrenNum = 0; - node = deserializer.deserializeLogicalViewMNode(inputStream); - measurementProcess.accept(node.getAsMeasurementMNode()); - break; +// case LOGICAL_VIEW_MNODE_TYPE: +// childrenNum = 0; +// node = deserializer.deserializeLogicalViewMNode(inputStream); +// measurementProcess.accept(node.getAsMeasurementMNode()); +// break; case TABLE_MNODE_TYPE: childrenNum = ReadWriteIOUtils.readInt(inputStream); node = deserializer.deserializeTableDeviceMNode(inputStream); @@ -383,9 +383,9 @@ public Boolean visitMeasurementMNode( ReadWriteIOUtils.write(node.getAlias(), outputStream); ReadWriteIOUtils.write(node.getOffset(), outputStream); ReadWriteIOUtils.write(node.isPreDeleted(), outputStream); - } +// } return true; - } catch (Exception e) { +// } catch (Exception e) { logger.error(SERIALIZE_ERROR_INFO, e); return false; } @@ -454,16 +454,16 @@ public IMemMNode deserializeMeasurementMNode(InputStream inputStream) throws IOE node.setPreDeleted(ReadWriteIOUtils.readBool(inputStream)); return node.getAsMNode(); } - - public IMemMNode deserializeLogicalViewMNode(InputStream inputStream) throws IOException { - String name = ReadWriteIOUtils.readString(inputStream); - LogicalViewSchema logicalViewSchema = LogicalViewSchema.deserializeFrom(inputStream); +// +// public IMemMNode deserializeLogicalViewMNode(InputStream inputStream) throws IOException { +// String name = ReadWriteIOUtils.readString(inputStream); +// LogicalViewSchema logicalViewSchema = LogicalViewSchema.deserializeFrom(inputStream); long tagOffset = ReadWriteIOUtils.readLong(inputStream); - IMeasurementMNode node = +// IMeasurementMNode node = nodeFactory.createLogicalViewMNode(null, name, logicalViewSchema); node.setOffset(tagOffset); node.setPreDeleted(ReadWriteIOUtils.readBool(inputStream)); - return node.getAsMNode(); - } +// return node.getAsMNode(); +// } } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/MTreeBelowSGCachedImpl.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/MTreeBelowSGCachedImpl.java index d5187e14c9140..b8a4cbdae2859 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/MTreeBelowSGCachedImpl.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/MTreeBelowSGCachedImpl.java @@ -1436,8 +1436,8 @@ public String getAlias() { return node.getAlias(); } - public IMeasurementSchema getSchema() { - return node.getSchema(); +// public IMeasurementSchema getSchema() { +// return node.getSchema(); } public Map getTags() { @@ -1458,11 +1458,11 @@ public boolean isUnderAlignedDevice() { return getParentOfNextMatchedNode().getAsDeviceMNode().isAligned(); } - @Override - public boolean isLogicalView() { - return node.isLogicalView(); - } - +// @Override +// public boolean isLogicalView() { +// return node.isLogicalView(); +// } +// public String getFullPath() { return getPartialPathFromRootToNode(node.getAsMNode()).getFullPath(); } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/mnode/factory/CacheMNodeFactory.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/mnode/factory/CacheMNodeFactory.java index 92da4db194845..aa28ebc4da214 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/mnode/factory/CacheMNodeFactory.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/mnode/factory/CacheMNodeFactory.java @@ -69,10 +69,10 @@ public ICachedMNode createAboveDatabaseMNode(ICachedMNode parent, String name) { public ICachedMNode createInternalMNode(ICachedMNode parent, String name) { return new CachedBasicInternalMNode(parent, name); } - - @Override - public IMeasurementMNode createLogicalViewMNode( +// +// @Override +// public IMeasurementMNode createLogicalViewMNode( IDeviceMNode parent, String name, IMeasurementSchema measurementSchema) { throw new UnsupportedOperationException("View is not supported."); - } +// } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/mnode/impl/CachedMeasurementMNode.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/mnode/impl/CachedMeasurementMNode.java index fff9e6150b317..251f13bb32e17 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/mnode/impl/CachedMeasurementMNode.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/mnode/impl/CachedMeasurementMNode.java @@ -69,9 +69,9 @@ public ICachedMNode getAsMNode() { public IMNodeContainer getChildren() { return CachedMNodeContainer.emptyMNodeContainer(); } - - @Override - public final boolean isLogicalView() { - return false; - } +// +// @Override +// public final boolean isLogicalView() { +// return false; +// } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/schemafile/MockSchemaFile.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/schemafile/MockSchemaFile.java index 45fe9015b1a48..9fdb8f59fa6de 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/schemafile/MockSchemaFile.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/schemafile/MockSchemaFile.java @@ -187,12 +187,12 @@ static ICachedMNode cloneMNode(ICachedMNode node) { return result; } else if (node.isDatabase() && node.isDevice()) { ICachedMNode result = nodeFactory.createDatabaseDeviceMNode(null, node.getName()); - result.getAsDeviceMNode().setAligned(node.getAsDeviceMNode().isAlignedNullable()); +// result.getAsDeviceMNode().setAligned(node.getAsDeviceMNode().isAlignedNullable()); cloneInternalMNodeData(node, result); return result; } else if (node.isDevice()) { ICachedMNode result = nodeFactory.createDeviceMNode(null, node.getName()).getAsMNode(); - result.getAsDeviceMNode().setAligned(node.getAsDeviceMNode().isAlignedNullable()); +// result.getAsDeviceMNode().setAligned(node.getAsDeviceMNode().isAlignedNullable()); result .getAsDeviceMNode() .setSchemaTemplateId(node.getAsDeviceMNode().getSchemaTemplateIdWithState()); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/collector/MeasurementCollector.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/collector/MeasurementCollector.java index 2220e1203cd1f..31f55e866eb8b 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/collector/MeasurementCollector.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/collector/MeasurementCollector.java @@ -69,7 +69,7 @@ protected MeasurementPath getCurrentMeasurementPathInTraverse(IMeasurementMNode< MeasurementPath retPath = new MeasurementPath( getPartialPathFromRootToNode(currentNode.getAsMNode()), currentNode.getSchema()); - retPath.setUnderAlignedEntity(par.getAsDeviceMNode().isAlignedNullable()); +// retPath.setUnderAlignedEntity(par.getAsDeviceMNode().isAlignedNullable()); return retPath; } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/read/resp/info/IDeviceSchemaInfo.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/read/resp/info/IDeviceSchemaInfo.java index ed3c15cfcf0a6..deb45a946ff72 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/read/resp/info/IDeviceSchemaInfo.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/read/resp/info/IDeviceSchemaInfo.java @@ -23,7 +23,7 @@ public interface IDeviceSchemaInfo extends ISchemaInfo { - Boolean isAligned(); +// Boolean isAligned(); int getTemplateId(); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/read/resp/info/ITimeSeriesSchemaInfo.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/read/resp/info/ITimeSeriesSchemaInfo.java index 357e4150970ec..3152bd6c1ce42 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/read/resp/info/ITimeSeriesSchemaInfo.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/read/resp/info/ITimeSeriesSchemaInfo.java @@ -27,15 +27,15 @@ public interface ITimeSeriesSchemaInfo extends ISchemaInfo { String getAlias(); - IMeasurementSchema getSchema(); +// IMeasurementSchema getSchema(); Map getTags(); Map getAttributes(); boolean isUnderAlignedDevice(); - - boolean isLogicalView(); +// +// boolean isLogicalView(); ITimeSeriesSchemaInfo snapshot(); } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/read/resp/info/impl/ShowDevicesResult.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/read/resp/info/impl/ShowDevicesResult.java index ce8057987152e..69e9a014d76ca 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/read/resp/info/impl/ShowDevicesResult.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/read/resp/info/impl/ShowDevicesResult.java @@ -34,7 +34,7 @@ import java.util.function.Function; public class ShowDevicesResult extends ShowSchemaResult implements IDeviceSchemaInfo { - private Boolean isAligned; +// private Boolean isAligned; private int templateId; private Function attributeProvider; @@ -55,7 +55,7 @@ public ShowDevicesResult( this.rawNodes = rawNodes; } - public Boolean isAligned() { +// public Boolean isAligned() { return isAligned; } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/read/resp/info/impl/ShowTimeSeriesResult.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/read/resp/info/impl/ShowTimeSeriesResult.java index 2861d267266d1..a8e4f650c2813 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/read/resp/info/impl/ShowTimeSeriesResult.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/read/resp/info/impl/ShowTimeSeriesResult.java @@ -33,7 +33,7 @@ public class ShowTimeSeriesResult extends ShowSchemaResult implements ITimeSerie private String alias; - private IMeasurementSchema measurementSchema; +// private IMeasurementSchema measurementSchema; private Map tags; private Map attributes; @@ -41,13 +41,13 @@ public class ShowTimeSeriesResult extends ShowSchemaResult implements ITimeSerie private boolean isUnderAlignedDevice; public ShowTimeSeriesResult( - String path, +// String path, String alias, - IMeasurementSchema measurementSchema, +// IMeasurementSchema measurementSchema, Map tags, Map attributes, boolean isUnderAlignedDevice) { - super(path); +// super(path); this.alias = alias; this.measurementSchema = measurementSchema; this.tags = tags; @@ -64,7 +64,7 @@ public String getAlias() { } @Override - public IMeasurementSchema getSchema() { +// public IMeasurementSchema getSchema() { return measurementSchema; } @@ -83,11 +83,11 @@ public boolean isUnderAlignedDevice() { return isUnderAlignedDevice; } - @Override - public boolean isLogicalView() { - return this.measurementSchema.isLogicalView(); - } - +// @Override +// public boolean isLogicalView() { +// return this.measurementSchema.isLogicalView(); +// } +// @Override public ITimeSeriesSchemaInfo snapshot() { return this; diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/view/ViewPathType.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/view/ViewPathType.java index 05edc211953cc..8587f732779b8 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/view/ViewPathType.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/view/ViewPathType.java @@ -20,13 +20,13 @@ package org.apache.iotdb.db.schemaengine.schemaregion.view; public enum ViewPathType { - /** Example: root.db.d01.s01, root.db.d02.s01, root.db.d02.s02 */ +// /** Example: root.db.d01.s01, root.db.d02.s01, root.db.d02.s02 */ FULL_PATH_LIST, - /** Example: root.db(d01.s01, d02.s02, status) */ +// /** Example: root.db(d01.s01, d02.s02, status) */ PATHS_GROUP, - /** Example: SELECT s01, s02 FROM root.db.*; */ - QUERY_STATEMENT, - - /** Example: root.db.view(${2}_temperature) */ - BATCH_GENERATION, +// /** Example: SELECT s01, s02 FROM root.db.*; */ +// QUERY_STATEMENT, +// +// /** Example: root.db.view(${2}_temperature) */ +// BATCH_GENERATION, } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/view/ViewPaths.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/view/ViewPaths.java index 73127f25c153f..1c0b08e07ab6e 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/view/ViewPaths.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/view/ViewPaths.java @@ -20,8 +20,8 @@ package org.apache.iotdb.db.schemaengine.schemaregion.view; import org.apache.iotdb.commons.path.PartialPath; -import org.apache.iotdb.db.exception.metadata.view.UnsupportedViewException; -import org.apache.iotdb.db.exception.metadata.view.ViewContainsAggregationException; +// import org.apache.iotdb.db.exception.metadata.view.UnsupportedViewException; +// import org.apache.iotdb.db.exception.metadata.view.ViewContainsAggregationException; import org.apache.iotdb.db.queryengine.plan.expression.Expression; import org.apache.iotdb.db.queryengine.plan.expression.leaf.TimeSeriesOperand; import org.apache.iotdb.db.queryengine.plan.expression.visitor.CollectAggregationExpressionsVisitor; @@ -92,31 +92,31 @@ public void generateExpressionsIfNecessary() { } } else if (this.viewPathType == ViewPathType.QUERY_STATEMENT) { // no nothing. expressions should be set by setExpressionsList - } else if (this.viewPathType == ViewPathType.BATCH_GENERATION) { - // source paths has no intoItem. target paths should not be converted to expression. +// } else if (this.viewPathType == ViewPathType.BATCH_GENERATION) { +// // source paths has no intoItem. target paths should not be converted to expression. } } - /** - * Check all expression in this list, ensure that the views created using them are legal. Check - * follows above rules: 1. A legal view can NOT contain aggregation functions. - * - * @return If all check passed, return true; else return false with failure message. - */ - public static Pair checkExpressionList( - List expressionsList) { - CollectAggregationExpressionsVisitor collectAggExpVisitor = - new CollectAggregationExpressionsVisitor(); - - for (Expression expression : expressionsList) { - List aggList = collectAggExpVisitor.process(expression, null); +// /** +// * Check all expression in this list, ensure that the views created using them are legal. Check +// * follows above rules: 1. A legal view can NOT contain aggregation functions. +// * +// * @return If all check passed, return true; else return false with failure message. +// */ +// public static Pair checkExpressionList( +// List expressionsList) { +// CollectAggregationExpressionsVisitor collectAggExpVisitor = +// new CollectAggregationExpressionsVisitor(); +// +// for (Expression expression : expressionsList) { +// List aggList = collectAggExpVisitor.process(expression, null); if (!aggList.isEmpty()) { - return new Pair<>(false, new ViewContainsAggregationException(aggList.get(0).toString())); - } - } - return new Pair<>(true, null); - } - +// return new Pair<>(false, new ViewContainsAggregationException(aggList.get(0).toString())); +// } +// } +// return new Pair<>(true, null); +// } +// public void setExpressionsList(List expressionsList) { this.expressionsList = expressionsList; } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/view/visitor/GetSourcePathsVisitor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/view/visitor/GetSourcePathsVisitor.java index b60a33a8d2c1a..31f87950e1897 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/view/visitor/GetSourcePathsVisitor.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/view/visitor/GetSourcePathsVisitor.java @@ -1,100 +1,100 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// package org.apache.iotdb.db.schemaengine.schemaregion.view.visitor; - -import org.apache.iotdb.commons.exception.IllegalPathException; -import org.apache.iotdb.commons.path.PartialPath; -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.BinaryViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimeSeriesViewOperand; -import org.apache.iotdb.commons.schema.view.viewExpression.multi.FunctionViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.ternary.TernaryViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.unary.UnaryViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -/** Use this visitor to find all the paths of time series used in one expression. */ -public class GetSourcePathsVisitor extends ViewExpressionVisitor, Void> { - +// +// import org.apache.iotdb.commons.exception.IllegalPathException; +// import org.apache.iotdb.commons.path.PartialPath; +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.BinaryViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimeSeriesViewOperand; +// import org.apache.iotdb.commons.schema.view.viewExpression.multi.FunctionViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.ternary.TernaryViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.unary.UnaryViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; +// +// import java.util.ArrayList; +// import java.util.Collections; +// import java.util.List; +// +// /** Use this visitor to find all the paths of time series used in one expression. */ +// public class GetSourcePathsVisitor extends ViewExpressionVisitor, Void> { +// public static List getSourcePaths(ViewExpression viewExpression) { return new GetSourcePathsVisitor().process(viewExpression, null); } - @Override - public List visitExpression(ViewExpression expression, Void context) { - return new ArrayList<>(); - } - - @Override - public List visitTimeSeriesOperand( - TimeSeriesViewOperand timeSeriesOperand, Void context) { - String pathString = timeSeriesOperand.getPathString(); - try { - PartialPath path = new PartialPath(pathString); - return Collections.singletonList(path); - } catch (IllegalPathException e) { - // the path is illegal! - throw new RuntimeException(e); - } - } - - @Override - public List visitUnaryExpression( - UnaryViewExpression unaryViewExpression, Void context) { - ViewExpression expression = unaryViewExpression.getExpression(); - return this.process(expression, null); - } - - @Override - public List visitBinaryExpression( - BinaryViewExpression binaryViewExpression, Void context) { - List result = new ArrayList<>(); - List expressionList = binaryViewExpression.getChildViewExpressions(); - for (ViewExpression expression : expressionList) { - result.addAll(this.process(expression, null)); - } - return result; - } - - @Override - public List visitTernaryExpression( - TernaryViewExpression ternaryViewExpression, Void context) { - List result = new ArrayList<>(); - List expressionList = ternaryViewExpression.getChildViewExpressions(); - for (ViewExpression expression : expressionList) { - result.addAll(this.process(expression, null)); - } - return result; - } - - @Override - public List visitFunctionExpression( - FunctionViewExpression functionViewExpression, Void context) { - List result = new ArrayList<>(); - List expressionList = functionViewExpression.getChildViewExpressions(); - for (ViewExpression expression : expressionList) { - result.addAll(this.process(expression, null)); - } - return result; - } -} +// @Override +// public List visitExpression(ViewExpression expression, Void context) { +// return new ArrayList<>(); +// } +// +// @Override +// public List visitTimeSeriesOperand( +// TimeSeriesViewOperand timeSeriesOperand, Void context) { +// String pathString = timeSeriesOperand.getPathString(); +// try { +// PartialPath path = new PartialPath(pathString); +// return Collections.singletonList(path); +// } catch (IllegalPathException e) { +// // the path is illegal! +// throw new RuntimeException(e); +// } +// } +// +// @Override +// public List visitUnaryExpression( +// UnaryViewExpression unaryViewExpression, Void context) { +// ViewExpression expression = unaryViewExpression.getExpression(); +// return this.process(expression, null); +// } +// +// @Override +// public List visitBinaryExpression( +// BinaryViewExpression binaryViewExpression, Void context) { +// List result = new ArrayList<>(); +// List expressionList = binaryViewExpression.getChildViewExpressions(); +// for (ViewExpression expression : expressionList) { +// result.addAll(this.process(expression, null)); +// } +// return result; +// } +// +// @Override +// public List visitTernaryExpression( +// TernaryViewExpression ternaryViewExpression, Void context) { +// List result = new ArrayList<>(); +// List expressionList = ternaryViewExpression.getChildViewExpressions(); +// for (ViewExpression expression : expressionList) { +// result.addAll(this.process(expression, null)); +// } +// return result; +// } +// +// @Override +// public List visitFunctionExpression( +// FunctionViewExpression functionViewExpression, Void context) { +// List result = new ArrayList<>(); +// List expressionList = functionViewExpression.getChildViewExpressions(); +// for (ViewExpression expression : expressionList) { +// result.addAll(this.process(expression, null)); +// } +// return result; +// } +// } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/view/visitor/TransformToExpressionVisitor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/view/visitor/TransformToExpressionVisitor.java index 8bedc236c2715..2675538d751ac 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/view/visitor/TransformToExpressionVisitor.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/view/visitor/TransformToExpressionVisitor.java @@ -1,60 +1,60 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// package org.apache.iotdb.db.schemaengine.schemaregion.view.visitor; - -import org.apache.iotdb.commons.exception.IllegalPathException; -import org.apache.iotdb.commons.path.PartialPath; -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.BinaryViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.AdditionViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.ArithmeticBinaryViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.DivisionViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.ModuloViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.MultiplicationViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.SubtractionViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.CompareBinaryViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.EqualToViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.GreaterEqualViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.GreaterThanViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.LessEqualViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.LessThanViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.NonEqualViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.logic.LogicAndViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.logic.LogicBinaryViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.logic.LogicOrViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.leaf.ConstantViewOperand; -import org.apache.iotdb.commons.schema.view.viewExpression.leaf.LeafViewOperand; -import org.apache.iotdb.commons.schema.view.viewExpression.leaf.NullViewOperand; -import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimeSeriesViewOperand; -import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimestampViewOperand; -import org.apache.iotdb.commons.schema.view.viewExpression.multi.FunctionViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.ternary.BetweenViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.ternary.TernaryViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.unary.InViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.unary.IsNullViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.unary.LikeViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.unary.LogicNotViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.unary.NegationViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.unary.RegularViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.unary.UnaryViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; +// +// import org.apache.iotdb.commons.exception.IllegalPathException; +// import org.apache.iotdb.commons.path.PartialPath; +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.BinaryViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.AdditionViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.ArithmeticBinaryViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.DivisionViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.ModuloViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.MultiplicationViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.SubtractionViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.CompareBinaryViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.EqualToViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.GreaterEqualViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.GreaterThanViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.LessEqualViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.LessThanViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.NonEqualViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.logic.LogicAndViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.logic.LogicBinaryViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.logic.LogicOrViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.leaf.ConstantViewOperand; +// import org.apache.iotdb.commons.schema.view.viewExpression.leaf.LeafViewOperand; +// import org.apache.iotdb.commons.schema.view.viewExpression.leaf.NullViewOperand; +// import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimeSeriesViewOperand; +// import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimestampViewOperand; +// import org.apache.iotdb.commons.schema.view.viewExpression.multi.FunctionViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.ternary.BetweenViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.ternary.TernaryViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.unary.InViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.unary.IsNullViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.unary.LikeViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.unary.LogicNotViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.unary.NegationViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.unary.RegularViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.unary.UnaryViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; import org.apache.iotdb.db.queryengine.plan.expression.Expression; import org.apache.iotdb.db.queryengine.plan.expression.binary.AdditionExpression; import org.apache.iotdb.db.queryengine.plan.expression.binary.DivisionExpression; @@ -75,260 +75,260 @@ import org.apache.iotdb.db.queryengine.plan.expression.leaf.TimestampOperand; import org.apache.tsfile.utils.Pair; - -import javax.ws.rs.NotSupportedException; - -import java.util.ArrayList; -import java.util.List; - -public class TransformToExpressionVisitor extends ViewExpressionVisitor { - - @Override - public Expression process(ViewExpression viewExpression, Void context) { - return viewExpression.accept(this, context); - } - - @Override - public Expression visitExpression(ViewExpression expression, Void context) { - throw new RuntimeException( - new NotSupportedException( - "visitExpression in TransformToExpressionVisitor is not supported.")); - } - - // region leaf operand - @Override - public Expression visitLeafOperand(LeafViewOperand leafViewOperand, Void context) { - throw new RuntimeException(new NotSupportedException("Can not construct abstract class.")); - } - - @Override - public Expression visitConstantOperand(ConstantViewOperand constantOperand, Void context) { +// +// import javax.ws.rs.NotSupportedException; +// +// import java.util.ArrayList; +// import java.util.List; +// +// public class TransformToExpressionVisitor extends ViewExpressionVisitor { +// +// @Override +// public Expression process(ViewExpression viewExpression, Void context) { +// return viewExpression.accept(this, context); +// } +// +// @Override +// public Expression visitExpression(ViewExpression expression, Void context) { +// throw new RuntimeException( +// new NotSupportedException( +// "visitExpression in TransformToExpressionVisitor is not supported.")); +// } +// +// // region leaf operand +// @Override +// public Expression visitLeafOperand(LeafViewOperand leafViewOperand, Void context) { +// throw new RuntimeException(new NotSupportedException("Can not construct abstract class.")); +// } +// +// @Override +// public Expression visitConstantOperand(ConstantViewOperand constantOperand, Void context) { return new ConstantOperand(constantOperand.getDataType(), constantOperand.getValueString()); - } - - @Override - public Expression visitNullOperand(NullViewOperand nullOperand, Void context) { +// } +// +// @Override +// public Expression visitNullOperand(NullViewOperand nullOperand, Void context) { return new NullOperand(); - } - - @Override - public Expression visitTimeSeriesOperand(TimeSeriesViewOperand timeSeriesOperand, Void context) { - try { - PartialPath path = new PartialPath(timeSeriesOperand.getPathString()); +// } +// +// @Override +// public Expression visitTimeSeriesOperand(TimeSeriesViewOperand timeSeriesOperand, Void context) { +// try { +// PartialPath path = new PartialPath(timeSeriesOperand.getPathString()); return new TimeSeriesOperand(path); - } catch (IllegalPathException e) { - throw new RuntimeException(e); - } - } - - @Override - public Expression visitTimeStampOperand(TimestampViewOperand timestampOperand, Void context) { +// } catch (IllegalPathException e) { +// throw new RuntimeException(e); +// } +// } +// +// @Override +// public Expression visitTimeStampOperand(TimestampViewOperand timestampOperand, Void context) { return new TimestampOperand(); - } - - // endregion - - // region Unary Expressions - @Override - public Expression visitUnaryExpression(UnaryViewExpression unaryViewExpression, Void context) { - throw new RuntimeException(new NotSupportedException("Can not construct abstract class.")); - } - - @Override - public Expression visitInExpression(InViewExpression inExpression, Void context) { - Expression child = this.process(inExpression.getExpression(), context); +// } + +// // endregion +// +// // region Unary Expressions +// @Override +// public Expression visitUnaryExpression(UnaryViewExpression unaryViewExpression, Void context) { +// throw new RuntimeException(new NotSupportedException("Can not construct abstract class.")); +// } +// +// @Override +// public Expression visitInExpression(InViewExpression inExpression, Void context) { +// Expression child = this.process(inExpression.getExpression(), context); return new org.apache.iotdb.db.queryengine.plan.expression.unary.InExpression( - child, inExpression.isNotIn(), inExpression.getValuesInLinkedHashSet()); - } - - @Override - public Expression visitIsNullExpression(IsNullViewExpression isNullExpression, Void context) { - Expression child = this.process(isNullExpression.getExpression(), context); +// child, inExpression.isNotIn(), inExpression.getValuesInLinkedHashSet()); +// } +// +// @Override +// public Expression visitIsNullExpression(IsNullViewExpression isNullExpression, Void context) { +// Expression child = this.process(isNullExpression.getExpression(), context); return new org.apache.iotdb.db.queryengine.plan.expression.unary.IsNullExpression( - child, isNullExpression.isNot()); - } - - @Override - public Expression visitLikeExpression(LikeViewExpression likeExpression, Void context) { - Expression child = this.process(likeExpression.getExpression(), context); +// child, isNullExpression.isNot()); +// } +// +// @Override +// public Expression visitLikeExpression(LikeViewExpression likeExpression, Void context) { +// Expression child = this.process(likeExpression.getExpression(), context); return new org.apache.iotdb.db.queryengine.plan.expression.unary.LikeExpression( child, likeExpression.getPattern(), likeExpression.getEscape(), likeExpression.isNot()); - } - - @Override - public Expression visitLogicNotExpression( - LogicNotViewExpression logicNotExpression, Void context) { - Expression child = this.process(logicNotExpression.getExpression(), context); +// } +// +// @Override +// public Expression visitLogicNotExpression( +// LogicNotViewExpression logicNotExpression, Void context) { +// Expression child = this.process(logicNotExpression.getExpression(), context); return new org.apache.iotdb.db.queryengine.plan.expression.unary.LogicNotExpression(child); - } - - @Override - public Expression visitNegationExpression( - NegationViewExpression negationExpression, Void context) { - Expression child = this.process(negationExpression.getExpression(), context); +// } +// +// @Override +// public Expression visitNegationExpression( +// NegationViewExpression negationExpression, Void context) { +// Expression child = this.process(negationExpression.getExpression(), context); return new org.apache.iotdb.db.queryengine.plan.expression.unary.NegationExpression(child); - } - - @Override - public Expression visitRegularExpression(RegularViewExpression regularExpression, Void context) { - Expression child = this.process(regularExpression.getExpression(), context); +// } +// +// @Override +// public Expression visitRegularExpression(RegularViewExpression regularExpression, Void context) { +// Expression child = this.process(regularExpression.getExpression(), context); return new org.apache.iotdb.db.queryengine.plan.expression.unary.RegularExpression( child, regularExpression.getPatternString(), regularExpression.getPattern(), regularExpression.isNot()); - } - - // endregion - - @Override - // region Binary Expressions - public Expression visitBinaryExpression(BinaryViewExpression binaryViewExpression, Void context) { - throw new RuntimeException(new NotSupportedException("Can not construct abstract class.")); - } - - private Pair getExpressionsForBinaryExpression( - BinaryViewExpression binaryViewExpression) { - Expression left = this.process(binaryViewExpression.getLeftExpression(), null); - Expression right = this.process(binaryViewExpression.getRightExpression(), null); - return new Pair<>(left, right); - } - - // region Binary : Arithmetic Binary Expression - public Expression visitArithmeticBinaryExpression( - ArithmeticBinaryViewExpression arithmeticBinaryExpression, Void context) { - throw new RuntimeException(new NotSupportedException("Can not construct abstract class.")); - } - - public Expression visitAdditionExpression( - AdditionViewExpression additionExpression, Void context) { - Pair pair = this.getExpressionsForBinaryExpression(additionExpression); +// } + +// // endregion +// +// @Override +// // region Binary Expressions +// public Expression visitBinaryExpression(BinaryViewExpression binaryViewExpression, Void context) { +// throw new RuntimeException(new NotSupportedException("Can not construct abstract class.")); +// } +// +// private Pair getExpressionsForBinaryExpression( +// BinaryViewExpression binaryViewExpression) { +// Expression left = this.process(binaryViewExpression.getLeftExpression(), null); +// Expression right = this.process(binaryViewExpression.getRightExpression(), null); +// return new Pair<>(left, right); +// } +// +// // region Binary : Arithmetic Binary Expression +// public Expression visitArithmeticBinaryExpression( +// ArithmeticBinaryViewExpression arithmeticBinaryExpression, Void context) { +// throw new RuntimeException(new NotSupportedException("Can not construct abstract class.")); +// } +// +// public Expression visitAdditionExpression( +// AdditionViewExpression additionExpression, Void context) { +// Pair pair = this.getExpressionsForBinaryExpression(additionExpression); return new AdditionExpression(pair.left, pair.right); - } - - public Expression visitDivisionExpression( - DivisionViewExpression divisionExpression, Void context) { - Pair pair = this.getExpressionsForBinaryExpression(divisionExpression); +// } +// +// public Expression visitDivisionExpression( +// DivisionViewExpression divisionExpression, Void context) { +// Pair pair = this.getExpressionsForBinaryExpression(divisionExpression); return new DivisionExpression(pair.left, pair.right); - } - - public Expression visitModuloExpression(ModuloViewExpression moduloExpression, Void context) { - Pair pair = this.getExpressionsForBinaryExpression(moduloExpression); +// } +// +// public Expression visitModuloExpression(ModuloViewExpression moduloExpression, Void context) { +// Pair pair = this.getExpressionsForBinaryExpression(moduloExpression); return new ModuloExpression(pair.left, pair.right); - } - - public Expression visitMultiplicationExpression( - MultiplicationViewExpression multiplicationExpression, Void context) { - Pair pair = - this.getExpressionsForBinaryExpression(multiplicationExpression); +// } +// +// public Expression visitMultiplicationExpression( +// MultiplicationViewExpression multiplicationExpression, Void context) { +// Pair pair = +// this.getExpressionsForBinaryExpression(multiplicationExpression); return new MultiplicationExpression(pair.left, pair.right); - } - - public Expression visitSubtractionExpression( - SubtractionViewExpression subtractionExpression, Void context) { - Pair pair = - this.getExpressionsForBinaryExpression(subtractionExpression); +// } +// +// public Expression visitSubtractionExpression( +// SubtractionViewExpression subtractionExpression, Void context) { +// Pair pair = +// this.getExpressionsForBinaryExpression(subtractionExpression); return new SubtractionExpression(pair.left, pair.right); - } - - // endregion - - // region Binary: Compare Binary Expression - public Expression visitCompareBinaryExpression( - CompareBinaryViewExpression compareBinaryExpression, Void context) { - throw new RuntimeException(new NotSupportedException("Can not construct abstract class.")); - } - - public Expression visitEqualToExpression(EqualToViewExpression equalToExpression, Void context) { - Pair pair = this.getExpressionsForBinaryExpression(equalToExpression); +// } + +// // endregion +// +// // region Binary: Compare Binary Expression +// public Expression visitCompareBinaryExpression( +// CompareBinaryViewExpression compareBinaryExpression, Void context) { +// throw new RuntimeException(new NotSupportedException("Can not construct abstract class.")); +// } +// +// public Expression visitEqualToExpression(EqualToViewExpression equalToExpression, Void context) { +// Pair pair = this.getExpressionsForBinaryExpression(equalToExpression); return new EqualToExpression(pair.left, pair.right); - } - - public Expression visitGreaterEqualExpression( - GreaterEqualViewExpression greaterEqualExpression, Void context) { - Pair pair = - this.getExpressionsForBinaryExpression(greaterEqualExpression); +// } +// +// public Expression visitGreaterEqualExpression( +// GreaterEqualViewExpression greaterEqualExpression, Void context) { +// Pair pair = +// this.getExpressionsForBinaryExpression(greaterEqualExpression); return new GreaterEqualExpression(pair.left, pair.right); - } - - public Expression visitGreaterThanExpression( - GreaterThanViewExpression greaterThanExpression, Void context) { - Pair pair = - this.getExpressionsForBinaryExpression(greaterThanExpression); +// } +// +// public Expression visitGreaterThanExpression( +// GreaterThanViewExpression greaterThanExpression, Void context) { +// Pair pair = +// this.getExpressionsForBinaryExpression(greaterThanExpression); return new GreaterThanExpression(pair.left, pair.right); - } - - public Expression visitLessEqualExpression( - LessEqualViewExpression lessEqualExpression, Void context) { - Pair pair = this.getExpressionsForBinaryExpression(lessEqualExpression); +// } +// +// public Expression visitLessEqualExpression( +// LessEqualViewExpression lessEqualExpression, Void context) { +// Pair pair = this.getExpressionsForBinaryExpression(lessEqualExpression); return new LessEqualExpression(pair.left, pair.right); - } - - public Expression visitLessThanExpression( - LessThanViewExpression lessThanExpression, Void context) { - Pair pair = this.getExpressionsForBinaryExpression(lessThanExpression); +// } +// +// public Expression visitLessThanExpression( +// LessThanViewExpression lessThanExpression, Void context) { +// Pair pair = this.getExpressionsForBinaryExpression(lessThanExpression); return new LessThanExpression(pair.left, pair.right); - } - - public Expression visitNonEqualExpression( - NonEqualViewExpression nonEqualExpression, Void context) { - Pair pair = this.getExpressionsForBinaryExpression(nonEqualExpression); +// } +// +// public Expression visitNonEqualExpression( +// NonEqualViewExpression nonEqualExpression, Void context) { +// Pair pair = this.getExpressionsForBinaryExpression(nonEqualExpression); return new NonEqualExpression(pair.left, pair.right); - } - - // endregion - - // region Binary : Logic Binary Expression - public Expression visitLogicBinaryExpression( - LogicBinaryViewExpression logicBinaryExpression, Void context) { - throw new RuntimeException(new NotSupportedException("Can not construct abstract class.")); - } - - public Expression visitLogicAndExpression( - LogicAndViewExpression logicAndExpression, Void context) { - Pair pair = this.getExpressionsForBinaryExpression(logicAndExpression); +// } + +// // endregion +// +// // region Binary : Logic Binary Expression +// public Expression visitLogicBinaryExpression( +// LogicBinaryViewExpression logicBinaryExpression, Void context) { +// throw new RuntimeException(new NotSupportedException("Can not construct abstract class.")); +// } +// +// public Expression visitLogicAndExpression( +// LogicAndViewExpression logicAndExpression, Void context) { +// Pair pair = this.getExpressionsForBinaryExpression(logicAndExpression); return new LogicAndExpression(pair.left, pair.right); - } - - public Expression visitLogicOrExpression(LogicOrViewExpression logicOrExpression, Void context) { - Pair pair = this.getExpressionsForBinaryExpression(logicOrExpression); +// } +// +// public Expression visitLogicOrExpression(LogicOrViewExpression logicOrExpression, Void context) { +// Pair pair = this.getExpressionsForBinaryExpression(logicOrExpression); return new LogicOrExpression(pair.left, pair.right); - } - - // endregion - - // endregion - - // region Ternary Expressions - public Expression visitTernaryExpression( - TernaryViewExpression ternaryViewExpression, Void context) { - throw new RuntimeException(new NotSupportedException("Can not construct abstract class.")); - } - - public Expression visitBetweenExpression( - BetweenViewExpression betweenViewExpression, Void context) { - Expression first = this.process(betweenViewExpression.getFirstExpression(), null); - Expression second = this.process(betweenViewExpression.getSecondExpression(), null); - Expression third = this.process(betweenViewExpression.getThirdExpression(), null); +// } + +// // endregion +// +// // endregion +// +// // region Ternary Expressions +// public Expression visitTernaryExpression( +// TernaryViewExpression ternaryViewExpression, Void context) { +// throw new RuntimeException(new NotSupportedException("Can not construct abstract class.")); +// } +// +// public Expression visitBetweenExpression( +// BetweenViewExpression betweenViewExpression, Void context) { +// Expression first = this.process(betweenViewExpression.getFirstExpression(), null); +// Expression second = this.process(betweenViewExpression.getSecondExpression(), null); +// Expression third = this.process(betweenViewExpression.getThirdExpression(), null); return new org.apache.iotdb.db.queryengine.plan.expression.ternary.BetweenExpression( - first, second, third, betweenViewExpression.isNotBetween()); - } - - // endregion - - // region FunctionExpression - public Expression visitFunctionExpression( - FunctionViewExpression functionViewExpression, Void context) { - List viewExpressionList = functionViewExpression.getExpressions(); - List expressionList = new ArrayList<>(); - for (ViewExpression viewExpression : viewExpressionList) { - expressionList.add(this.process(viewExpression, null)); - } +// first, second, third, betweenViewExpression.isNotBetween()); +// } + +// // endregion +// +// // region FunctionExpression +// public Expression visitFunctionExpression( +// FunctionViewExpression functionViewExpression, Void context) { +// List viewExpressionList = functionViewExpression.getExpressions(); +// List expressionList = new ArrayList<>(); +// for (ViewExpression viewExpression : viewExpressionList) { +// expressionList.add(this.process(viewExpression, null)); +// } return new org.apache.iotdb.db.queryengine.plan.expression.multi.FunctionExpression( - functionViewExpression.getFunctionName(), - functionViewExpression.getFunctionAttributes(), - expressionList); - } - // endregion - -} +// functionViewExpression.getFunctionName(), +// functionViewExpression.getFunctionAttributes(), +// expressionList); +// } +// // endregion +// +// } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/write/req/SchemaRegionWritePlanFactory.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/write/req/SchemaRegionWritePlanFactory.java index 5fe5ec993cd48..ba6bd31bfb2b6 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/write/req/SchemaRegionWritePlanFactory.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/write/req/SchemaRegionWritePlanFactory.java @@ -93,8 +93,8 @@ public static ISchemaRegionPlan getEmptyPlan(final SchemaRegionPlanType planType return new RollbackPreDeactivateTemplatePlanImpl(); case DEACTIVATE_TEMPLATE: return new DeactivateTemplatePlanImpl(); - case CREATE_LOGICAL_VIEW: - return new CreateLogicalViewPlanImpl(); +// case CREATE_LOGICAL_VIEW: +// return new CreateLogicalViewPlanImpl(); case PRE_DELETE_LOGICAL_VIEW: return new PreDeleteLogicalViewPlanImpl(); case ROLLBACK_PRE_DELETE_LOGICAL_VIEW: diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/write/req/impl/view/CreateLogicalViewPlanImpl.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/write/req/impl/view/CreateLogicalViewPlanImpl.java index 8555b7b183134..6c0d799786324 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/write/req/impl/view/CreateLogicalViewPlanImpl.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/write/req/impl/view/CreateLogicalViewPlanImpl.java @@ -1,76 +1,76 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// package org.apache.iotdb.db.schemaengine.schemaregion.write.req.impl.view; - -import org.apache.iotdb.commons.path.PartialPath; -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// +// import org.apache.iotdb.commons.path.PartialPath; +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; import org.apache.iotdb.db.schemaengine.schemaregion.write.req.view.ICreateLogicalViewPlan; - -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class CreateLogicalViewPlanImpl implements ICreateLogicalViewPlan { - - private PartialPath targetPath = null; - private ViewExpression sourceExpression = null; - - public CreateLogicalViewPlanImpl() {} - - public CreateLogicalViewPlanImpl(PartialPath targetPath, ViewExpression sourceExpression) { - this.targetPath = targetPath; - this.sourceExpression = sourceExpression; - } - - @Override - public int getViewSize() { - return 1; - } - - @Override - public Map getViewPathToSourceExpressionMap() { - Map result = new HashMap<>(); - result.put(this.targetPath, this.sourceExpression); - return result; - } - - @Override - public List getViewPathList() { - return Collections.singletonList(this.targetPath); - } - - @Override - public void setViewPathToSourceExpressionMap( - Map viewPathToSourceExpressionMap) { - for (Map.Entry entry : viewPathToSourceExpressionMap.entrySet()) { - this.targetPath = entry.getKey(); - this.sourceExpression = entry.getValue(); - } - } - - public PartialPath getTargetPath() { - return this.targetPath; - } - - public ViewExpression getSourceExpression() { - return this.sourceExpression; - } -} +// +// import java.util.Collections; +// import java.util.HashMap; +// import java.util.List; +// import java.util.Map; +// +// public class CreateLogicalViewPlanImpl implements ICreateLogicalViewPlan { +// +// private PartialPath targetPath = null; +// private ViewExpression sourceExpression = null; +// +// public CreateLogicalViewPlanImpl() {} +// +// public CreateLogicalViewPlanImpl(PartialPath targetPath, ViewExpression sourceExpression) { +// this.targetPath = targetPath; +// this.sourceExpression = sourceExpression; +// } +// +// @Override +// public int getViewSize() { +// return 1; +// } +// +// @Override +// public Map getViewPathToSourceExpressionMap() { +// Map result = new HashMap<>(); +// result.put(this.targetPath, this.sourceExpression); +// return result; +// } +// +// @Override +// public List getViewPathList() { +// return Collections.singletonList(this.targetPath); +// } +// +// @Override +// public void setViewPathToSourceExpressionMap( +// Map viewPathToSourceExpressionMap) { +// for (Map.Entry entry : viewPathToSourceExpressionMap.entrySet()) { +// this.targetPath = entry.getKey(); +// this.sourceExpression = entry.getValue(); +// } +// } +// +// public PartialPath getTargetPath() { +// return this.targetPath; +// } +// +// public ViewExpression getSourceExpression() { +// return this.sourceExpression; +// } +// } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/write/req/view/ICreateLogicalViewPlan.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/write/req/view/ICreateLogicalViewPlan.java index 3c94851c5282c..75c79f9a832e8 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/write/req/view/ICreateLogicalViewPlan.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/write/req/view/ICreateLogicalViewPlan.java @@ -1,70 +1,70 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// package org.apache.iotdb.db.schemaengine.schemaregion.write.req.view; - -import org.apache.iotdb.commons.path.PartialPath; -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// +// import org.apache.iotdb.commons.path.PartialPath; +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; import org.apache.iotdb.db.schemaengine.schemaregion.ISchemaRegionPlan; import org.apache.iotdb.db.schemaengine.schemaregion.SchemaRegionPlanType; import org.apache.iotdb.db.schemaengine.schemaregion.SchemaRegionPlanVisitor; - -import java.util.List; -import java.util.Map; - -public interface ICreateLogicalViewPlan extends ISchemaRegionPlan { - @Override - default SchemaRegionPlanType getPlanType() { - return SchemaRegionPlanType.CREATE_LOGICAL_VIEW; - } - - @Override - default R accept(SchemaRegionPlanVisitor visitor, C context) { - return visitor.visitCreateLogicalView(this, context); - } - - /** - * Get how many views will be created. - * - * @return the number of views that will be created - */ - int getViewSize(); - +// +// import java.util.List; +// import java.util.Map; +// +// public interface ICreateLogicalViewPlan extends ISchemaRegionPlan { +// @Override +// default SchemaRegionPlanType getPlanType() { +// return SchemaRegionPlanType.CREATE_LOGICAL_VIEW; +// } +// +// @Override +// default R accept(SchemaRegionPlanVisitor visitor, C context) { +// return visitor.visitCreateLogicalView(this, context); +// } +// +// /** +// * Get how many views will be created. +// * +// * @return the number of views that will be created +// */ +// int getViewSize(); +// /** * @return return a map, from view path (the targets) to source expression. */ - Map getViewPathToSourceExpressionMap(); - +// Map getViewPathToSourceExpressionMap(); +// /** * @return return a list of target paths (paths of views). */ - List getViewPathList(); - - /** - * @param viewPathToSourceExpressionMap a map from view path (the targets) to source expression. - */ - void setViewPathToSourceExpressionMap( - Map viewPathToSourceExpressionMap); - - // /** - // * @param partialPaths a list of partialPaths. Will be transformed into expressions then set - // as source. (source timeseries or expressions in query statement) - // */ - // void setSourceByPartialPath(List partialPaths); -} +// List getViewPathList(); +// +// /** +// * @param viewPathToSourceExpressionMap a map from view path (the targets) to source expression. +// */ +// void setViewPathToSourceExpressionMap( +// Map viewPathToSourceExpressionMap); +// +// // /** +// // * @param partialPaths a list of partialPaths. Will be transformed into expressions then set +// // as source. (source timeseries or expressions in query statement) +// // */ +// // void setSourceByPartialPath(List partialPaths); +// } diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/metadata/schemaRegion/SchemaRegionBasicTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/metadata/schemaRegion/SchemaRegionBasicTest.java index 601233d9d6094..f1d8deadc316f 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/metadata/schemaRegion/SchemaRegionBasicTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/metadata/schemaRegion/SchemaRegionBasicTest.java @@ -54,7 +54,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.HashSet; -import java.util.LinkedList; +// import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; @@ -234,27 +234,27 @@ public void testFetchSchema() throws Exception { .isEmpty()); } - @Test +// @Test public void testCreateAlignedTimeSeries() throws Exception { final ISchemaRegion schemaRegion = getSchemaRegion("root.sg", 0); - schemaRegion.createAlignedTimeSeries( +// schemaRegion.createAlignedTimeSeries( SchemaRegionWritePlanFactory.getCreateAlignedTimeSeriesPlan( - new PartialPath("root.sg.wf02.wt01"), - Arrays.asList("temperature", "status"), - Arrays.asList(TSDataType.valueOf("FLOAT"), TSDataType.valueOf("INT32")), - Arrays.asList(TSEncoding.valueOf("RLE"), TSEncoding.valueOf("RLE")), - Arrays.asList(CompressionType.SNAPPY, CompressionType.SNAPPY), - null, - null, - null)); +// new PartialPath("root.sg.wf02.wt01"), +// Arrays.asList("temperature", "status"), +// Arrays.asList(TSDataType.valueOf("FLOAT"), TSDataType.valueOf("INT32")), +// Arrays.asList(TSEncoding.valueOf("RLE"), TSEncoding.valueOf("RLE")), +// Arrays.asList(CompressionType.SNAPPY, CompressionType.SNAPPY), +// null, +// null, +// null)); final Map checkRes = - schemaRegion.checkMeasurementExistence( - new PartialPath("root.sg.wf02.wt01"), Arrays.asList("temperature", "status"), null); - Assert.assertEquals(2, checkRes.size()); - Assert.assertTrue(checkRes.get(0) instanceof MeasurementAlreadyExistException); - Assert.assertTrue(checkRes.get(1) instanceof MeasurementAlreadyExistException); - } - +// schemaRegion.checkMeasurementExistence( +// new PartialPath("root.sg.wf02.wt01"), Arrays.asList("temperature", "status"), null); +// Assert.assertEquals(2, checkRes.size()); +// Assert.assertTrue(checkRes.get(0) instanceof MeasurementAlreadyExistException); +// Assert.assertTrue(checkRes.get(1) instanceof MeasurementAlreadyExistException); +// } +// @Test public void testCreateAlignedTimeSeriesWithMerge() throws Exception { final ISchemaRegion schemaRegion = getSchemaRegion("root.sg", 0); @@ -565,169 +565,169 @@ public void testDeleteTimeSeries() throws Exception { Assert.assertEquals(1, schemas.size()); Assert.assertEquals("root.sg.wf02.wt01.temperature", schemas.get(0).getFullPath()); } - - @Test +// +// @Test public void testGetAllTimeSeriesCount() throws Exception { final ISchemaRegion schemaRegion = getSchemaRegion("root.laptop", 0); - +// SchemaRegionTestUtil.createSimpleTimeSeriesByList( - schemaRegion, - Arrays.asList( - "root.laptop.d0", - "root.laptop.d1.s1", - "root.laptop.d1.s2.t1", - "root.laptop.d1.s3", - "root.laptop.d2.s1", - "root.laptop.d2.s2")); - - // for Non prefix matched path - Assert.assertEquals( +// schemaRegion, +// Arrays.asList( +// "root.laptop.d0", +// "root.laptop.d1.s1", +// "root.laptop.d1.s2.t1", +// "root.laptop.d1.s3", +// "root.laptop.d2.s1", +// "root.laptop.d2.s2")); +// +// // for Non prefix matched path +// Assert.assertEquals( 6, getAllTimeSeriesCount(schemaRegion, new PartialPath("root.**"), null, false)); - Assert.assertEquals( +// Assert.assertEquals( 6, getAllTimeSeriesCount(schemaRegion, new PartialPath("root.laptop.**"), null, false)); - Assert.assertEquals( +// Assert.assertEquals( 1, getAllTimeSeriesCount(schemaRegion, new PartialPath("root.laptop.*"), null, false)); - Assert.assertEquals( +// Assert.assertEquals( 4, getAllTimeSeriesCount(schemaRegion, new PartialPath("root.laptop.*.*"), null, false)); - Assert.assertEquals( +// Assert.assertEquals( 5, getAllTimeSeriesCount(schemaRegion, new PartialPath("root.laptop.*.**"), null, false)); - Assert.assertEquals( +// Assert.assertEquals( 1, getAllTimeSeriesCount(schemaRegion, new PartialPath("root.laptop.*.*.t1"), null, false)); - Assert.assertEquals( +// Assert.assertEquals( 2, getAllTimeSeriesCount(schemaRegion, new PartialPath("root.laptop.*.s1"), null, false)); - Assert.assertEquals( +// Assert.assertEquals( 3, getAllTimeSeriesCount(schemaRegion, new PartialPath("root.laptop.d1.**"), null, false)); - Assert.assertEquals( +// Assert.assertEquals( 2, getAllTimeSeriesCount(schemaRegion, new PartialPath("root.laptop.d1.*"), null, false)); - Assert.assertEquals( +// Assert.assertEquals( 1, getAllTimeSeriesCount(schemaRegion, new PartialPath("root.laptop.d2.s1"), null, false)); - Assert.assertEquals( +// Assert.assertEquals( 2, getAllTimeSeriesCount(schemaRegion, new PartialPath("root.laptop.d2.**"), null, false)); - Assert.assertEquals( +// Assert.assertEquals( 0, getAllTimeSeriesCount(schemaRegion, new PartialPath("root.laptop"), null, false)); - Assert.assertEquals( +// Assert.assertEquals( 0, getAllTimeSeriesCount(schemaRegion, new PartialPath("root.laptop.d3.s1"), null, false)); - - // for prefix matched path - Assert.assertEquals( +// +// // for prefix matched path +// Assert.assertEquals( 6, getAllTimeSeriesCount(schemaRegion, new PartialPath("root"), null, true)); Assert.assertEquals( 6, getAllTimeSeriesCount(schemaRegion, new PartialPath("root.laptop"), null, true)); - Assert.assertEquals( +// Assert.assertEquals( 2, getAllTimeSeriesCount(schemaRegion, new PartialPath("root.laptop.d2"), null, true)); - } - - @Test - public void testGetMeasurementCountGroupByLevel() throws Exception { +// } +// +// @Test +// public void testGetMeasurementCountGroupByLevel() throws Exception { final ISchemaRegion schemaRegion = getSchemaRegion("root.laptop", 0); - +// SchemaRegionTestUtil.createSimpleTimeSeriesByList( - schemaRegion, - Arrays.asList( - "root.laptop.d0", - "root.laptop.d1.s1", - "root.laptop.d1.s2.t1", - "root.laptop.d1.s3", - "root.laptop.d2.s1", - "root.laptop.d2.s2")); - +// schemaRegion, +// Arrays.asList( +// "root.laptop.d0", +// "root.laptop.d1.s1", +// "root.laptop.d1.s2.t1", +// "root.laptop.d1.s3", +// "root.laptop.d2.s1", +// "root.laptop.d2.s2")); +// final Map expected = new HashMap<>(); - expected.put(new PartialPath("root"), (long) 6); - Assert.assertEquals( - expected, +// expected.put(new PartialPath("root"), (long) 6); +// Assert.assertEquals( +// expected, getMeasurementCountGroupByLevel(schemaRegion, new PartialPath("root.**"), 0, false)); - expected.clear(); - - expected.put(new PartialPath("root.laptop"), (long) 1); - Assert.assertEquals( - expected, +// expected.clear(); +// +// expected.put(new PartialPath("root.laptop"), (long) 1); +// Assert.assertEquals( +// expected, getMeasurementCountGroupByLevel(schemaRegion, new PartialPath("root.laptop.*"), 1, false)); - expected.clear(); - - expected.put(new PartialPath("root.laptop.d0"), (long) 1); - Assert.assertEquals( - expected, +// expected.clear(); +// +// expected.put(new PartialPath("root.laptop.d0"), (long) 1); +// Assert.assertEquals( +// expected, getMeasurementCountGroupByLevel(schemaRegion, new PartialPath("root.laptop.d0"), 2, false)); - expected.clear(); - - expected.put(new PartialPath("root.laptop.d1"), (long) 2); - Assert.assertEquals( - expected, +// expected.clear(); +// +// expected.put(new PartialPath("root.laptop.d1"), (long) 2); +// Assert.assertEquals( +// expected, getMeasurementCountGroupByLevel( schemaRegion, new PartialPath("root.laptop.d1.*"), 2, false)); - expected.clear(); - - expected.put(new PartialPath("root.laptop.d1"), (long) 3); - Assert.assertEquals( - expected, +// expected.clear(); +// +// expected.put(new PartialPath("root.laptop.d1"), (long) 3); +// Assert.assertEquals( +// expected, getMeasurementCountGroupByLevel( schemaRegion, new PartialPath("root.laptop.d1.**"), 2, false)); - expected.clear(); - - expected.put(new PartialPath("root.laptop.d2"), (long) 2); - Assert.assertEquals( - expected, +// expected.clear(); +// +// expected.put(new PartialPath("root.laptop.d2"), (long) 2); +// Assert.assertEquals( +// expected, getMeasurementCountGroupByLevel( schemaRegion, new PartialPath("root.laptop.d2.*"), 2, false)); - expected.clear(); - - expected.put(new PartialPath("root.laptop"), (long) 2); - Assert.assertEquals( - expected, +// expected.clear(); +// +// expected.put(new PartialPath("root.laptop"), (long) 2); +// Assert.assertEquals( +// expected, getMeasurementCountGroupByLevel( schemaRegion, new PartialPath("root.laptop.*.s1"), 1, false)); - expected.clear(); - - expected.put(new PartialPath("root.laptop.d1"), (long) 1); - expected.put(new PartialPath("root.laptop.d2"), (long) 1); - Assert.assertEquals( - expected, +// expected.clear(); +// +// expected.put(new PartialPath("root.laptop.d1"), (long) 1); +// expected.put(new PartialPath("root.laptop.d2"), (long) 1); +// Assert.assertEquals( +// expected, getMeasurementCountGroupByLevel( schemaRegion, new PartialPath("root.laptop.*.s1"), 2, false)); - expected.clear(); - - expected.put(new PartialPath("root.laptop"), (long) 1); - Assert.assertEquals( - expected, +// expected.clear(); +// +// expected.put(new PartialPath("root.laptop"), (long) 1); +// Assert.assertEquals( +// expected, getMeasurementCountGroupByLevel( schemaRegion, new PartialPath("root.laptop.*.s2"), 1, false)); - expected.clear(); - - expected.put(new PartialPath("root.laptop.d1"), (long) 2); - expected.put(new PartialPath("root.laptop.d2"), (long) 2); - Assert.assertEquals( - expected, +// expected.clear(); +// +// expected.put(new PartialPath("root.laptop.d1"), (long) 2); +// expected.put(new PartialPath("root.laptop.d2"), (long) 2); +// Assert.assertEquals( +// expected, getMeasurementCountGroupByLevel( schemaRegion, new PartialPath("root.laptop.*.*"), 2, false)); - expected.clear(); - - // for prefix matched path - expected.put(new PartialPath("root"), (long) 6); - Assert.assertEquals( +// expected.clear(); +// +// // for prefix matched path +// expected.put(new PartialPath("root"), (long) 6); +// Assert.assertEquals( expected, getMeasurementCountGroupByLevel(schemaRegion, new PartialPath("root"), 0, true)); - expected.clear(); - - expected.put(new PartialPath("root.laptop.d1"), (long) 3); - Assert.assertEquals( - expected, +// expected.clear(); +// +// expected.put(new PartialPath("root.laptop.d1"), (long) 3); +// Assert.assertEquals( +// expected, getMeasurementCountGroupByLevel(schemaRegion, new PartialPath("root.laptop.d1"), 2, true)); - expected.clear(); - } - - @Test - public void testGetDevicesNum() throws Exception { +// expected.clear(); +// } +// +// @Test +// public void testGetDevicesNum() throws Exception { final ISchemaRegion schemaRegion = getSchemaRegion("root.laptop", 0); - +// SchemaRegionTestUtil.createSimpleTimeSeriesByList( - schemaRegion, - Arrays.asList( - "root.laptop.d0", - "root.laptop.d1.s1", - "root.laptop.d1.s2.t1", - "root.laptop.d1.s3", - "root.laptop.d2.s1", - "root.laptop.d2.s2")); - +// schemaRegion, +// Arrays.asList( +// "root.laptop.d0", +// "root.laptop.d1.s1", +// "root.laptop.d1.s2.t1", +// "root.laptop.d1.s3", +// "root.laptop.d2.s1", +// "root.laptop.d2.s2")); +// Assert.assertEquals(4, getDevicesNum(schemaRegion, new PartialPath("root.**"), false)); Assert.assertEquals(1, getDevicesNum(schemaRegion, new PartialPath("root.laptop"), false)); Assert.assertEquals(2, getDevicesNum(schemaRegion, new PartialPath("root.laptop.*"), false)); @@ -739,200 +739,200 @@ public void testGetDevicesNum() throws Exception { Assert.assertEquals(2, getDevicesNum(schemaRegion, new PartialPath("root.laptop.d*"), false)); Assert.assertEquals(2, getDevicesNum(schemaRegion, new PartialPath("root.*.d*"), false)); Assert.assertEquals(1, getDevicesNum(schemaRegion, new PartialPath("root.**.s2"), false)); - - // for prefix matched path +// +// // for prefix matched path Assert.assertEquals(4, getDevicesNum(schemaRegion, new PartialPath("root"), true)); Assert.assertEquals(4, getDevicesNum(schemaRegion, new PartialPath("root.laptop"), true)); Assert.assertEquals(3, getDevicesNum(schemaRegion, new PartialPath("root.laptop.d*"), true)); Assert.assertEquals(1, getDevicesNum(schemaRegion, new PartialPath("root.laptop.d1.*"), true)); - } - - @Test - public void testGetNodesListInGivenLevel() throws Exception { +// } +// +// @Test +// public void testGetNodesListInGivenLevel() throws Exception { final ISchemaRegion schemaRegion = getSchemaRegion("root.laptop", 0); - +// SchemaRegionTestUtil.createSimpleTimeSeriesByList( - schemaRegion, - Arrays.asList( - "root.laptop.d0", - "root.laptop.d1.s1", - "root.laptop.d1.s2.t1", - "root.laptop.d1.s3", - "root.laptop.d2.s1", - "root.laptop.d2.s2")); - - Assert.assertEquals( +// schemaRegion, +// Arrays.asList( +// "root.laptop.d0", +// "root.laptop.d1.s1", +// "root.laptop.d1.s2.t1", +// "root.laptop.d1.s3", +// "root.laptop.d2.s1", +// "root.laptop.d2.s2")); +// +// Assert.assertEquals( new LinkedList<>(Collections.singletonList(new PartialPath("root"))), getNodesListInGivenLevel(schemaRegion, new PartialPath("root.**"), 0, false)); - Assert.assertEquals( +// Assert.assertEquals( new LinkedList<>(Collections.singletonList(new PartialPath("root.laptop"))), getNodesListInGivenLevel(schemaRegion, new PartialPath("root.**"), 1, false)); - Assert.assertEquals( +// Assert.assertEquals( new LinkedList<>(Collections.singletonList(new PartialPath("root.laptop"))), getNodesListInGivenLevel(schemaRegion, new PartialPath("root.laptop"), 1, false)); - Assert.assertEquals( - new HashSet<>( - Arrays.asList( - new PartialPath("root.laptop.d0"), - new PartialPath("root.laptop.d1"), - new PartialPath("root.laptop.d2"))), - new HashSet<>( +// Assert.assertEquals( +// new HashSet<>( +// Arrays.asList( +// new PartialPath("root.laptop.d0"), +// new PartialPath("root.laptop.d1"), +// new PartialPath("root.laptop.d2"))), +// new HashSet<>( getNodesListInGivenLevel(schemaRegion, new PartialPath("root.laptop.**"), 2, false))); - Assert.assertEquals( - new HashSet<>( - Arrays.asList( - new PartialPath("root.laptop.d1.s1"), - new PartialPath("root.laptop.d1.s2"), - new PartialPath("root.laptop.d1.s3"), - new PartialPath("root.laptop.d2.s1"), - new PartialPath("root.laptop.d2.s2"))), - new HashSet<>( +// Assert.assertEquals( +// new HashSet<>( +// Arrays.asList( +// new PartialPath("root.laptop.d1.s1"), +// new PartialPath("root.laptop.d1.s2"), +// new PartialPath("root.laptop.d1.s3"), +// new PartialPath("root.laptop.d2.s1"), +// new PartialPath("root.laptop.d2.s2"))), +// new HashSet<>( getNodesListInGivenLevel(schemaRegion, new PartialPath("root.laptop.**"), 3, false))); - Assert.assertEquals( - new HashSet<>( - Arrays.asList( - new PartialPath("root.laptop.d1.s1"), new PartialPath("root.laptop.d2.s1"))), - new HashSet<>( +// Assert.assertEquals( +// new HashSet<>( +// Arrays.asList( +// new PartialPath("root.laptop.d1.s1"), new PartialPath("root.laptop.d2.s1"))), +// new HashSet<>( getNodesListInGivenLevel(schemaRegion, new PartialPath("root.laptop.*.s1"), 3, false))); - // Empty return - Assert.assertEquals( +// // Empty return +// Assert.assertEquals( new HashSet<>(Collections.emptyList()), - new HashSet<>( +// new HashSet<>( getNodesListInGivenLevel( schemaRegion, new PartialPath("root.laptop.notExists"), 1, false))); - } - - @Test - public void testGetChildNodePathInNextLevel() throws Exception { +// } +// +// @Test +// public void testGetChildNodePathInNextLevel() throws Exception { final ISchemaRegion schemaRegion = getSchemaRegion("root.laptop", 0); - +// SchemaRegionTestUtil.createSimpleTimeSeriesByList( - schemaRegion, - Arrays.asList( - "root.laptop.d0", - "root.laptop.d1.s1", - "root.laptop.d1.s2.t1", - "root.laptop.d1.s3", - "root.laptop.d2.s1", - "root.laptop.d2.s2")); - - Assert.assertEquals( +// schemaRegion, +// Arrays.asList( +// "root.laptop.d0", +// "root.laptop.d1.s1", +// "root.laptop.d1.s2.t1", +// "root.laptop.d1.s3", +// "root.laptop.d2.s1", +// "root.laptop.d2.s2")); +// +// Assert.assertEquals( new HashSet<>(Collections.emptyList()), getChildNodePathInNextLevel(schemaRegion, new PartialPath("root.laptop.d0"))); - - Assert.assertEquals( - new HashSet<>( - Arrays.asList( +// +// Assert.assertEquals( +// new HashSet<>( +// Arrays.asList( new ShowNodesResult("root.laptop.d1.s1", MNodeType.MEASUREMENT), new ShowNodesResult("root.laptop.d1.s2", MNodeType.DEVICE), new ShowNodesResult("root.laptop.d1.s3", MNodeType.MEASUREMENT))), getChildNodePathInNextLevel(schemaRegion, new PartialPath("root.laptop.d1"))); - - Assert.assertEquals( - new HashSet<>( - Arrays.asList( +// +// Assert.assertEquals( +// new HashSet<>( +// Arrays.asList( new ShowNodesResult("root.laptop.d2.s1", MNodeType.MEASUREMENT), new ShowNodesResult("root.laptop.d2.s2", MNodeType.MEASUREMENT))), getChildNodePathInNextLevel(schemaRegion, new PartialPath("root.laptop.d2"))); - - Assert.assertEquals( - new HashSet<>( - Arrays.asList( +// +// Assert.assertEquals( +// new HashSet<>( +// Arrays.asList( new ShowNodesResult("root.laptop.d0", MNodeType.MEASUREMENT), new ShowNodesResult("root.laptop.d1", MNodeType.DEVICE), new ShowNodesResult("root.laptop.d2", MNodeType.DEVICE))), getChildNodePathInNextLevel(schemaRegion, new PartialPath("root.laptop"))); - - Assert.assertEquals( - new HashSet<>( +// +// Assert.assertEquals( +// new HashSet<>( Collections.singletonList( new ShowNodesResult("root.laptop.d1.s2.t1", MNodeType.MEASUREMENT))), getChildNodePathInNextLevel(schemaRegion, new PartialPath("root.**.s2"))); - } - - @Test - public void testGetMatchedDevices() throws Exception { +// } +// +// @Test +// public void testGetMatchedDevices() throws Exception { final ISchemaRegion schemaRegion = getSchemaRegion("root.laptop", 0); - +// SchemaRegionTestUtil.createSimpleTimeSeriesByList( - schemaRegion, - Arrays.asList( - "root.laptop.d0", - "root.laptop.d1.s1", - "root.laptop.d1.s2.t1", - "root.laptop.d1.s3", - "root.laptop.d2.s1", - "root.laptop.d2.s2")); - - // CASE 01. Query a timeseries, result should be empty set. - Assert.assertEquals( +// schemaRegion, +// Arrays.asList( +// "root.laptop.d0", +// "root.laptop.d1.s1", +// "root.laptop.d1.s2.t1", +// "root.laptop.d1.s3", +// "root.laptop.d2.s1", +// "root.laptop.d2.s2")); +// +// // CASE 01. Query a timeseries, result should be empty set. +// Assert.assertEquals( Collections.emptyList(), SchemaRegionTestUtil.getMatchedDevices(schemaRegion, new PartialPath("root.laptop.d0"))); - - // CASE 02. Query an existing device. - Assert.assertEquals( +// +// // CASE 02. Query an existing device. +// Assert.assertEquals( Collections.singletonList(new ShowDevicesResult("root.laptop.d1", false, -1)), SchemaRegionTestUtil.getMatchedDevices(schemaRegion, new PartialPath("root.laptop.d1"))); - Assert.assertEquals( +// Assert.assertEquals( Collections.singletonList(new ShowDevicesResult("root.laptop.d2", false, -1)), SchemaRegionTestUtil.getMatchedDevices(schemaRegion, new PartialPath("root.laptop.d2"))); - - // CASE 03. Query an existing device, which has a sub device - Assert.assertEquals( +// +// // CASE 03. Query an existing device, which has a sub device +// Assert.assertEquals( Collections.singletonList(new ShowDevicesResult("root.laptop", false, -1)), SchemaRegionTestUtil.getMatchedDevices(schemaRegion, new PartialPath("root.laptop"))); - - // CASE 04. Query devices using '*' - Assert.assertEquals( +// +// // CASE 04. Query devices using '*' +// Assert.assertEquals( Collections.singletonList(new ShowDevicesResult("root.laptop", false, -1)), SchemaRegionTestUtil.getMatchedDevices(schemaRegion, new PartialPath("root.*"))); - - // CASE 05. Query all devices using 'root.**' +// +// // CASE 05. Query all devices using 'root.**' List expectedList = - Arrays.asList( +// Arrays.asList( new ShowDevicesResult("root.laptop", false, -1), new ShowDevicesResult("root.laptop.d1", false, -1), new ShowDevicesResult("root.laptop.d2", false, -1), new ShowDevicesResult("root.laptop.d1.s2", false, -1)); List actualResult = SchemaRegionTestUtil.getMatchedDevices(schemaRegion, new PartialPath("root.**")); - // Compare hash sets because the order does not matter. +// // Compare hash sets because the order does not matter. HashSet expectedHashset = new HashSet<>(expectedList); HashSet actualHashset = new HashSet<>(actualResult); - Assert.assertEquals(expectedHashset, actualHashset); - - // CASE 06. show devices root.**.d* - expectedList = - Arrays.asList( +// Assert.assertEquals(expectedHashset, actualHashset); +// +// // CASE 06. show devices root.**.d* +// expectedList = +// Arrays.asList( new ShowDevicesResult("root.laptop.d1", false, -1), new ShowDevicesResult("root.laptop.d2", false, -1)); - actualResult = +// actualResult = SchemaRegionTestUtil.getMatchedDevices(schemaRegion, new PartialPath("root.**.d*")); - // Compare hash sets because the order does not matter. - expectedHashset = new HashSet<>(expectedList); +// // Compare hash sets because the order does not matter. +// expectedHashset = new HashSet<>(expectedList); actualHashset = new HashSet<>(actualResult); - Assert.assertEquals(expectedHashset, actualHashset); - - // CASE 07. show devices root.** limit 3 offset 0 - actualResult = - SchemaRegionTestUtil.getMatchedDevices( +// Assert.assertEquals(expectedHashset, actualHashset); +// +// // CASE 07. show devices root.** limit 3 offset 0 +// actualResult = +// SchemaRegionTestUtil.getMatchedDevices( schemaRegion, new PartialPath("root.**"), 3, 0, false); - Assert.assertEquals(3, actualResult.size()); - // CASE 08. show devices root.** limit 3 offset 1 - actualResult = - SchemaRegionTestUtil.getMatchedDevices( +// Assert.assertEquals(3, actualResult.size()); +// // CASE 08. show devices root.** limit 3 offset 1 +// actualResult = +// SchemaRegionTestUtil.getMatchedDevices( schemaRegion, new PartialPath("root.**"), 3, 1, false); - Assert.assertEquals(3, actualResult.size()); - // CASE 09. show devices root.** limit 3 offset 2 - actualResult = - SchemaRegionTestUtil.getMatchedDevices( +// Assert.assertEquals(3, actualResult.size()); +// // CASE 09. show devices root.** limit 3 offset 2 +// actualResult = +// SchemaRegionTestUtil.getMatchedDevices( schemaRegion, new PartialPath("root.**"), 3, 2, false); - Assert.assertEquals(2, actualResult.size()); - // CASE 10. show devices root.** limit 3 offset 99 - actualResult = - SchemaRegionTestUtil.getMatchedDevices( +// Assert.assertEquals(2, actualResult.size()); +// // CASE 10. show devices root.** limit 3 offset 99 +// actualResult = +// SchemaRegionTestUtil.getMatchedDevices( schemaRegion, new PartialPath("root.**"), 3, 99, false); - Assert.assertEquals(0, actualResult.size()); +// Assert.assertEquals(0, actualResult.size()); // CASE 11. show devices root.** where device contains 'laptop' expectedList = Arrays.asList( @@ -967,58 +967,58 @@ public void testGetMatchedDevices() throws Exception { expectedHashset = new HashSet<>(expectedList); actualHashset = new HashSet<>(actualResult); Assert.assertEquals(expectedHashset, actualHashset); - } - - @Test - public void testShowTimeseries() throws Exception { +// } +// +// @Test +// public void testShowTimeseries() throws Exception { final ISchemaRegion schemaRegion = getSchemaRegion("root.laptop", 0); - +// SchemaRegionTestUtil.createSimpleTimeSeriesByList( - schemaRegion, - Arrays.asList( - "root.laptop.d0", - "root.laptop.d1.s1", - "root.laptop.d1.s2.t1", - "root.laptop.d1.s3", - "root.laptop.d2.s1", - "root.laptop.d2.s2")); - - // CASE 01: all timeseries +// schemaRegion, +// Arrays.asList( +// "root.laptop.d0", +// "root.laptop.d1.s1", +// "root.laptop.d1.s2.t1", +// "root.laptop.d1.s3", +// "root.laptop.d2.s1", +// "root.laptop.d2.s2")); +// +// // CASE 01: all timeseries List result = SchemaRegionTestUtil.showTimeseries(schemaRegion, new PartialPath("root.**")); Set expectedPathList = - new HashSet<>( - Arrays.asList( - "root.laptop.d0", - "root.laptop.d1.s1", - "root.laptop.d1.s2.t1", - "root.laptop.d1.s3", - "root.laptop.d2.s1", - "root.laptop.d2.s2")); - int expectedSize = 6; +// new HashSet<>( +// Arrays.asList( +// "root.laptop.d0", +// "root.laptop.d1.s1", +// "root.laptop.d1.s2.t1", +// "root.laptop.d1.s3", +// "root.laptop.d2.s1", +// "root.laptop.d2.s2")); +// int expectedSize = 6; Assert.assertEquals(expectedSize, result.size()); Set actualPathList = new HashSet<>(); - for (int index = 0; index < expectedSize; index++) { +// for (int index = 0; index < expectedSize; index++) { actualPathList.add(result.get(index).getFullPath()); - } - Assert.assertEquals(expectedPathList, actualPathList); - - // CASE 02: some timeseries, pattern "root.**.s*" +// } +// Assert.assertEquals(expectedPathList, actualPathList); +// +// // CASE 02: some timeseries, pattern "root.**.s*" result = SchemaRegionTestUtil.showTimeseries(schemaRegion, new PartialPath("root.**.s*")); - expectedPathList = - new HashSet<>( - Arrays.asList( - "root.laptop.d1.s1", - "root.laptop.d1.s3", - "root.laptop.d2.s1", - "root.laptop.d2.s2")); - expectedSize = 4; +// expectedPathList = +// new HashSet<>( +// Arrays.asList( +// "root.laptop.d1.s1", +// "root.laptop.d1.s3", +// "root.laptop.d2.s1", +// "root.laptop.d2.s2")); +// expectedSize = 4; Assert.assertEquals(expectedSize, result.size()); - actualPathList = new HashSet<>(); - for (int index = 0; index < expectedSize; index++) { +// actualPathList = new HashSet<>(); +// for (int index = 0; index < expectedSize; index++) { actualPathList.add(result.get(index).getFullPath()); - } - Assert.assertEquals(expectedPathList, actualPathList); +// } +// Assert.assertEquals(expectedPathList, actualPathList); // CASE 03: show timeseries where path contains "s" result = @@ -1148,7 +1148,7 @@ public void testShowTimeseries() throws Exception { actualPathList.add(result.get(index).getFullPath()); } Assert.assertEquals(expectedPathList, actualPathList); - } +// } @Test public void testGetMatchedDevicesWithSpecialPattern() throws Exception { diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/metadata/schemaRegion/SchemaRegionTestUtil.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/metadata/schemaRegion/SchemaRegionTestUtil.java index 4f94de5d95659..81c87c50efc10 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/metadata/schemaRegion/SchemaRegionTestUtil.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/metadata/schemaRegion/SchemaRegionTestUtil.java @@ -133,39 +133,39 @@ public static void createAlignedTimeseries( tags, attributes)); } - - /** - * When testing some interfaces, if you only care about path and do not care the data type or - * compression type and other details, then use this function to create a timeseries quickly. It - * returns a CreateTimeSeriesPlanImpl with data type of INT64, TSEncoding of PLAIN, compression - * type of SNAPPY and without any tags or templates. - */ - public static void createSimpleTimeSeriesInt64(ISchemaRegion schemaRegion, String path) - throws Exception { - SchemaRegionTestUtil.createTimeseries( - schemaRegion, - path, - TSDataType.INT64, - TSEncoding.PLAIN, - CompressionType.SNAPPY, - null, - null, - null, - null); - } - - /** +// +// /** +// * When testing some interfaces, if you only care about path and do not care the data type or +// * compression type and other details, then use this function to create a timeseries quickly. It +// * returns a CreateTimeSeriesPlanImpl with data type of INT64, TSEncoding of PLAIN, compression +// * type of SNAPPY and without any tags or templates. +// */ +// public static void createSimpleTimeSeriesInt64(ISchemaRegion schemaRegion, String path) +// throws Exception { +// SchemaRegionTestUtil.createTimeseries( +// schemaRegion, +// path, +// TSDataType.INT64, +// TSEncoding.PLAIN, +// CompressionType.SNAPPY, +// null, +// null, +// null, +// null); +// } +// +// /** * Create time series quickly using createSimpleTimeSeriesInt64 with given string list of paths. - * +// * * @param schemaRegion schemaRegion which you want to create time series - * @param pathList - */ +// * @param pathList +// */ public static void createSimpleTimeSeriesByList(ISchemaRegion schemaRegion, List pathList) - throws Exception { - for (String path : pathList) { - SchemaRegionTestUtil.createSimpleTimeSeriesInt64(schemaRegion, path); - } - } +// throws Exception { +// for (String path : pathList) { +// SchemaRegionTestUtil.createSimpleTimeSeriesInt64(schemaRegion, path); +// } +// } public static long getAllTimeSeriesCount( ISchemaRegion schemaRegion, diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/metadata/view/ViewExpressionToStringTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/metadata/view/ViewExpressionToStringTest.java index e0b1fe25e6bea..b9adee97d1efd 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/metadata/view/ViewExpressionToStringTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/metadata/view/ViewExpressionToStringTest.java @@ -1,181 +1,181 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iotdb.db.metadata.view; - -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.AdditionViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.MultiplicationViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.leaf.ConstantViewOperand; -import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimeSeriesViewOperand; -import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimestampViewOperand; -import org.apache.iotdb.commons.schema.view.viewExpression.multi.FunctionViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.ternary.BetweenViewExpression; - +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// +// package org.apache.iotdb.db.metadata.view; +// +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.AdditionViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.MultiplicationViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.leaf.ConstantViewOperand; +// import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimeSeriesViewOperand; +// import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimestampViewOperand; +// import org.apache.iotdb.commons.schema.view.viewExpression.multi.FunctionViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.ternary.BetweenViewExpression; +// import org.apache.tsfile.enums.TSDataType; -import org.junit.Assert; -import org.junit.Test; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -public class ViewExpressionToStringTest { - - @Test - public void testTimseriesOperand() { +// import org.junit.Assert; +// import org.junit.Test; +// +// import java.util.ArrayList; +// import java.util.Arrays; +// import java.util.Collections; +// import java.util.List; +// +// public class ViewExpressionToStringTest { +// +// @Test +// public void testTimseriesOperand() { String fullPath = "root.db.device.s01"; - TimeSeriesViewOperand timeSeriesViewOperand = new TimeSeriesViewOperand(fullPath); - Assert.assertEquals(fullPath, timeSeriesViewOperand.toString()); - Assert.assertEquals(fullPath, timeSeriesViewOperand.toString(true)); - Assert.assertEquals(fullPath, timeSeriesViewOperand.toString(false)); - } - - @Test - public void testAdditionViewExpression() { - TimeSeriesViewOperand timeSeriesViewOperand = new TimeSeriesViewOperand("root.db.device.s01"); - ConstantViewOperand constantViewOperand = new ConstantViewOperand(TSDataType.INT32, "2"); - AdditionViewExpression add = - new AdditionViewExpression(timeSeriesViewOperand, constantViewOperand); - +// TimeSeriesViewOperand timeSeriesViewOperand = new TimeSeriesViewOperand(fullPath); +// Assert.assertEquals(fullPath, timeSeriesViewOperand.toString()); +// Assert.assertEquals(fullPath, timeSeriesViewOperand.toString(true)); +// Assert.assertEquals(fullPath, timeSeriesViewOperand.toString(false)); +// } +// +// @Test +// public void testAdditionViewExpression() { +// TimeSeriesViewOperand timeSeriesViewOperand = new TimeSeriesViewOperand("root.db.device.s01"); +// ConstantViewOperand constantViewOperand = new ConstantViewOperand(TSDataType.INT32, "2"); +// AdditionViewExpression add = +// new AdditionViewExpression(timeSeriesViewOperand, constantViewOperand); +// String expectedRoot = "root.db.device.s01 + 2"; String expectedNotRoot = "(root.db.device.s01 + 2)"; - Assert.assertEquals(expectedRoot, add.toString()); - Assert.assertEquals(expectedRoot, add.toString(true)); - Assert.assertEquals(expectedNotRoot, add.toString(false)); - } - - @Test - public void testTwoBinaryExpression() { - TimeSeriesViewOperand ts1 = new TimeSeriesViewOperand("root.db.device.s01"); - ConstantViewOperand constant2 = new ConstantViewOperand(TSDataType.INT32, "2"); - AdditionViewExpression add = new AdditionViewExpression(ts1, constant2); - TimeSeriesViewOperand ts2 = new TimeSeriesViewOperand("root.ln.d.s01"); - MultiplicationViewExpression multiplication = new MultiplicationViewExpression(add, ts2); - +// Assert.assertEquals(expectedRoot, add.toString()); +// Assert.assertEquals(expectedRoot, add.toString(true)); +// Assert.assertEquals(expectedNotRoot, add.toString(false)); +// } +// +// @Test +// public void testTwoBinaryExpression() { +// TimeSeriesViewOperand ts1 = new TimeSeriesViewOperand("root.db.device.s01"); +// ConstantViewOperand constant2 = new ConstantViewOperand(TSDataType.INT32, "2"); +// AdditionViewExpression add = new AdditionViewExpression(ts1, constant2); +// TimeSeriesViewOperand ts2 = new TimeSeriesViewOperand("root.ln.d.s01"); +// MultiplicationViewExpression multiplication = new MultiplicationViewExpression(add, ts2); +// String expectedRoot = "(root.db.device.s01 + 2) * root.ln.d.s01"; String expectedNotRoot = "((root.db.device.s01 + 2) * root.ln.d.s01)"; - Assert.assertEquals(expectedRoot, multiplication.toString()); - Assert.assertEquals(expectedRoot, multiplication.toString(true)); - Assert.assertEquals(expectedNotRoot, multiplication.toString(false)); - } - - @Test - public void testFunctionViewExpression01() { - String functionName = "func"; - FunctionViewExpression func = new FunctionViewExpression(functionName); - +// Assert.assertEquals(expectedRoot, multiplication.toString()); +// Assert.assertEquals(expectedRoot, multiplication.toString(true)); +// Assert.assertEquals(expectedNotRoot, multiplication.toString(false)); +// } +// +// @Test +// public void testFunctionViewExpression01() { +// String functionName = "func"; +// FunctionViewExpression func = new FunctionViewExpression(functionName); +// String expectedRoot = "func()"; String expectedNotRoot = "func()"; - Assert.assertEquals(expectedRoot, func.toString()); - Assert.assertEquals(expectedRoot, func.toString(true)); - Assert.assertEquals(expectedNotRoot, func.toString(false)); - } - - @Test - public void testFunctionViewExpression02() { - String functionName = "MAX"; - List keys = new ArrayList<>(); - List values = new ArrayList<>(); - - TimeSeriesViewOperand ts1 = new TimeSeriesViewOperand("root.db.device.s01"); - ConstantViewOperand constant2 = new ConstantViewOperand(TSDataType.INT32, "2"); - AdditionViewExpression add = new AdditionViewExpression(ts1, constant2); - TimeSeriesViewOperand ts2 = new TimeSeriesViewOperand("root.ln.d.s01"); - List exps = Arrays.asList(add, ts2); - - FunctionViewExpression func = new FunctionViewExpression(functionName, keys, values, exps); - +// Assert.assertEquals(expectedRoot, func.toString()); +// Assert.assertEquals(expectedRoot, func.toString(true)); +// Assert.assertEquals(expectedNotRoot, func.toString(false)); +// } +// +// @Test +// public void testFunctionViewExpression02() { +// String functionName = "MAX"; +// List keys = new ArrayList<>(); +// List values = new ArrayList<>(); +// +// TimeSeriesViewOperand ts1 = new TimeSeriesViewOperand("root.db.device.s01"); +// ConstantViewOperand constant2 = new ConstantViewOperand(TSDataType.INT32, "2"); +// AdditionViewExpression add = new AdditionViewExpression(ts1, constant2); +// TimeSeriesViewOperand ts2 = new TimeSeriesViewOperand("root.ln.d.s01"); +// List exps = Arrays.asList(add, ts2); +// +// FunctionViewExpression func = new FunctionViewExpression(functionName, keys, values, exps); +// String expectedRoot = "MAX(root.db.device.s01 + 2, root.ln.d.s01)"; String expectedNotRoot = "MAX(root.db.device.s01 + 2, root.ln.d.s01)"; - Assert.assertEquals(expectedRoot, func.toString()); - Assert.assertEquals(expectedRoot, func.toString(true)); - Assert.assertEquals(expectedNotRoot, func.toString(false)); - } - - @Test - public void testFunctionViewExpression03() { - String functionName = "CAST"; - List keys = Collections.singletonList("type"); - List values = Collections.singletonList("INT32"); - - TimeSeriesViewOperand ts2 = new TimeSeriesViewOperand("root.ln.d.s01"); - List exps = Collections.singletonList(ts2); - - FunctionViewExpression func = new FunctionViewExpression(functionName, keys, values, exps); - +// Assert.assertEquals(expectedRoot, func.toString()); +// Assert.assertEquals(expectedRoot, func.toString(true)); +// Assert.assertEquals(expectedNotRoot, func.toString(false)); +// } +// +// @Test +// public void testFunctionViewExpression03() { +// String functionName = "CAST"; +// List keys = Collections.singletonList("type"); +// List values = Collections.singletonList("INT32"); +// +// TimeSeriesViewOperand ts2 = new TimeSeriesViewOperand("root.ln.d.s01"); +// List exps = Collections.singletonList(ts2); +// +// FunctionViewExpression func = new FunctionViewExpression(functionName, keys, values, exps); +// String expectedRoot = "CAST(root.ln.d.s01, type=INT32)"; String expectedNotRoot = "CAST(root.ln.d.s01, type=INT32)"; - Assert.assertEquals(expectedRoot, func.toString()); - Assert.assertEquals(expectedRoot, func.toString(true)); - Assert.assertEquals(expectedNotRoot, func.toString(false)); - } - - @Test - public void testFunctionViewExpression04() { - String functionName = "CAST"; - List keys = Collections.singletonList("type"); - List values = Collections.singletonList("INT32"); - - TimeSeriesViewOperand ts2 = new TimeSeriesViewOperand("root.ln.d.s01"); - List exps = Collections.singletonList(ts2); - - FunctionViewExpression func = new FunctionViewExpression(functionName, keys, values, exps); - +// Assert.assertEquals(expectedRoot, func.toString()); +// Assert.assertEquals(expectedRoot, func.toString(true)); +// Assert.assertEquals(expectedNotRoot, func.toString(false)); +// } +// +// @Test +// public void testFunctionViewExpression04() { +// String functionName = "CAST"; +// List keys = Collections.singletonList("type"); +// List values = Collections.singletonList("INT32"); +// +// TimeSeriesViewOperand ts2 = new TimeSeriesViewOperand("root.ln.d.s01"); +// List exps = Collections.singletonList(ts2); +// +// FunctionViewExpression func = new FunctionViewExpression(functionName, keys, values, exps); +// String expectedRoot = "CAST(root.ln.d.s01, type=INT32)"; String expectedNotRoot = "CAST(root.ln.d.s01, type=INT32)"; - Assert.assertEquals(expectedRoot, func.toString()); - Assert.assertEquals(expectedRoot, func.toString(true)); - Assert.assertEquals(expectedNotRoot, func.toString(false)); - } - - @Test - public void testFunctionViewExpression05() { - String functionName = "FUNC"; - List keys = Arrays.asList("type", "key"); - List values = Arrays.asList("INT32", "value"); - - TimeSeriesViewOperand ts1 = new TimeSeriesViewOperand("root.db.device.s01"); - TimeSeriesViewOperand ts2 = new TimeSeriesViewOperand("root.ln.d.s01"); - List exps = Arrays.asList(ts1, ts2); - - FunctionViewExpression func = new FunctionViewExpression(functionName, keys, values, exps); - +// Assert.assertEquals(expectedRoot, func.toString()); +// Assert.assertEquals(expectedRoot, func.toString(true)); +// Assert.assertEquals(expectedNotRoot, func.toString(false)); +// } +// +// @Test +// public void testFunctionViewExpression05() { +// String functionName = "FUNC"; +// List keys = Arrays.asList("type", "key"); +// List values = Arrays.asList("INT32", "value"); +// +// TimeSeriesViewOperand ts1 = new TimeSeriesViewOperand("root.db.device.s01"); +// TimeSeriesViewOperand ts2 = new TimeSeriesViewOperand("root.ln.d.s01"); +// List exps = Arrays.asList(ts1, ts2); +// +// FunctionViewExpression func = new FunctionViewExpression(functionName, keys, values, exps); +// String expectedRoot = "FUNC(root.db.device.s01, root.ln.d.s01, type=INT32, key=value)"; String expectedNotRoot = "FUNC(root.db.device.s01, root.ln.d.s01, type=INT32, key=value)"; - Assert.assertEquals(expectedRoot, func.toString()); - Assert.assertEquals(expectedRoot, func.toString(true)); - Assert.assertEquals(expectedNotRoot, func.toString(false)); - } - - @Test - public void testBetweenViewExpression() { - TimestampViewOperand timestamp01 = new TimestampViewOperand(); - TimestampViewOperand timestamp02 = new TimestampViewOperand(); - TimeSeriesViewOperand ts1 = new TimeSeriesViewOperand("root.db.device.s01"); - BetweenViewExpression exp = new BetweenViewExpression(ts1, timestamp01, timestamp02); - +// Assert.assertEquals(expectedRoot, func.toString()); +// Assert.assertEquals(expectedRoot, func.toString(true)); +// Assert.assertEquals(expectedNotRoot, func.toString(false)); +// } +// +// @Test +// public void testBetweenViewExpression() { +// TimestampViewOperand timestamp01 = new TimestampViewOperand(); +// TimestampViewOperand timestamp02 = new TimestampViewOperand(); +// TimeSeriesViewOperand ts1 = new TimeSeriesViewOperand("root.db.device.s01"); +// BetweenViewExpression exp = new BetweenViewExpression(ts1, timestamp01, timestamp02); +// String expectedRoot = "root.db.device.s01 BETWEEN TIMESTAMP AND TIMESTAMP"; String expectedNotRoot = "(root.db.device.s01 BETWEEN TIMESTAMP AND TIMESTAMP)"; - Assert.assertEquals(expectedRoot, exp.toString()); - Assert.assertEquals(expectedRoot, exp.toString(true)); - Assert.assertEquals(expectedNotRoot, exp.toString(false)); - } -} +// Assert.assertEquals(expectedRoot, exp.toString()); +// Assert.assertEquals(expectedRoot, exp.toString(true)); +// Assert.assertEquals(expectedNotRoot, exp.toString(false)); +// } +// } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/path/MeasurementPath.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/path/MeasurementPath.java index f74a29f1815f4..786448ac8cfb4 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/path/MeasurementPath.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/path/MeasurementPath.java @@ -21,7 +21,7 @@ import org.apache.iotdb.commons.conf.IoTDBConstant; import org.apache.iotdb.commons.exception.IllegalPathException; -import org.apache.iotdb.commons.schema.view.LogicalViewSchema; +// import org.apache.iotdb.commons.schema.view.LogicalViewSchema; import org.apache.tsfile.enums.TSDataType; import org.apache.tsfile.file.metadata.IDeviceID; @@ -39,7 +39,7 @@ import java.io.OutputStream; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; -import java.rmi.UnexpectedException; +// import java.rmi.UnexpectedException; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -59,7 +59,7 @@ public class MeasurementPath extends PartialPath { private Map tagMap; - private Boolean isUnderAlignedEntity = false; +// private Boolean isUnderAlignedEntity = false; // alias of measurement, null pointer cannot be serialized in thrift so empty string is instead private String measurementAlias = ""; @@ -92,7 +92,7 @@ public MeasurementPath(PartialPath measurementPath, IMeasurementSchema measureme public MeasurementPath( PartialPath measurementPath, IMeasurementSchema measurementSchema, - Boolean isUnderAlignedEntity) { +// Boolean isUnderAlignedEntity) { super(measurementPath.getNodes()); if (nodes.length < 2) { throw new IllegalArgumentException(String.format(NODES_LENGTH_ERROR, Arrays.toString(nodes))); @@ -127,7 +127,7 @@ public MeasurementPath(String device, String measurement, IMeasurementSchema mea this.measurementSchema = measurementSchema; } - public MeasurementPath(String[] nodes, IMeasurementSchema schema) { +// public MeasurementPath(String[] nodes, IMeasurementSchema schema) { super(nodes); if (nodes.length < 2) { throw new IllegalArgumentException(String.format(NODES_LENGTH_ERROR, Arrays.toString(nodes))); @@ -203,9 +203,9 @@ public String getFullPathWithAlias() { } public boolean isUnderAlignedEntity() { - if (isUnderAlignedEntity == null) { - return false; - } +// if (isUnderAlignedEntity == null) { +// return false; +// } return isUnderAlignedEntity; } @@ -213,7 +213,7 @@ public void setDevice(IDeviceID device) { this.device = device; } - public void setUnderAlignedEntity(Boolean underAlignedEntity) { +// public void setUnderAlignedEntity(Boolean underAlignedEntity) { isUnderAlignedEntity = underAlignedEntity; } @@ -266,9 +266,9 @@ public void serialize(ByteBuffer byteBuffer) { ReadWriteIOUtils.write((byte) 0, byteBuffer); } else { ReadWriteIOUtils.write((byte) 1, byteBuffer); - MeasurementSchemaType measurementSchemaType = measurementSchema.getSchemaType(); - ReadWriteIOUtils.write( - measurementSchemaType.getMeasurementSchemaTypeInByteEnum(), byteBuffer); +// MeasurementSchemaType measurementSchemaType = measurementSchema.getSchemaType(); +// ReadWriteIOUtils.write( +// measurementSchemaType.getMeasurementSchemaTypeInByteEnum(), byteBuffer); measurementSchema.serializeTo(byteBuffer); } if (tagMap == null) { @@ -289,8 +289,8 @@ public void serialize(OutputStream stream) throws IOException { ReadWriteIOUtils.write((byte) 0, stream); } else { ReadWriteIOUtils.write((byte) 1, stream); - MeasurementSchemaType measurementSchemaType = measurementSchema.getSchemaType(); - ReadWriteIOUtils.write(measurementSchemaType.getMeasurementSchemaTypeInByteEnum(), stream); +// MeasurementSchemaType measurementSchemaType = measurementSchema.getSchemaType(); +// ReadWriteIOUtils.write(measurementSchemaType.getMeasurementSchemaTypeInByteEnum(), stream); measurementSchema.serializeTo(stream); } if (tagMap == null) { @@ -309,24 +309,24 @@ public static MeasurementPath deserialize(ByteBuffer byteBuffer) { byte isNull = ReadWriteIOUtils.readByte(byteBuffer); if (isNull == 1) { byte type = ReadWriteIOUtils.readByte(byteBuffer); - if (type == MeasurementSchemaType.MEASUREMENT_SCHEMA.getMeasurementSchemaTypeInByteEnum()) { +// if (type == MeasurementSchemaType.MEASUREMENT_SCHEMA.getMeasurementSchemaTypeInByteEnum()) { measurementPath.measurementSchema = MeasurementSchema.deserializeFrom(byteBuffer); - } else if (type - == MeasurementSchemaType.VECTOR_MEASUREMENT_SCHEMA.getMeasurementSchemaTypeInByteEnum()) { +// } else if (type +// == MeasurementSchemaType.VECTOR_MEASUREMENT_SCHEMA.getMeasurementSchemaTypeInByteEnum()) { measurementPath.measurementSchema = VectorMeasurementSchema.deserializeFrom(byteBuffer); - } else if (type - == MeasurementSchemaType.LOGICAL_VIEW_SCHEMA.getMeasurementSchemaTypeInByteEnum()) { - measurementPath.measurementSchema = LogicalViewSchema.deserializeFrom(byteBuffer); - } else { - throw new RuntimeException( - new UnexpectedException("Type (" + type + ") of measurementSchema is unknown.")); +// } else if (type +// == MeasurementSchemaType.LOGICAL_VIEW_SCHEMA.getMeasurementSchemaTypeInByteEnum()) { +// measurementPath.measurementSchema = LogicalViewSchema.deserializeFrom(byteBuffer); +// } else { +// throw new RuntimeException( +// new UnexpectedException("Type (" + type + ") of measurementSchema is unknown.")); } } isNull = ReadWriteIOUtils.readByte(byteBuffer); if (isNull == 1) { measurementPath.tagMap = ReadWriteIOUtils.readMap(byteBuffer); } - measurementPath.isUnderAlignedEntity = ReadWriteIOUtils.readBoolObject(byteBuffer); +// measurementPath.isUnderAlignedEntity = ReadWriteIOUtils.readBoolObject(byteBuffer); measurementPath.measurementAlias = ReadWriteIOUtils.readString(byteBuffer); measurementPath.nodes = partialPath.getNodes(); measurementPath.device = measurementPath.getIDeviceID(); diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/SchemaConstant.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/SchemaConstant.java index 2edece1c76d1e..39e5626ec5c5e 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/SchemaConstant.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/SchemaConstant.java @@ -96,8 +96,8 @@ private SchemaConstant() { public static final byte ENTITY_MNODE_TYPE = 3; public static final byte STORAGE_GROUP_ENTITY_MNODE_TYPE = 4; - public static final byte LOGICAL_VIEW_MNODE_TYPE = 5; - +// public static final byte LOGICAL_VIEW_MNODE_TYPE = 5; +// public static final byte TABLE_MNODE_TYPE = 6; public static final String INTERNAL_MNODE_TYPE_NAME = "InternalMNode"; @@ -106,8 +106,8 @@ private SchemaConstant() { public static final String ENTITY_MNODE_TYPE_NAME = "EntityMNode"; public static final String STORAGE_GROUP_ENTITY_MNODE_TYPE_NAME = "StorageGroupEntityMNode"; - public static final String LOGICAL_VIEW_MNODE_TYPE_NAME = "LogicalViewMNode"; - +// public static final String LOGICAL_VIEW_MNODE_TYPE_NAME = "LogicalViewMNode"; +// public static final String TABLE_MNODE_TYPE_NAME = "TableMNode"; public static final String SCHEMA_REGION_METRIC_NAME = "schema_region"; @@ -128,8 +128,8 @@ public static String getMNodeTypeName(byte type) { return ENTITY_MNODE_TYPE_NAME; case STORAGE_GROUP_ENTITY_MNODE_TYPE: return STORAGE_GROUP_ENTITY_MNODE_TYPE_NAME; - case LOGICAL_VIEW_MNODE_TYPE: - return LOGICAL_VIEW_MNODE_TYPE_NAME; +// case LOGICAL_VIEW_MNODE_TYPE: +// return LOGICAL_VIEW_MNODE_TYPE_NAME; case TABLE_MNODE_TYPE: return TABLE_MNODE_TYPE_NAME; default: diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/column/ColumnHeaderConstant.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/column/ColumnHeaderConstant.java index 30997db31e1e2..323f9e0e64406 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/column/ColumnHeaderConstant.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/column/ColumnHeaderConstant.java @@ -287,10 +287,10 @@ private ColumnHeaderConstant() { // column names for show models/trials public static final String MODEL_ID = "ModelId"; - // column names for views (e.g. logical view) - public static final String VIEW_TYPE = "ViewType"; +// // column names for views (e.g. logical view) +// public static final String VIEW_TYPE = "ViewType"; public static final String SOURCE = "Source"; - +// // column names for show current timestamp public static final String CURRENT_TIMESTAMP = "CurrentTimestamp"; @@ -342,8 +342,8 @@ private ColumnHeaderConstant() { new ColumnHeader(TAGS, TSDataType.TEXT), new ColumnHeader(ATTRIBUTES, TSDataType.TEXT), new ColumnHeader(DEADBAND, TSDataType.TEXT), - new ColumnHeader(DEADBAND_PARAMETERS, TSDataType.TEXT), - new ColumnHeader(VIEW_TYPE, TSDataType.TEXT)); +// new ColumnHeader(DEADBAND_PARAMETERS, TSDataType.TEXT), +// new ColumnHeader(VIEW_TYPE, TSDataType.TEXT)); public static final List showDevicesWithSgColumnHeaders = ImmutableList.of( diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/node/common/AbstractMeasurementMNode.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/node/common/AbstractMeasurementMNode.java index 01cd77714acb0..0b724f72ed8c4 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/node/common/AbstractMeasurementMNode.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/node/common/AbstractMeasurementMNode.java @@ -83,7 +83,7 @@ public void setParent(N parent) { @Override public MeasurementPath getMeasurementPath() { MeasurementPath result = new MeasurementPath(getPartialPath(), getSchema()); - result.setUnderAlignedEntity(getParent().getAsDeviceMNode().isAlignedNullable()); +// result.setUnderAlignedEntity(getParent().getAsDeviceMNode().isAlignedNullable()); return result; } @@ -248,8 +248,8 @@ public IMeasurementMNode getAsMeasurementMNode() { public int estimateSize() { return 8 + 8 + measurementInfo.estimateSize() + basicMNode.estimateSize(); } - - protected IMeasurementInfo getMeasurementInfo() { - return this.measurementInfo; - } +// +// protected IMeasurementInfo getMeasurementInfo() { +// return this.measurementInfo; +// } } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/node/common/DeviceMNodeWrapper.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/node/common/DeviceMNodeWrapper.java index 5c564a6fb2652..494c7f96b1206 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/node/common/DeviceMNodeWrapper.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/node/common/DeviceMNodeWrapper.java @@ -235,19 +235,19 @@ public void deactivateTemplate() { @Override public boolean isAligned() { Boolean align = basicMNode.getDeviceInfo().isAligned(); - if (align == null) { - return false; - } - return align; - } - - @Override - public Boolean isAlignedNullable() { +// if (align == null) { +// return false; +// } +// return align; +// } +// +// @Override +// public Boolean isAlignedNullable() { return basicMNode.getDeviceInfo().isAligned(); } @Override - public void setAligned(Boolean isAligned) { +// public void setAligned(Boolean isAligned) { basicMNode.getDeviceInfo().setAligned(isAligned); } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/node/info/IDeviceInfo.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/node/info/IDeviceInfo.java index d11acc9953e46..4f597ac77dc11 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/node/info/IDeviceInfo.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/node/info/IDeviceInfo.java @@ -64,9 +64,9 @@ public interface IDeviceInfo> { void deactivateTemplate(); - Boolean isAligned(); +// Boolean isAligned(); - void setAligned(Boolean isAligned); +// void setAligned(Boolean isAligned); int estimateSize(); } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/node/role/IDeviceMNode.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/node/role/IDeviceMNode.java index 99948a0986153..58076976acc86 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/node/role/IDeviceMNode.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/node/role/IDeviceMNode.java @@ -57,7 +57,7 @@ public interface IDeviceMNode> extends IInternalMNode { boolean isAligned(); - Boolean isAlignedNullable(); - - void setAligned(Boolean isAligned); +// Boolean isAlignedNullable(); +// +// void setAligned(Boolean isAligned); } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/node/role/IMeasurementMNode.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/node/role/IMeasurementMNode.java index 84e7e157fb895..9954eb7c529b9 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/node/role/IMeasurementMNode.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/node/role/IMeasurementMNode.java @@ -46,6 +46,6 @@ public interface IMeasurementMNode> extends IMNode { void setPreDeleted(boolean preDeleted); MeasurementPath getMeasurementPath(); - +// boolean isLogicalView(); } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/node/utils/IMNodeFactory.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/node/utils/IMNodeFactory.java index 93ca7406d9b7e..2575be282f6b5 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/node/utils/IMNodeFactory.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/node/utils/IMNodeFactory.java @@ -39,7 +39,7 @@ IMeasurementMNode createMeasurementMNode( N createAboveDatabaseMNode(N parent, String name); N createInternalMNode(N parent, String name); - - IMeasurementMNode createLogicalViewMNode( +// +// IMeasurementMNode createLogicalViewMNode( IDeviceMNode parent, String name, IMeasurementSchema measurementSchema); } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/LogicalViewSchema.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/LogicalViewSchema.java index 984d07d06b2b8..0f57507e16abb 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/LogicalViewSchema.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/LogicalViewSchema.java @@ -1,30 +1,30 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iotdb.commons.schema.view; - -import org.apache.iotdb.commons.exception.IllegalPathException; -import org.apache.iotdb.commons.exception.MetadataException; +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// +// package org.apache.iotdb.commons.schema.view; +// +// import org.apache.iotdb.commons.exception.IllegalPathException; +// import org.apache.iotdb.commons.exception.MetadataException; import org.apache.iotdb.commons.path.MeasurementPath; -import org.apache.iotdb.commons.path.PartialPath; -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimeSeriesViewOperand; +// import org.apache.iotdb.commons.path.PartialPath; +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimeSeriesViewOperand; import org.apache.tsfile.encoding.encoder.Encoder; import org.apache.tsfile.enums.TSDataType; @@ -35,234 +35,234 @@ import org.apache.tsfile.utils.ReadWriteIOUtils; import org.apache.tsfile.write.schema.IMeasurementSchema; import org.apache.tsfile.write.schema.MeasurementSchemaType; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.Serializable; -import java.nio.ByteBuffer; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class LogicalViewSchema +// +// import java.io.IOException; +// import java.io.InputStream; +// import java.io.OutputStream; +// import java.io.Serializable; +// import java.nio.ByteBuffer; +// import java.util.HashMap; +// import java.util.List; +// import java.util.Map; +// +// public class LogicalViewSchema implements IMeasurementSchema, Comparable, Serializable, Accountable { private static final long INSTANCE_SIZE = RamUsageEstimator.shallowSizeOfInstance(LogicalViewSchema.class); - +// private String measurementName; - - private ViewExpression expression; - +// +// private ViewExpression expression; +// private TSDataType dataType = TSDataType.UNKNOWN; - public LogicalViewSchema(String measurementId, ViewExpression expression) { +// public LogicalViewSchema(String measurementId, ViewExpression expression) { this.measurementName = measurementId; - this.expression = expression; - } - - @Override - public int compareTo(LogicalViewSchema o) { - if (equals(o)) { - return 0; - } else { +// this.expression = expression; +// } +// +// @Override +// public int compareTo(LogicalViewSchema o) { +// if (equals(o)) { +// return 0; +// } else { return this.measurementName.compareTo(o.measurementName); - } - } - - @Override - public MeasurementSchemaType getSchemaType() { - return MeasurementSchemaType.LOGICAL_VIEW_SCHEMA; - } - - @Override +// } +// } +// +// @Override +// public MeasurementSchemaType getSchemaType() { +// return MeasurementSchemaType.LOGICAL_VIEW_SCHEMA; +// } +// +// @Override public String getMeasurementName() { return this.measurementName; - } - - @Override - public CompressionType getCompressor() { - // TODO: CRTODO:add new CompressionType - return CompressionType.UNCOMPRESSED; - } - - @Override - public TSEncoding getEncodingType() { - // TODO: CRTODO: add new TSEncoding - return TSEncoding.PLAIN; - } - - @Override - public TSDataType getType() { +// } +// +// @Override +// public CompressionType getCompressor() { +// // TODO: CRTODO:add new CompressionType +// return CompressionType.UNCOMPRESSED; +// } +// +// @Override +// public TSEncoding getEncodingType() { +// // TODO: CRTODO: add new TSEncoding +// return TSEncoding.PLAIN; +// } +// +// @Override +// public TSDataType getType() { return dataType; - } - - @Override - public byte getTypeInByte() { - return TSDataType.BOOLEAN.getType(); - } - - @Override +// } +// +// @Override +// public byte getTypeInByte() { +// return TSDataType.BOOLEAN.getType(); +// } +// +// @Override public void setDataType(TSDataType dataType) { this.dataType = dataType; - } - - @Override - public TSEncoding getTimeTSEncoding() { - // TODO: CRTODO: add new TSEncoding - return TSEncoding.PLAIN; - } - - @Override - public Encoder getTimeEncoder() { - // TODO: CRTODO: is this ok to return a null value? - return null; - } - - @Override - public Encoder getValueEncoder() { - // TODO: CRTODO: is this ok to return a null value? - return null; - } - - @Override - public Map getProps() { - return new HashMap<>(); - } - - @Override - public List getSubMeasurementsList() { - throw new UnsupportedOperationException("unsupported method for LogicalViewSchema"); - } - - @Override - public List getSubMeasurementsTSDataTypeList() { - throw new UnsupportedOperationException("unsupported method for LogicalViewSchema"); - } - - @Override - public List getSubMeasurementsTSEncodingList() { - throw new UnsupportedOperationException("unsupported method for LogicalViewSchema"); - } - - @Override - public List getSubMeasurementsEncoderList() { - throw new UnsupportedOperationException("unsupported method for LogicalViewSchema"); - } - - @Override - public int getSubMeasurementIndex(String measurementId) { +// } +// +// @Override +// public TSEncoding getTimeTSEncoding() { +// // TODO: CRTODO: add new TSEncoding +// return TSEncoding.PLAIN; +// } +// +// @Override +// public Encoder getTimeEncoder() { +// // TODO: CRTODO: is this ok to return a null value? +// return null; +// } +// +// @Override +// public Encoder getValueEncoder() { +// // TODO: CRTODO: is this ok to return a null value? +// return null; +// } +// +// @Override +// public Map getProps() { +// return new HashMap<>(); +// } +// +// @Override +// public List getSubMeasurementsList() { +// throw new UnsupportedOperationException("unsupported method for LogicalViewSchema"); +// } +// +// @Override +// public List getSubMeasurementsTSDataTypeList() { +// throw new UnsupportedOperationException("unsupported method for LogicalViewSchema"); +// } +// +// @Override +// public List getSubMeasurementsTSEncodingList() { +// throw new UnsupportedOperationException("unsupported method for LogicalViewSchema"); +// } +// +// @Override +// public List getSubMeasurementsEncoderList() { +// throw new UnsupportedOperationException("unsupported method for LogicalViewSchema"); +// } +// +// @Override +// public int getSubMeasurementIndex(String measurementId) { return this.measurementName.equals(measurementId) ? 0 : -1; - } - - @Override - public int getSubMeasurementsCount() { - return 1; - } - - @Override - public boolean containsSubMeasurement(String measurementId) { +// } +// +// @Override +// public int getSubMeasurementsCount() { +// return 1; +// } +// +// @Override +// public boolean containsSubMeasurement(String measurementId) { return this.measurementName.equals(measurementId); - } - - // region serialize and deserialize - - @Override - public int serializedSize() { - throw new RuntimeException( - new UnsupportedOperationException( +// } +// +// // region serialize and deserialize +// +// @Override +// public int serializedSize() { +// throw new RuntimeException( +// new UnsupportedOperationException( "Can not calculate the size of view schemaengine before serializing.")); - } - - @Override - public int serializeTo(ByteBuffer buffer) { - // TODO: CRTODO: the size of buffer is not calculated! +// } +// +// @Override +// public int serializeTo(ByteBuffer buffer) { +// // TODO: CRTODO: the size of buffer is not calculated! ReadWriteIOUtils.write(measurementName, buffer); - - ViewExpression.serialize(this.expression, buffer); - return 0; - } - - @Override - public int serializeTo(OutputStream outputStream) throws IOException { - // TODO: CRTODO: the size of buffer is not calculated! +// +// ViewExpression.serialize(this.expression, buffer); +// return 0; +// } +// +// @Override +// public int serializeTo(OutputStream outputStream) throws IOException { +// // TODO: CRTODO: the size of buffer is not calculated! ReadWriteIOUtils.write(measurementName, outputStream); - - ViewExpression.serialize(this.expression, outputStream); - return 0; - } - - @Override - public int partialSerializeTo(ByteBuffer buffer) { - return this.serializeTo(buffer); - } - - @Override - public int partialSerializeTo(OutputStream outputStream) throws IOException { - return this.serializeTo(outputStream); - } - - @Override - public boolean isLogicalView() { - return true; - } - - public static LogicalViewSchema deserializeFrom(InputStream inputStream) throws IOException { - String measurementId = ReadWriteIOUtils.readString(inputStream); - - ViewExpression expression = ViewExpression.deserialize(inputStream); - - return new LogicalViewSchema(measurementId, expression); - } - - public static LogicalViewSchema deserializeFrom(ByteBuffer buffer) { - String measurementId = ReadWriteIOUtils.readString(buffer); - - ViewExpression expression = ViewExpression.deserialize(buffer); - - return new LogicalViewSchema(measurementId, expression); - } - - // endregion - - public ViewExpression getExpression() { - return this.expression; - } - - public void setExpression(ViewExpression expression) { - this.expression = expression; - } - - public boolean isWritable() { - return this.expression instanceof TimeSeriesViewOperand; - } - - public String getSourcePathStringIfWritable() { - if (this.isWritable()) { - return ((TimeSeriesViewOperand) this.expression).getPathString(); - } - return null; - } - - public PartialPath getSourcePathIfWritable() { - if (this.isWritable()) { - try { +// +// ViewExpression.serialize(this.expression, outputStream); +// return 0; +// } +// +// @Override +// public int partialSerializeTo(ByteBuffer buffer) { +// return this.serializeTo(buffer); +// } +// +// @Override +// public int partialSerializeTo(OutputStream outputStream) throws IOException { +// return this.serializeTo(outputStream); +// } +// +// @Override +// public boolean isLogicalView() { +// return true; +// } +// +// public static LogicalViewSchema deserializeFrom(InputStream inputStream) throws IOException { +// String measurementId = ReadWriteIOUtils.readString(inputStream); +// +// ViewExpression expression = ViewExpression.deserialize(inputStream); +// +// return new LogicalViewSchema(measurementId, expression); +// } +// +// public static LogicalViewSchema deserializeFrom(ByteBuffer buffer) { +// String measurementId = ReadWriteIOUtils.readString(buffer); +// +// ViewExpression expression = ViewExpression.deserialize(buffer); +// +// return new LogicalViewSchema(measurementId, expression); +// } +// +// // endregion +// +// public ViewExpression getExpression() { +// return this.expression; +// } +// +// public void setExpression(ViewExpression expression) { +// this.expression = expression; +// } +// +// public boolean isWritable() { +// return this.expression instanceof TimeSeriesViewOperand; +// } +// +// public String getSourcePathStringIfWritable() { +// if (this.isWritable()) { +// return ((TimeSeriesViewOperand) this.expression).getPathString(); +// } +// return null; +// } +// +// public PartialPath getSourcePathIfWritable() { +// if (this.isWritable()) { +// try { return new MeasurementPath(((TimeSeriesViewOperand) this.expression).getPathString()); - } catch (IllegalPathException e) { - throw new RuntimeException( - new MetadataException( - String.format( - "View with measurementID [%s] is broken. It stores illegal path [%s].", +// } catch (IllegalPathException e) { +// throw new RuntimeException( +// new MetadataException( +// String.format( +// "View with measurementID [%s] is broken. It stores illegal path [%s].", this.measurementName, this.getSourcePathStringIfWritable()))); - } - } - return null; - } +// } +// } +// return null; +// } @Override public long ramBytesUsed() { // Roughly estimate the expression size return INSTANCE_SIZE + RamUsageEstimator.sizeOf(measurementName) + 256; } -} +// } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/ViewExpression.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/ViewExpression.java index d9953767b7669..081ccc6058d60 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/ViewExpression.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/ViewExpression.java @@ -1,130 +1,130 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iotdb.commons.schema.view.viewExpression; - -import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.AdditionViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.DivisionViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.ModuloViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.MultiplicationViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.SubtractionViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.EqualToViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.GreaterEqualViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.GreaterThanViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.LessEqualViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.LessThanViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.NonEqualViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.logic.LogicAndViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.logic.LogicOrViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.leaf.ConstantViewOperand; -import org.apache.iotdb.commons.schema.view.viewExpression.leaf.NullViewOperand; -import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimeSeriesViewOperand; -import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimestampViewOperand; -import org.apache.iotdb.commons.schema.view.viewExpression.multi.FunctionViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.ternary.BetweenViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.unary.InViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.unary.IsNullViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.unary.LikeViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.unary.LogicNotViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.unary.NegationViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.unary.RegularViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// +// package org.apache.iotdb.commons.schema.view.viewExpression; +// +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.AdditionViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.DivisionViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.ModuloViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.MultiplicationViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.SubtractionViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.EqualToViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.GreaterEqualViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.GreaterThanViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.LessEqualViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.LessThanViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.NonEqualViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.logic.LogicAndViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.logic.LogicOrViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.leaf.ConstantViewOperand; +// import org.apache.iotdb.commons.schema.view.viewExpression.leaf.NullViewOperand; +// import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimeSeriesViewOperand; +// import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimestampViewOperand; +// import org.apache.iotdb.commons.schema.view.viewExpression.multi.FunctionViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.ternary.BetweenViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.unary.InViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.unary.IsNullViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.unary.LikeViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.unary.LogicNotViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.unary.NegationViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.unary.RegularViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; import org.apache.tsfile.utils.ReadWriteIOUtils; - +// import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.nio.ByteBuffer; -import java.util.List; - -/** - * This is a class designed for views, such as logical views. The view expression is a simple sketch - * of an expression. A view expression stores less information, that make it easier to store and - * serialize. - * - *

A view expression has to be transformed into expression in same type before analyzing. Also, - * an expression should be transformed into view expression before storage in views. - */ -public abstract class ViewExpression { - +// import java.io.IOException; +// import java.io.InputStream; +// import java.io.OutputStream; +// import java.nio.ByteBuffer; +// import java.util.List; +// +// /** +// * This is a class designed for views, such as logical views. The view expression is a simple sketch +// * of an expression. A view expression stores less information, that make it easier to store and +// * serialize. +// * +// *

A view expression has to be transformed into expression in same type before analyzing. Also, +// * an expression should be transformed into view expression before storage in views. +// */ +// public abstract class ViewExpression { +// protected int serSize = -1; - public R accept(ViewExpressionVisitor visitor, C context) { - return visitor.visitExpression(this, context); - } - - public abstract ViewExpressionType getExpressionType(); - +// public R accept(ViewExpressionVisitor visitor, C context) { +// return visitor.visitExpression(this, context); +// } +// +// public abstract ViewExpressionType getExpressionType(); +// /** * @return if this view expression is a leaf node, return true; else return false. */ - public final boolean isLeafOperand() { - return isLeafOperandInternal(); - } - - protected abstract boolean isLeafOperandInternal(); - - /** - * @return return the DIRECT children view expressions if it has any, otherwise an EMPTY list will - * be returned - */ - public abstract List getChildViewExpressions(); - - /** - * @return if this view expression could be a source for an ALIAS series (one kind of view), - * return true; else return false. Foe example, a SINGLE TimeSeriesOperand could be a source - * for an alias view. - */ - public final boolean isSourceForAliasSeries() { - if (this.getExpressionType().getExpressionTypeInShortEnum() - == ViewExpressionType.TIMESERIES.getExpressionTypeInShortEnum()) { - return true; - } - return false; - } - - public String toString() { - return this.toString(true); - } - - public abstract String toString(boolean isRoot); - - // region methods for serializing and deserializing - protected abstract void serialize(ByteBuffer byteBuffer); - - protected abstract void serialize(OutputStream stream) throws IOException; - - public static void serialize(ViewExpression expression, ByteBuffer byteBuffer) { - ReadWriteIOUtils.write( - expression.getExpressionType().getExpressionTypeInShortEnum(), byteBuffer); - - expression.serialize(byteBuffer); - } - - public static void serialize(ViewExpression expression, OutputStream stream) throws IOException { - ReadWriteIOUtils.write(expression.getExpressionType().getExpressionTypeInShortEnum(), stream); - - expression.serialize(stream); - } - +// public final boolean isLeafOperand() { +// return isLeafOperandInternal(); +// } +// +// protected abstract boolean isLeafOperandInternal(); +// +// /** +// * @return return the DIRECT children view expressions if it has any, otherwise an EMPTY list will +// * be returned +// */ +// public abstract List getChildViewExpressions(); +// +// /** +// * @return if this view expression could be a source for an ALIAS series (one kind of view), +// * return true; else return false. Foe example, a SINGLE TimeSeriesOperand could be a source +// * for an alias view. +// */ +// public final boolean isSourceForAliasSeries() { +// if (this.getExpressionType().getExpressionTypeInShortEnum() +// == ViewExpressionType.TIMESERIES.getExpressionTypeInShortEnum()) { +// return true; +// } +// return false; +// } +// +// public String toString() { +// return this.toString(true); +// } +// +// public abstract String toString(boolean isRoot); +// +// // region methods for serializing and deserializing +// protected abstract void serialize(ByteBuffer byteBuffer); +// +// protected abstract void serialize(OutputStream stream) throws IOException; +// +// public static void serialize(ViewExpression expression, ByteBuffer byteBuffer) { +// ReadWriteIOUtils.write( +// expression.getExpressionType().getExpressionTypeInShortEnum(), byteBuffer); +// +// expression.serialize(byteBuffer); +// } +// +// public static void serialize(ViewExpression expression, OutputStream stream) throws IOException { +// ReadWriteIOUtils.write(expression.getExpressionType().getExpressionTypeInShortEnum(), stream); +// +// expression.serialize(stream); +// } +// public static int getSerializeSize(ViewExpression expression) { if (expression.serSize == -1) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); @@ -140,202 +140,202 @@ public static int getSerializeSize(ViewExpression expression) { return expression.serSize; } - public static ViewExpression deserialize(ByteBuffer byteBuffer) { - short type = ReadWriteIOUtils.readShort(byteBuffer); - - ViewExpression expression; - switch (type) { - case -4: - expression = new ConstantViewOperand(byteBuffer); - break; - case -3: - expression = new TimestampViewOperand(byteBuffer); - break; - case -2: - expression = new TimeSeriesViewOperand(byteBuffer); - break; - case -1: - expression = new FunctionViewExpression(byteBuffer); - break; - - case 0: - expression = new NegationViewExpression(byteBuffer); - break; - case 1: - expression = new LogicNotViewExpression(byteBuffer); - break; - - case 2: - expression = new MultiplicationViewExpression(byteBuffer); - break; - case 3: - expression = new DivisionViewExpression(byteBuffer); - break; - case 4: - expression = new ModuloViewExpression(byteBuffer); - break; - - case 5: - expression = new AdditionViewExpression(byteBuffer); - break; - case 6: - expression = new SubtractionViewExpression(byteBuffer); - break; - - case 7: - expression = new EqualToViewExpression(byteBuffer); - break; - case 8: - expression = new NonEqualViewExpression(byteBuffer); - break; - case 9: - expression = new GreaterEqualViewExpression(byteBuffer); - break; - case 10: - expression = new GreaterThanViewExpression(byteBuffer); - break; - case 11: - expression = new LessEqualViewExpression(byteBuffer); - break; - case 12: - expression = new LessThanViewExpression(byteBuffer); - break; - - case 13: - expression = new LikeViewExpression(byteBuffer); - break; - case 14: - expression = new RegularViewExpression(byteBuffer); - break; - - case 15: - expression = new IsNullViewExpression(byteBuffer); - break; - - case 16: - expression = new BetweenViewExpression(byteBuffer); - break; - - case 17: - expression = new InViewExpression(byteBuffer); - break; - - case 18: - expression = new LogicAndViewExpression(byteBuffer); - break; - - case 19: - expression = new LogicOrViewExpression(byteBuffer); - break; - - case 20: - expression = new NullViewOperand(); - break; - default: - throw new IllegalArgumentException("Invalid viewExpression type: " + type); - } - return expression; - } - - public static ViewExpression deserialize(InputStream inputStream) { - try { - short type = ReadWriteIOUtils.readShort(inputStream); - - ViewExpression expression; - switch (type) { - case -4: - expression = new ConstantViewOperand(inputStream); - break; - case -3: - expression = new TimestampViewOperand(inputStream); - break; - case -2: - expression = new TimeSeriesViewOperand(inputStream); - break; - case -1: - expression = new FunctionViewExpression(inputStream); - break; - - case 0: - expression = new NegationViewExpression(inputStream); - break; - case 1: - expression = new LogicNotViewExpression(inputStream); - break; - - case 2: - expression = new MultiplicationViewExpression(inputStream); - break; - case 3: - expression = new DivisionViewExpression(inputStream); - break; - case 4: - expression = new ModuloViewExpression(inputStream); - break; - - case 5: - expression = new AdditionViewExpression(inputStream); - break; - case 6: - expression = new SubtractionViewExpression(inputStream); - break; - - case 7: - expression = new EqualToViewExpression(inputStream); - break; - case 8: - expression = new NonEqualViewExpression(inputStream); - break; - case 9: - expression = new GreaterEqualViewExpression(inputStream); - break; - case 10: - expression = new GreaterThanViewExpression(inputStream); - break; - case 11: - expression = new LessEqualViewExpression(inputStream); - break; - case 12: - expression = new LessThanViewExpression(inputStream); - break; - - case 13: - expression = new LikeViewExpression(inputStream); - break; - case 14: - expression = new RegularViewExpression(inputStream); - break; - - case 15: - expression = new IsNullViewExpression(inputStream); - break; - - case 16: - expression = new BetweenViewExpression(inputStream); - break; - - case 17: - expression = new InViewExpression(inputStream); - break; - - case 18: - expression = new LogicAndViewExpression(inputStream); - break; - - case 19: - expression = new LogicOrViewExpression(inputStream); - break; - - case 20: - expression = new NullViewOperand(); - break; - default: - throw new IllegalArgumentException("Invalid viewExpression type: " + type); - } - return expression; - } catch (IOException e) { - throw new RuntimeException(e); - } - } - // end region -} +// public static ViewExpression deserialize(ByteBuffer byteBuffer) { +// short type = ReadWriteIOUtils.readShort(byteBuffer); +// +// ViewExpression expression; +// switch (type) { +// case -4: +// expression = new ConstantViewOperand(byteBuffer); +// break; +// case -3: +// expression = new TimestampViewOperand(byteBuffer); +// break; +// case -2: +// expression = new TimeSeriesViewOperand(byteBuffer); +// break; +// case -1: +// expression = new FunctionViewExpression(byteBuffer); +// break; +// +// case 0: +// expression = new NegationViewExpression(byteBuffer); +// break; +// case 1: +// expression = new LogicNotViewExpression(byteBuffer); +// break; +// +// case 2: +// expression = new MultiplicationViewExpression(byteBuffer); +// break; +// case 3: +// expression = new DivisionViewExpression(byteBuffer); +// break; +// case 4: +// expression = new ModuloViewExpression(byteBuffer); +// break; +// +// case 5: +// expression = new AdditionViewExpression(byteBuffer); +// break; +// case 6: +// expression = new SubtractionViewExpression(byteBuffer); +// break; +// +// case 7: +// expression = new EqualToViewExpression(byteBuffer); +// break; +// case 8: +// expression = new NonEqualViewExpression(byteBuffer); +// break; +// case 9: +// expression = new GreaterEqualViewExpression(byteBuffer); +// break; +// case 10: +// expression = new GreaterThanViewExpression(byteBuffer); +// break; +// case 11: +// expression = new LessEqualViewExpression(byteBuffer); +// break; +// case 12: +// expression = new LessThanViewExpression(byteBuffer); +// break; +// +// case 13: +// expression = new LikeViewExpression(byteBuffer); +// break; +// case 14: +// expression = new RegularViewExpression(byteBuffer); +// break; +// +// case 15: +// expression = new IsNullViewExpression(byteBuffer); +// break; +// +// case 16: +// expression = new BetweenViewExpression(byteBuffer); +// break; +// +// case 17: +// expression = new InViewExpression(byteBuffer); +// break; +// +// case 18: +// expression = new LogicAndViewExpression(byteBuffer); +// break; +// +// case 19: +// expression = new LogicOrViewExpression(byteBuffer); +// break; +// +// case 20: +// expression = new NullViewOperand(); +// break; +// default: +// throw new IllegalArgumentException("Invalid viewExpression type: " + type); +// } +// return expression; +// } +// +// public static ViewExpression deserialize(InputStream inputStream) { +// try { +// short type = ReadWriteIOUtils.readShort(inputStream); +// +// ViewExpression expression; +// switch (type) { +// case -4: +// expression = new ConstantViewOperand(inputStream); +// break; +// case -3: +// expression = new TimestampViewOperand(inputStream); +// break; +// case -2: +// expression = new TimeSeriesViewOperand(inputStream); +// break; +// case -1: +// expression = new FunctionViewExpression(inputStream); +// break; +// +// case 0: +// expression = new NegationViewExpression(inputStream); +// break; +// case 1: +// expression = new LogicNotViewExpression(inputStream); +// break; +// +// case 2: +// expression = new MultiplicationViewExpression(inputStream); +// break; +// case 3: +// expression = new DivisionViewExpression(inputStream); +// break; +// case 4: +// expression = new ModuloViewExpression(inputStream); +// break; +// +// case 5: +// expression = new AdditionViewExpression(inputStream); +// break; +// case 6: +// expression = new SubtractionViewExpression(inputStream); +// break; +// +// case 7: +// expression = new EqualToViewExpression(inputStream); +// break; +// case 8: +// expression = new NonEqualViewExpression(inputStream); +// break; +// case 9: +// expression = new GreaterEqualViewExpression(inputStream); +// break; +// case 10: +// expression = new GreaterThanViewExpression(inputStream); +// break; +// case 11: +// expression = new LessEqualViewExpression(inputStream); +// break; +// case 12: +// expression = new LessThanViewExpression(inputStream); +// break; +// +// case 13: +// expression = new LikeViewExpression(inputStream); +// break; +// case 14: +// expression = new RegularViewExpression(inputStream); +// break; +// +// case 15: +// expression = new IsNullViewExpression(inputStream); +// break; +// +// case 16: +// expression = new BetweenViewExpression(inputStream); +// break; +// +// case 17: +// expression = new InViewExpression(inputStream); +// break; +// +// case 18: +// expression = new LogicAndViewExpression(inputStream); +// break; +// +// case 19: +// expression = new LogicOrViewExpression(inputStream); +// break; +// +// case 20: +// expression = new NullViewOperand(); +// break; +// default: +// throw new IllegalArgumentException("Invalid viewExpression type: " + type); +// } +// return expression; +// } catch (IOException e) { +// throw new RuntimeException(e); +// } +// } +// // end region +// } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/ViewExpressionType.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/ViewExpressionType.java index 2a8fc67739939..67e3a6296f2d9 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/ViewExpressionType.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/ViewExpressionType.java @@ -1,76 +1,76 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iotdb.commons.schema.view.viewExpression; - -public enum ViewExpressionType { - CONSTANT((short) -4, (short) 1400), - TIMESTAMP((short) -3, (short) 1300), - TIMESERIES((short) -2, (short) 1200), - FUNCTION((short) -1, (short) 1100), - - NEGATION((short) 0, (short) 1000), - LOGIC_NOT((short) 1, (short) 1000), - - MULTIPLICATION((short) 2, (short) 900), - DIVISION((short) 3, (short) 900), - MODULO((short) 4, (short) 900), - - ADDITION((short) 5, (short) 800), - SUBTRACTION((short) 6, (short) 800), - - EQUAL_TO((short) 7, (short) 600), - NON_EQUAL((short) 8, (short) 600), - GREATER_EQUAL((short) 9, (short) 600), - GREATER_THAN((short) 10, (short) 600), - LESS_EQUAL((short) 11, (short) 600), - LESS_THAN((short) 12, (short) 600), - - LIKE((short) 13, (short) 500), - REGEXP((short) 14, (short) 500), - - IS_NULL((short) 15, (short) 475), - - BETWEEN((short) 16, (short) 450), - - IN((short) 17, (short) 400), - - LOGIC_AND((short) 18, (short) 300), - - LOGIC_OR((short) 19, (short) 200), - - NULL((short) 20, (short) 1400), - ; - - private final short expressionType; - private final short priority; - - ViewExpressionType(short expressionType, short priority) { - this.expressionType = expressionType; - this.priority = priority; - } - - public short getExpressionTypeInShortEnum() { - return expressionType; - } - - public short getPriority() { - return priority; - } -} +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// +// package org.apache.iotdb.commons.schema.view.viewExpression; +// +// public enum ViewExpressionType { +// CONSTANT((short) -4, (short) 1400), +// TIMESTAMP((short) -3, (short) 1300), +// TIMESERIES((short) -2, (short) 1200), +// FUNCTION((short) -1, (short) 1100), +// +// NEGATION((short) 0, (short) 1000), +// LOGIC_NOT((short) 1, (short) 1000), +// +// MULTIPLICATION((short) 2, (short) 900), +// DIVISION((short) 3, (short) 900), +// MODULO((short) 4, (short) 900), +// +// ADDITION((short) 5, (short) 800), +// SUBTRACTION((short) 6, (short) 800), +// +// EQUAL_TO((short) 7, (short) 600), +// NON_EQUAL((short) 8, (short) 600), +// GREATER_EQUAL((short) 9, (short) 600), +// GREATER_THAN((short) 10, (short) 600), +// LESS_EQUAL((short) 11, (short) 600), +// LESS_THAN((short) 12, (short) 600), +// +// LIKE((short) 13, (short) 500), +// REGEXP((short) 14, (short) 500), +// +// IS_NULL((short) 15, (short) 475), +// +// BETWEEN((short) 16, (short) 450), +// +// IN((short) 17, (short) 400), +// +// LOGIC_AND((short) 18, (short) 300), +// +// LOGIC_OR((short) 19, (short) 200), +// +// NULL((short) 20, (short) 1400), +// ; +// +// private final short expressionType; +// private final short priority; +// +// ViewExpressionType(short expressionType, short priority) { +// this.expressionType = expressionType; +// this.priority = priority; +// } +// +// public short getExpressionTypeInShortEnum() { +// return expressionType; +// } +// +// public short getPriority() { +// return priority; +// } +// } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/BinaryViewExpression.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/BinaryViewExpression.java index 3aaff867dd9f0..6d840538f5db1 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/BinaryViewExpression.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/BinaryViewExpression.java @@ -1,121 +1,121 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iotdb.commons.schema.view.viewExpression.binary; - -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.nio.ByteBuffer; -import java.util.Arrays; -import java.util.List; - -public abstract class BinaryViewExpression extends ViewExpression { - - // region member variables and init functions - protected ViewExpression leftExpression; - protected ViewExpression rightExpression; - - protected BinaryViewExpression(ViewExpression leftExpression, ViewExpression rightExpression) { - this.leftExpression = leftExpression; - this.rightExpression = rightExpression; - } - - protected BinaryViewExpression(ByteBuffer byteBuffer) { - this.leftExpression = ViewExpression.deserialize(byteBuffer); - this.rightExpression = ViewExpression.deserialize(byteBuffer); - } - - protected BinaryViewExpression(InputStream inputStream) { - this.leftExpression = ViewExpression.deserialize(inputStream); - this.rightExpression = ViewExpression.deserialize(inputStream); - } - - // endregion - - // region common interfaces that have to be implemented - @Override - public R accept(ViewExpressionVisitor visitor, C context) { - return visitor.visitBinaryExpression(this, context); - } - - @Override - protected final boolean isLeafOperandInternal() { - return false; - } - - @Override - public final List getChildViewExpressions() { - return Arrays.asList(leftExpression, rightExpression); - } - - @Override - protected void serialize(ByteBuffer byteBuffer) { - ViewExpression.serialize(leftExpression, byteBuffer); - ViewExpression.serialize(rightExpression, byteBuffer); - } - - @Override - protected void serialize(OutputStream stream) throws IOException { - ViewExpression.serialize(leftExpression, stream); - ViewExpression.serialize(rightExpression, stream); - } - - // endregion - public void setLeftExpression(ViewExpression leftExpression) { - this.leftExpression = leftExpression; - } - - public void setRightExpression(ViewExpression rightExpression) { - this.rightExpression = rightExpression; - } - - public ViewExpression getLeftExpression() { - return leftExpression; - } - - public ViewExpression getRightExpression() { - return rightExpression; - } - - public abstract String getStringSymbol(); - - @Override - public String toString() { - return this.toString(true); - } - - @Override - public String toString(boolean isRoot) { - String basicString = - leftExpression.toString(false) - + " " - + this.getStringSymbol() - + " " - + rightExpression.toString(false); - if (isRoot) { - return basicString; - } else { - return "(" + basicString + ")"; - } - } -} +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// +// package org.apache.iotdb.commons.schema.view.viewExpression.binary; +// +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; +// +// import java.io.IOException; +// import java.io.InputStream; +// import java.io.OutputStream; +// import java.nio.ByteBuffer; +// import java.util.Arrays; +// import java.util.List; +// +// public abstract class BinaryViewExpression extends ViewExpression { +// +// // region member variables and init functions +// protected ViewExpression leftExpression; +// protected ViewExpression rightExpression; +// +// protected BinaryViewExpression(ViewExpression leftExpression, ViewExpression rightExpression) { +// this.leftExpression = leftExpression; +// this.rightExpression = rightExpression; +// } +// +// protected BinaryViewExpression(ByteBuffer byteBuffer) { +// this.leftExpression = ViewExpression.deserialize(byteBuffer); +// this.rightExpression = ViewExpression.deserialize(byteBuffer); +// } +// +// protected BinaryViewExpression(InputStream inputStream) { +// this.leftExpression = ViewExpression.deserialize(inputStream); +// this.rightExpression = ViewExpression.deserialize(inputStream); +// } + +// // endregion +// +// // region common interfaces that have to be implemented +// @Override +// public R accept(ViewExpressionVisitor visitor, C context) { +// return visitor.visitBinaryExpression(this, context); +// } +// +// @Override +// protected final boolean isLeafOperandInternal() { +// return false; +// } +// +// @Override +// public final List getChildViewExpressions() { +// return Arrays.asList(leftExpression, rightExpression); +// } +// +// @Override +// protected void serialize(ByteBuffer byteBuffer) { +// ViewExpression.serialize(leftExpression, byteBuffer); +// ViewExpression.serialize(rightExpression, byteBuffer); +// } +// +// @Override +// protected void serialize(OutputStream stream) throws IOException { +// ViewExpression.serialize(leftExpression, stream); +// ViewExpression.serialize(rightExpression, stream); +// } + +// // endregion +// public void setLeftExpression(ViewExpression leftExpression) { +// this.leftExpression = leftExpression; +// } +// +// public void setRightExpression(ViewExpression rightExpression) { +// this.rightExpression = rightExpression; +// } +// +// public ViewExpression getLeftExpression() { +// return leftExpression; +// } +// +// public ViewExpression getRightExpression() { +// return rightExpression; +// } +// +// public abstract String getStringSymbol(); +// +// @Override +// public String toString() { +// return this.toString(true); +// } +// +// @Override +// public String toString(boolean isRoot) { +// String basicString = +// leftExpression.toString(false) +// + " " +// + this.getStringSymbol() +// + " " +// + rightExpression.toString(false); +// if (isRoot) { +// return basicString; +// } else { +// return "(" + basicString + ")"; +// } +// } +// } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/arithmetic/AdditionViewExpression.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/arithmetic/AdditionViewExpression.java index 699ccc3b54db3..8f822dabde7cd 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/arithmetic/AdditionViewExpression.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/arithmetic/AdditionViewExpression.java @@ -1,62 +1,62 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic; - -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; -import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; - -import java.io.InputStream; -import java.nio.ByteBuffer; - -public class AdditionViewExpression extends ArithmeticBinaryViewExpression { - - // region member variables and init functions - public AdditionViewExpression(ViewExpression leftExpression, ViewExpression rightExpression) { - super(leftExpression, rightExpression); - } - - public AdditionViewExpression(ByteBuffer byteBuffer) { - super(byteBuffer); - } - - public AdditionViewExpression(InputStream inputStream) { - super(inputStream); - } - - // endregion - - // region common interfaces that have to be implemented - @Override - public R accept(ViewExpressionVisitor visitor, C context) { - return visitor.visitAdditionExpression(this, context); - } - - @Override - public String getStringSymbol() { - return "+"; - } - - @Override - public ViewExpressionType getExpressionType() { - return ViewExpressionType.ADDITION; - } - // endregion -} +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// +// package org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic; +// +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; +// import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; +// +// import java.io.InputStream; +// import java.nio.ByteBuffer; +// +// public class AdditionViewExpression extends ArithmeticBinaryViewExpression { +// +// // region member variables and init functions +// public AdditionViewExpression(ViewExpression leftExpression, ViewExpression rightExpression) { +// super(leftExpression, rightExpression); +// } +// +// public AdditionViewExpression(ByteBuffer byteBuffer) { +// super(byteBuffer); +// } +// +// public AdditionViewExpression(InputStream inputStream) { +// super(inputStream); +// } + +// // endregion +// +// // region common interfaces that have to be implemented +// @Override +// public R accept(ViewExpressionVisitor visitor, C context) { +// return visitor.visitAdditionExpression(this, context); +// } +// +// @Override +// public String getStringSymbol() { +// return "+"; +// } +// +// @Override +// public ViewExpressionType getExpressionType() { +// return ViewExpressionType.ADDITION; +// } +// // endregion +// } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/arithmetic/ArithmeticBinaryViewExpression.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/arithmetic/ArithmeticBinaryViewExpression.java index ded033112ae32..f528b9597d3d1 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/arithmetic/ArithmeticBinaryViewExpression.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/arithmetic/ArithmeticBinaryViewExpression.java @@ -1,53 +1,53 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic; - -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.BinaryViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; - -import java.io.InputStream; -import java.nio.ByteBuffer; - -public abstract class ArithmeticBinaryViewExpression extends BinaryViewExpression { - - // region member variables and init functions - protected ArithmeticBinaryViewExpression( - ViewExpression leftExpression, ViewExpression rightExpression) { - super(leftExpression, rightExpression); - } - - protected ArithmeticBinaryViewExpression(ByteBuffer byteBuffer) { - super(byteBuffer); - } - - protected ArithmeticBinaryViewExpression(InputStream inputStream) { - super(inputStream); - } - - // endregion - - // region common interfaces that have to be implemented - @Override - public R accept(ViewExpressionVisitor visitor, C context) { - return visitor.visitArithmeticBinaryExpression(this, context); - } - // endregion -} +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// +// package org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic; +// +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.BinaryViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; +// +// import java.io.InputStream; +// import java.nio.ByteBuffer; +// +// public abstract class ArithmeticBinaryViewExpression extends BinaryViewExpression { +// +// // region member variables and init functions +// protected ArithmeticBinaryViewExpression( +// ViewExpression leftExpression, ViewExpression rightExpression) { +// super(leftExpression, rightExpression); +// } +// +// protected ArithmeticBinaryViewExpression(ByteBuffer byteBuffer) { +// super(byteBuffer); +// } +// +// protected ArithmeticBinaryViewExpression(InputStream inputStream) { +// super(inputStream); +// } + +// // endregion +// +// // region common interfaces that have to be implemented +// @Override +// public R accept(ViewExpressionVisitor visitor, C context) { +// return visitor.visitArithmeticBinaryExpression(this, context); +// } +// // endregion +// } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/arithmetic/DivisionViewExpression.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/arithmetic/DivisionViewExpression.java index 86fe8c161ac8c..d8e6361f43767 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/arithmetic/DivisionViewExpression.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/arithmetic/DivisionViewExpression.java @@ -1,62 +1,62 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic; - -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; -import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; - -import java.io.InputStream; -import java.nio.ByteBuffer; - -public class DivisionViewExpression extends ArithmeticBinaryViewExpression { - - // region member variables and init functions - public DivisionViewExpression(ViewExpression leftExpression, ViewExpression rightExpression) { - super(leftExpression, rightExpression); - } - - public DivisionViewExpression(ByteBuffer byteBuffer) { - super(byteBuffer); - } - - public DivisionViewExpression(InputStream inputStream) { - super(inputStream); - } - - // endregion - - // region common interfaces that have to be implemented - @Override - public R accept(ViewExpressionVisitor visitor, C context) { - return visitor.visitDivisionExpression(this, context); - } - - @Override - public String getStringSymbol() { - return "/"; - } - - @Override - public ViewExpressionType getExpressionType() { - return ViewExpressionType.DIVISION; - } - // endregion -} +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// +// package org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic; +// +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; +// import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; +// +// import java.io.InputStream; +// import java.nio.ByteBuffer; +// +// public class DivisionViewExpression extends ArithmeticBinaryViewExpression { +// +// // region member variables and init functions +// public DivisionViewExpression(ViewExpression leftExpression, ViewExpression rightExpression) { +// super(leftExpression, rightExpression); +// } +// +// public DivisionViewExpression(ByteBuffer byteBuffer) { +// super(byteBuffer); +// } +// +// public DivisionViewExpression(InputStream inputStream) { +// super(inputStream); +// } + +// // endregion +// +// // region common interfaces that have to be implemented +// @Override +// public R accept(ViewExpressionVisitor visitor, C context) { +// return visitor.visitDivisionExpression(this, context); +// } +// +// @Override +// public String getStringSymbol() { +// return "/"; +// } +// +// @Override +// public ViewExpressionType getExpressionType() { +// return ViewExpressionType.DIVISION; +// } +// // endregion +// } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/arithmetic/ModuloViewExpression.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/arithmetic/ModuloViewExpression.java index decbdc73dda32..ac328ae163835 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/arithmetic/ModuloViewExpression.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/arithmetic/ModuloViewExpression.java @@ -1,62 +1,62 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic; - -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; -import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; - -import java.io.InputStream; -import java.nio.ByteBuffer; - -public class ModuloViewExpression extends ArithmeticBinaryViewExpression { - - // region member variables and init functions - public ModuloViewExpression(ViewExpression leftExpression, ViewExpression rightExpression) { - super(leftExpression, rightExpression); - } - - public ModuloViewExpression(ByteBuffer byteBuffer) { - super(byteBuffer); - } - - public ModuloViewExpression(InputStream inputStream) { - super(inputStream); - } - - // endregion - - // region common interfaces that have to be implemented - @Override - public R accept(ViewExpressionVisitor visitor, C context) { - return visitor.visitModuloExpression(this, context); - } - - @Override - public String getStringSymbol() { - return "%"; - } - - @Override - public ViewExpressionType getExpressionType() { - return ViewExpressionType.MODULO; - } - // endregion -} +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// +// package org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic; +// +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; +// import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; +// +// import java.io.InputStream; +// import java.nio.ByteBuffer; +// +// public class ModuloViewExpression extends ArithmeticBinaryViewExpression { +// +// // region member variables and init functions +// public ModuloViewExpression(ViewExpression leftExpression, ViewExpression rightExpression) { +// super(leftExpression, rightExpression); +// } +// +// public ModuloViewExpression(ByteBuffer byteBuffer) { +// super(byteBuffer); +// } +// +// public ModuloViewExpression(InputStream inputStream) { +// super(inputStream); +// } + +// // endregion +// +// // region common interfaces that have to be implemented +// @Override +// public R accept(ViewExpressionVisitor visitor, C context) { +// return visitor.visitModuloExpression(this, context); +// } +// +// @Override +// public String getStringSymbol() { +// return "%"; +// } +// +// @Override +// public ViewExpressionType getExpressionType() { +// return ViewExpressionType.MODULO; +// } +// // endregion +// } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/arithmetic/MultiplicationViewExpression.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/arithmetic/MultiplicationViewExpression.java index 869f9088cbac0..411f92172ba9d 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/arithmetic/MultiplicationViewExpression.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/arithmetic/MultiplicationViewExpression.java @@ -1,64 +1,64 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// +// package org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic; +// +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; +// import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; +// +// import java.io.InputStream; +// import java.nio.ByteBuffer; +// +// public class MultiplicationViewExpression extends ArithmeticBinaryViewExpression { +// +// // region member variables and init functions +// public MultiplicationViewExpression( +// ViewExpression leftExpression, ViewExpression rightExpression) { +// super(leftExpression, rightExpression); +// } +// +// public MultiplicationViewExpression(ByteBuffer byteBuffer) { +// super(byteBuffer); +// } +// +// public MultiplicationViewExpression(InputStream inputStream) { +// super(inputStream); +// } -package org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic; - -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; -import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; - -import java.io.InputStream; -import java.nio.ByteBuffer; - -public class MultiplicationViewExpression extends ArithmeticBinaryViewExpression { - - // region member variables and init functions - public MultiplicationViewExpression( - ViewExpression leftExpression, ViewExpression rightExpression) { - super(leftExpression, rightExpression); - } - - public MultiplicationViewExpression(ByteBuffer byteBuffer) { - super(byteBuffer); - } - - public MultiplicationViewExpression(InputStream inputStream) { - super(inputStream); - } - - // endregion - - // region common interfaces that have to be implemented - @Override - public R accept(ViewExpressionVisitor visitor, C context) { - return visitor.visitMultiplicationExpression(this, context); - } - - @Override - public String getStringSymbol() { - return "*"; - } - - @Override - public ViewExpressionType getExpressionType() { - return ViewExpressionType.MULTIPLICATION; - } - // endregion - -} +// // endregion +// +// // region common interfaces that have to be implemented +// @Override +// public R accept(ViewExpressionVisitor visitor, C context) { +// return visitor.visitMultiplicationExpression(this, context); +// } +// +// @Override +// public String getStringSymbol() { +// return "*"; +// } +// +// @Override +// public ViewExpressionType getExpressionType() { +// return ViewExpressionType.MULTIPLICATION; +// } +// // endregion +// +// } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/arithmetic/SubtractionViewExpression.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/arithmetic/SubtractionViewExpression.java index 9010578351bb1..f053456f6f4a6 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/arithmetic/SubtractionViewExpression.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/arithmetic/SubtractionViewExpression.java @@ -1,62 +1,62 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic; - -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; -import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; - -import java.io.InputStream; -import java.nio.ByteBuffer; - -public class SubtractionViewExpression extends ArithmeticBinaryViewExpression { - - // region member variables and init functions - public SubtractionViewExpression(ViewExpression leftExpression, ViewExpression rightExpression) { - super(leftExpression, rightExpression); - } - - public SubtractionViewExpression(ByteBuffer byteBuffer) { - super(byteBuffer); - } - - public SubtractionViewExpression(InputStream inputStream) { - super(inputStream); - } - - // endregion - - // region common interfaces that have to be implemented - @Override - public R accept(ViewExpressionVisitor visitor, C context) { - return visitor.visitSubtractionExpression(this, context); - } - - @Override - public String getStringSymbol() { - return "-"; - } - - @Override - public ViewExpressionType getExpressionType() { - return ViewExpressionType.SUBTRACTION; - } - // endregion -} +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// +// package org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic; +// +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; +// import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; +// +// import java.io.InputStream; +// import java.nio.ByteBuffer; +// +// public class SubtractionViewExpression extends ArithmeticBinaryViewExpression { +// +// // region member variables and init functions +// public SubtractionViewExpression(ViewExpression leftExpression, ViewExpression rightExpression) { +// super(leftExpression, rightExpression); +// } +// +// public SubtractionViewExpression(ByteBuffer byteBuffer) { +// super(byteBuffer); +// } +// +// public SubtractionViewExpression(InputStream inputStream) { +// super(inputStream); +// } + +// // endregion +// +// // region common interfaces that have to be implemented +// @Override +// public R accept(ViewExpressionVisitor visitor, C context) { +// return visitor.visitSubtractionExpression(this, context); +// } +// +// @Override +// public String getStringSymbol() { +// return "-"; +// } +// +// @Override +// public ViewExpressionType getExpressionType() { +// return ViewExpressionType.SUBTRACTION; +// } +// // endregion +// } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/compare/CompareBinaryViewExpression.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/compare/CompareBinaryViewExpression.java index e9c7d1ffafb4e..859c1070e779e 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/compare/CompareBinaryViewExpression.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/compare/CompareBinaryViewExpression.java @@ -1,53 +1,53 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iotdb.commons.schema.view.viewExpression.binary.compare; - -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.BinaryViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; - -import java.io.InputStream; -import java.nio.ByteBuffer; - -public abstract class CompareBinaryViewExpression extends BinaryViewExpression { - - // region member variables and init functions - protected CompareBinaryViewExpression( - ViewExpression leftExpression, ViewExpression rightExpression) { - super(leftExpression, rightExpression); - } - - protected CompareBinaryViewExpression(ByteBuffer byteBuffer) { - super(byteBuffer); - } - - protected CompareBinaryViewExpression(InputStream inputStream) { - super(inputStream); - } - - // endregion - - // region common interfaces that have to be implemented - @Override - public R accept(ViewExpressionVisitor visitor, C context) { - return visitor.visitCompareBinaryExpression(this, context); - } - // endregion -} +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// +// package org.apache.iotdb.commons.schema.view.viewExpression.binary.compare; +// +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.BinaryViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; +// +// import java.io.InputStream; +// import java.nio.ByteBuffer; +// +// public abstract class CompareBinaryViewExpression extends BinaryViewExpression { +// +// // region member variables and init functions +// protected CompareBinaryViewExpression( +// ViewExpression leftExpression, ViewExpression rightExpression) { +// super(leftExpression, rightExpression); +// } +// +// protected CompareBinaryViewExpression(ByteBuffer byteBuffer) { +// super(byteBuffer); +// } +// +// protected CompareBinaryViewExpression(InputStream inputStream) { +// super(inputStream); +// } + +// // endregion +// +// // region common interfaces that have to be implemented +// @Override +// public R accept(ViewExpressionVisitor visitor, C context) { +// return visitor.visitCompareBinaryExpression(this, context); +// } +// // endregion +// } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/compare/EqualToViewExpression.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/compare/EqualToViewExpression.java index 6eb1b9668a6e6..e2d93bc407e09 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/compare/EqualToViewExpression.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/compare/EqualToViewExpression.java @@ -1,57 +1,57 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iotdb.commons.schema.view.viewExpression.binary.compare; - -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; -import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; - -import java.io.InputStream; -import java.nio.ByteBuffer; - -public class EqualToViewExpression extends CompareBinaryViewExpression { - - public EqualToViewExpression(ViewExpression leftExpression, ViewExpression rightExpression) { - super(leftExpression, rightExpression); - } - - public EqualToViewExpression(ByteBuffer byteBuffer) { - super(byteBuffer); - } - - public EqualToViewExpression(InputStream inputStream) { - super(inputStream); - } - - @Override - public R accept(ViewExpressionVisitor visitor, C context) { - return visitor.visitEqualToExpression(this, context); - } - - @Override - public String getStringSymbol() { - return "=="; - } - - @Override - public ViewExpressionType getExpressionType() { - return ViewExpressionType.EQUAL_TO; - } -} +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// +// package org.apache.iotdb.commons.schema.view.viewExpression.binary.compare; +// +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; +// import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; +// +// import java.io.InputStream; +// import java.nio.ByteBuffer; +// +// public class EqualToViewExpression extends CompareBinaryViewExpression { +// +// public EqualToViewExpression(ViewExpression leftExpression, ViewExpression rightExpression) { +// super(leftExpression, rightExpression); +// } +// +// public EqualToViewExpression(ByteBuffer byteBuffer) { +// super(byteBuffer); +// } +// +// public EqualToViewExpression(InputStream inputStream) { +// super(inputStream); +// } +// +// @Override +// public R accept(ViewExpressionVisitor visitor, C context) { +// return visitor.visitEqualToExpression(this, context); +// } +// +// @Override +// public String getStringSymbol() { +// return "=="; +// } +// +// @Override +// public ViewExpressionType getExpressionType() { +// return ViewExpressionType.EQUAL_TO; +// } +// } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/compare/GreaterEqualViewExpression.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/compare/GreaterEqualViewExpression.java index 05f20b24419b7..cea532235e8d2 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/compare/GreaterEqualViewExpression.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/compare/GreaterEqualViewExpression.java @@ -1,57 +1,57 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iotdb.commons.schema.view.viewExpression.binary.compare; - -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; -import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; - -import java.io.InputStream; -import java.nio.ByteBuffer; - -public class GreaterEqualViewExpression extends CompareBinaryViewExpression { - - public GreaterEqualViewExpression(ViewExpression leftExpression, ViewExpression rightExpression) { - super(leftExpression, rightExpression); - } - - public GreaterEqualViewExpression(ByteBuffer byteBuffer) { - super(byteBuffer); - } - - public GreaterEqualViewExpression(InputStream inputStream) { - super(inputStream); - } - - @Override - public R accept(ViewExpressionVisitor visitor, C context) { - return visitor.visitGreaterEqualExpression(this, context); - } - - @Override - public String getStringSymbol() { - return ">="; - } - - @Override - public ViewExpressionType getExpressionType() { - return ViewExpressionType.GREATER_EQUAL; - } -} +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// +// package org.apache.iotdb.commons.schema.view.viewExpression.binary.compare; +// +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; +// import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; +// +// import java.io.InputStream; +// import java.nio.ByteBuffer; +// +// public class GreaterEqualViewExpression extends CompareBinaryViewExpression { +// +// public GreaterEqualViewExpression(ViewExpression leftExpression, ViewExpression rightExpression) { +// super(leftExpression, rightExpression); +// } +// +// public GreaterEqualViewExpression(ByteBuffer byteBuffer) { +// super(byteBuffer); +// } +// +// public GreaterEqualViewExpression(InputStream inputStream) { +// super(inputStream); +// } +// +// @Override +// public R accept(ViewExpressionVisitor visitor, C context) { +// return visitor.visitGreaterEqualExpression(this, context); +// } +// +// @Override +// public String getStringSymbol() { +// return ">="; +// } +// +// @Override +// public ViewExpressionType getExpressionType() { +// return ViewExpressionType.GREATER_EQUAL; +// } +// } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/compare/GreaterThanViewExpression.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/compare/GreaterThanViewExpression.java index f3b98de213da8..5a23fa856364f 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/compare/GreaterThanViewExpression.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/compare/GreaterThanViewExpression.java @@ -1,57 +1,57 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iotdb.commons.schema.view.viewExpression.binary.compare; - -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; -import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; - -import java.io.InputStream; -import java.nio.ByteBuffer; - -public class GreaterThanViewExpression extends CompareBinaryViewExpression { - - public GreaterThanViewExpression(ViewExpression leftExpression, ViewExpression rightExpression) { - super(leftExpression, rightExpression); - } - - public GreaterThanViewExpression(ByteBuffer byteBuffer) { - super(byteBuffer); - } - - public GreaterThanViewExpression(InputStream inputStream) { - super(inputStream); - } - - @Override - public R accept(ViewExpressionVisitor visitor, C context) { - return visitor.visitGreaterThanExpression(this, context); - } - - @Override - public String getStringSymbol() { - return ">"; - } - - @Override - public ViewExpressionType getExpressionType() { - return ViewExpressionType.GREATER_THAN; - } -} +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// +// package org.apache.iotdb.commons.schema.view.viewExpression.binary.compare; +// +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; +// import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; +// +// import java.io.InputStream; +// import java.nio.ByteBuffer; +// +// public class GreaterThanViewExpression extends CompareBinaryViewExpression { +// +// public GreaterThanViewExpression(ViewExpression leftExpression, ViewExpression rightExpression) { +// super(leftExpression, rightExpression); +// } +// +// public GreaterThanViewExpression(ByteBuffer byteBuffer) { +// super(byteBuffer); +// } +// +// public GreaterThanViewExpression(InputStream inputStream) { +// super(inputStream); +// } +// +// @Override +// public R accept(ViewExpressionVisitor visitor, C context) { +// return visitor.visitGreaterThanExpression(this, context); +// } +// +// @Override +// public String getStringSymbol() { +// return ">"; +// } +// +// @Override +// public ViewExpressionType getExpressionType() { +// return ViewExpressionType.GREATER_THAN; +// } +// } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/compare/LessEqualViewExpression.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/compare/LessEqualViewExpression.java index 97ff540547cd4..9bdc0185fd584 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/compare/LessEqualViewExpression.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/compare/LessEqualViewExpression.java @@ -1,57 +1,57 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iotdb.commons.schema.view.viewExpression.binary.compare; - -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; -import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; - -import java.io.InputStream; -import java.nio.ByteBuffer; - -public class LessEqualViewExpression extends CompareBinaryViewExpression { - - public LessEqualViewExpression(ViewExpression leftExpression, ViewExpression rightExpression) { - super(leftExpression, rightExpression); - } - - public LessEqualViewExpression(ByteBuffer byteBuffer) { - super(byteBuffer); - } - - public LessEqualViewExpression(InputStream inputStream) { - super(inputStream); - } - - @Override - public R accept(ViewExpressionVisitor visitor, C context) { - return visitor.visitLessEqualExpression(this, context); - } - - @Override - public String getStringSymbol() { - return "<="; - } - - @Override - public ViewExpressionType getExpressionType() { - return ViewExpressionType.LESS_EQUAL; - } -} +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// +// package org.apache.iotdb.commons.schema.view.viewExpression.binary.compare; +// +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; +// import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; +// +// import java.io.InputStream; +// import java.nio.ByteBuffer; +// +// public class LessEqualViewExpression extends CompareBinaryViewExpression { +// +// public LessEqualViewExpression(ViewExpression leftExpression, ViewExpression rightExpression) { +// super(leftExpression, rightExpression); +// } +// +// public LessEqualViewExpression(ByteBuffer byteBuffer) { +// super(byteBuffer); +// } +// +// public LessEqualViewExpression(InputStream inputStream) { +// super(inputStream); +// } +// +// @Override +// public R accept(ViewExpressionVisitor visitor, C context) { +// return visitor.visitLessEqualExpression(this, context); +// } +// +// @Override +// public String getStringSymbol() { +// return "<="; +// } +// +// @Override +// public ViewExpressionType getExpressionType() { +// return ViewExpressionType.LESS_EQUAL; +// } +// } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/compare/LessThanViewExpression.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/compare/LessThanViewExpression.java index 8bfb345a64d5e..7db97adc6ef95 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/compare/LessThanViewExpression.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/compare/LessThanViewExpression.java @@ -1,57 +1,57 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iotdb.commons.schema.view.viewExpression.binary.compare; - -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; -import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; - -import java.io.InputStream; -import java.nio.ByteBuffer; - -public class LessThanViewExpression extends CompareBinaryViewExpression { - - public LessThanViewExpression(ViewExpression leftExpression, ViewExpression rightExpression) { - super(leftExpression, rightExpression); - } - - public LessThanViewExpression(ByteBuffer byteBuffer) { - super(byteBuffer); - } - - public LessThanViewExpression(InputStream inputStream) { - super(inputStream); - } - - @Override - public R accept(ViewExpressionVisitor visitor, C context) { - return visitor.visitLessThanExpression(this, context); - } - - @Override - public String getStringSymbol() { - return "<"; - } - - @Override - public ViewExpressionType getExpressionType() { - return ViewExpressionType.LESS_THAN; - } -} +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// +// package org.apache.iotdb.commons.schema.view.viewExpression.binary.compare; +// +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; +// import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; +// +// import java.io.InputStream; +// import java.nio.ByteBuffer; +// +// public class LessThanViewExpression extends CompareBinaryViewExpression { +// +// public LessThanViewExpression(ViewExpression leftExpression, ViewExpression rightExpression) { +// super(leftExpression, rightExpression); +// } +// +// public LessThanViewExpression(ByteBuffer byteBuffer) { +// super(byteBuffer); +// } +// +// public LessThanViewExpression(InputStream inputStream) { +// super(inputStream); +// } +// +// @Override +// public R accept(ViewExpressionVisitor visitor, C context) { +// return visitor.visitLessThanExpression(this, context); +// } +// +// @Override +// public String getStringSymbol() { +// return "<"; +// } +// +// @Override +// public ViewExpressionType getExpressionType() { +// return ViewExpressionType.LESS_THAN; +// } +// } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/compare/NonEqualViewExpression.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/compare/NonEqualViewExpression.java index 4570a552c3d5a..b678989472a96 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/compare/NonEqualViewExpression.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/compare/NonEqualViewExpression.java @@ -1,57 +1,57 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iotdb.commons.schema.view.viewExpression.binary.compare; - -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; -import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; - -import java.io.InputStream; -import java.nio.ByteBuffer; - -public class NonEqualViewExpression extends CompareBinaryViewExpression { - - public NonEqualViewExpression(ViewExpression leftExpression, ViewExpression rightExpression) { - super(leftExpression, rightExpression); - } - - public NonEqualViewExpression(ByteBuffer byteBuffer) { - super(byteBuffer); - } - - public NonEqualViewExpression(InputStream inputStream) { - super(inputStream); - } - - @Override - public R accept(ViewExpressionVisitor visitor, C context) { - return visitor.visitNonEqualExpression(this, context); - } - - @Override - public String getStringSymbol() { - return "!="; - } - - @Override - public ViewExpressionType getExpressionType() { - return ViewExpressionType.NON_EQUAL; - } -} +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// +// package org.apache.iotdb.commons.schema.view.viewExpression.binary.compare; +// +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; +// import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; +// +// import java.io.InputStream; +// import java.nio.ByteBuffer; +// +// public class NonEqualViewExpression extends CompareBinaryViewExpression { +// +// public NonEqualViewExpression(ViewExpression leftExpression, ViewExpression rightExpression) { +// super(leftExpression, rightExpression); +// } +// +// public NonEqualViewExpression(ByteBuffer byteBuffer) { +// super(byteBuffer); +// } +// +// public NonEqualViewExpression(InputStream inputStream) { +// super(inputStream); +// } +// +// @Override +// public R accept(ViewExpressionVisitor visitor, C context) { +// return visitor.visitNonEqualExpression(this, context); +// } +// +// @Override +// public String getStringSymbol() { +// return "!="; +// } +// +// @Override +// public ViewExpressionType getExpressionType() { +// return ViewExpressionType.NON_EQUAL; +// } +// } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/logic/LogicAndViewExpression.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/logic/LogicAndViewExpression.java index 47b0c2d350c66..b87f445dd45ec 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/logic/LogicAndViewExpression.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/logic/LogicAndViewExpression.java @@ -1,57 +1,57 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iotdb.commons.schema.view.viewExpression.binary.logic; - -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; -import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; - -import java.io.InputStream; -import java.nio.ByteBuffer; - -public class LogicAndViewExpression extends LogicBinaryViewExpression { - - public LogicAndViewExpression(ViewExpression leftExpression, ViewExpression rightExpression) { - super(leftExpression, rightExpression); - } - - public LogicAndViewExpression(ByteBuffer byteBuffer) { - super(byteBuffer); - } - - public LogicAndViewExpression(InputStream inputStream) { - super(inputStream); - } - - @Override - public R accept(ViewExpressionVisitor visitor, C context) { - return visitor.visitLogicAndExpression(this, context); - } - - @Override - public String getStringSymbol() { - return "AND"; - } - - @Override - public ViewExpressionType getExpressionType() { - return ViewExpressionType.LOGIC_AND; - } -} +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// +// package org.apache.iotdb.commons.schema.view.viewExpression.binary.logic; +// +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; +// import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; +// +// import java.io.InputStream; +// import java.nio.ByteBuffer; +// +// public class LogicAndViewExpression extends LogicBinaryViewExpression { +// +// public LogicAndViewExpression(ViewExpression leftExpression, ViewExpression rightExpression) { +// super(leftExpression, rightExpression); +// } +// +// public LogicAndViewExpression(ByteBuffer byteBuffer) { +// super(byteBuffer); +// } +// +// public LogicAndViewExpression(InputStream inputStream) { +// super(inputStream); +// } +// +// @Override +// public R accept(ViewExpressionVisitor visitor, C context) { +// return visitor.visitLogicAndExpression(this, context); +// } +// +// @Override +// public String getStringSymbol() { +// return "AND"; +// } +// +// @Override +// public ViewExpressionType getExpressionType() { +// return ViewExpressionType.LOGIC_AND; +// } +// } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/logic/LogicBinaryViewExpression.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/logic/LogicBinaryViewExpression.java index 46631b1d657b7..bb30d227d72d5 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/logic/LogicBinaryViewExpression.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/logic/LogicBinaryViewExpression.java @@ -1,53 +1,53 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iotdb.commons.schema.view.viewExpression.binary.logic; - -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.BinaryViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; - -import java.io.InputStream; -import java.nio.ByteBuffer; - -public abstract class LogicBinaryViewExpression extends BinaryViewExpression { - - // region member variables and init functions - protected LogicBinaryViewExpression( - ViewExpression leftExpression, ViewExpression rightExpression) { - super(leftExpression, rightExpression); - } - - protected LogicBinaryViewExpression(ByteBuffer byteBuffer) { - super(byteBuffer); - } - - protected LogicBinaryViewExpression(InputStream inputStream) { - super(inputStream); - } - - // endregion - - // region common interfaces that have to be implemented - @Override - public R accept(ViewExpressionVisitor visitor, C context) { - return visitor.visitLogicBinaryExpression(this, context); - } - // endregion -} +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// +// package org.apache.iotdb.commons.schema.view.viewExpression.binary.logic; +// +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.BinaryViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; +// +// import java.io.InputStream; +// import java.nio.ByteBuffer; +// +// public abstract class LogicBinaryViewExpression extends BinaryViewExpression { +// +// // region member variables and init functions +// protected LogicBinaryViewExpression( +// ViewExpression leftExpression, ViewExpression rightExpression) { +// super(leftExpression, rightExpression); +// } +// +// protected LogicBinaryViewExpression(ByteBuffer byteBuffer) { +// super(byteBuffer); +// } +// +// protected LogicBinaryViewExpression(InputStream inputStream) { +// super(inputStream); +// } + +// // endregion +// +// // region common interfaces that have to be implemented +// @Override +// public R accept(ViewExpressionVisitor visitor, C context) { +// return visitor.visitLogicBinaryExpression(this, context); +// } +// // endregion +// } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/logic/LogicOrViewExpression.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/logic/LogicOrViewExpression.java index 9e540c80aacab..765f6477e513a 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/logic/LogicOrViewExpression.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/binary/logic/LogicOrViewExpression.java @@ -1,57 +1,57 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iotdb.commons.schema.view.viewExpression.binary.logic; - -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; -import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; - -import java.io.InputStream; -import java.nio.ByteBuffer; - -public class LogicOrViewExpression extends LogicBinaryViewExpression { - - public LogicOrViewExpression(ViewExpression leftExpression, ViewExpression rightExpression) { - super(leftExpression, rightExpression); - } - - public LogicOrViewExpression(ByteBuffer byteBuffer) { - super(byteBuffer); - } - - public LogicOrViewExpression(InputStream inputStream) { - super(inputStream); - } - - @Override - public R accept(ViewExpressionVisitor visitor, C context) { - return visitor.visitLogicOrExpression(this, context); - } - - @Override - public String getStringSymbol() { - return "OR"; - } - - @Override - public ViewExpressionType getExpressionType() { - return ViewExpressionType.LOGIC_OR; - } -} +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// +// package org.apache.iotdb.commons.schema.view.viewExpression.binary.logic; +// +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; +// import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; +// +// import java.io.InputStream; +// import java.nio.ByteBuffer; +// +// public class LogicOrViewExpression extends LogicBinaryViewExpression { +// +// public LogicOrViewExpression(ViewExpression leftExpression, ViewExpression rightExpression) { +// super(leftExpression, rightExpression); +// } +// +// public LogicOrViewExpression(ByteBuffer byteBuffer) { +// super(byteBuffer); +// } +// +// public LogicOrViewExpression(InputStream inputStream) { +// super(inputStream); +// } +// +// @Override +// public R accept(ViewExpressionVisitor visitor, C context) { +// return visitor.visitLogicOrExpression(this, context); +// } +// +// @Override +// public String getStringSymbol() { +// return "OR"; +// } +// +// @Override +// public ViewExpressionType getExpressionType() { +// return ViewExpressionType.LOGIC_OR; +// } +// } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/leaf/ConstantViewOperand.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/leaf/ConstantViewOperand.java index edfe3127c59bc..c447b09b1ae09 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/leaf/ConstantViewOperand.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/leaf/ConstantViewOperand.java @@ -1,98 +1,99 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iotdb.commons.schema.view.viewExpression.leaf; - -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; -import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; - +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// +// package org.apache.iotdb.commons.schema.view.viewExpression.leaf; +// +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; +// import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; +// +// import org.apache.commons.lang3.Validate; import org.apache.tsfile.enums.TSDataType; import org.apache.tsfile.external.commons.lang3.Validate; import org.apache.tsfile.utils.ReadWriteIOUtils; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.nio.ByteBuffer; - -public class ConstantViewOperand extends LeafViewOperand { - - // region member variables and init functions - private final String valueString; - private final TSDataType dataType; - - public ConstantViewOperand(TSDataType dataType, String valueString) { - this.dataType = Validate.notNull(dataType); - this.valueString = Validate.notNull(valueString); - } - - public ConstantViewOperand(ByteBuffer byteBuffer) { - dataType = TSDataType.deserializeFrom(byteBuffer); - valueString = ReadWriteIOUtils.readString(byteBuffer); - } - - public ConstantViewOperand(InputStream inputStream) { - try { - dataType = TSDataType.deserialize(ReadWriteIOUtils.readByte(inputStream)); - valueString = ReadWriteIOUtils.readString(inputStream); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - // endregion - - // region common interfaces that have to be implemented - @Override - public R accept(ViewExpressionVisitor visitor, C context) { - return visitor.visitConstantOperand(this, context); - } - - @Override - public ViewExpressionType getExpressionType() { - return ViewExpressionType.CONSTANT; - } - - @Override - public String toString(boolean isRoot) { - return this.valueString; - } - - @Override - protected void serialize(ByteBuffer byteBuffer) { - dataType.serializeTo(byteBuffer); - ReadWriteIOUtils.write(valueString, byteBuffer); - } - - @Override - protected void serialize(OutputStream stream) throws IOException { - stream.write(dataType.serialize()); - ReadWriteIOUtils.write(valueString, stream); - } - - // endregion - - public TSDataType getDataType() { - return dataType; - } - - public String getValueString() { - return valueString; - } -} +// +// import java.io.IOException; +// import java.io.InputStream; +// import java.io.OutputStream; +// import java.nio.ByteBuffer; +// +// public class ConstantViewOperand extends LeafViewOperand { +// +// // region member variables and init functions +// private final String valueString; +// private final TSDataType dataType; +// +// public ConstantViewOperand(TSDataType dataType, String valueString) { +// this.dataType = Validate.notNull(dataType); +// this.valueString = Validate.notNull(valueString); +// } +// +// public ConstantViewOperand(ByteBuffer byteBuffer) { +// dataType = TSDataType.deserializeFrom(byteBuffer); +// valueString = ReadWriteIOUtils.readString(byteBuffer); +// } +// +// public ConstantViewOperand(InputStream inputStream) { +// try { +// dataType = TSDataType.deserialize(ReadWriteIOUtils.readByte(inputStream)); +// valueString = ReadWriteIOUtils.readString(inputStream); +// } catch (IOException e) { +// throw new RuntimeException(e); +// } +// } +// +// // endregion +// +// // region common interfaces that have to be implemented +// @Override +// public R accept(ViewExpressionVisitor visitor, C context) { +// return visitor.visitConstantOperand(this, context); +// } +// +// @Override +// public ViewExpressionType getExpressionType() { +// return ViewExpressionType.CONSTANT; +// } +// +// @Override +// public String toString(boolean isRoot) { +// return this.valueString; +// } +// +// @Override +// protected void serialize(ByteBuffer byteBuffer) { +// dataType.serializeTo(byteBuffer); +// ReadWriteIOUtils.write(valueString, byteBuffer); +// } +// +// @Override +// protected void serialize(OutputStream stream) throws IOException { +// stream.write(dataType.serialize()); +// ReadWriteIOUtils.write(valueString, stream); +// } +// +// // endregion +// +// public TSDataType getDataType() { +// return dataType; +// } +// +// public String getValueString() { +// return valueString; +// } +// } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/leaf/LeafViewOperand.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/leaf/LeafViewOperand.java index ac9cfee5feeb2..1a899e3fa4481 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/leaf/LeafViewOperand.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/leaf/LeafViewOperand.java @@ -1,39 +1,39 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iotdb.commons.schema.view.viewExpression.leaf; - -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; - -import java.util.ArrayList; -import java.util.List; - -public abstract class LeafViewOperand extends ViewExpression { - - @Override - protected final boolean isLeafOperandInternal() { - return true; - } - - @Override - public final List getChildViewExpressions() { - // leaf node has no child nodes. - return new ArrayList<>(); - } -} +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// +// package org.apache.iotdb.commons.schema.view.viewExpression.leaf; +// +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// +// import java.util.ArrayList; +// import java.util.List; +// +// public abstract class LeafViewOperand extends ViewExpression { +// +// @Override +// protected final boolean isLeafOperandInternal() { +// return true; +// } +// +// @Override +// public final List getChildViewExpressions() { +// // leaf node has no child nodes. +// return new ArrayList<>(); +// } +// } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/leaf/NullViewOperand.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/leaf/NullViewOperand.java index 955e83e293d8c..4f6e2bd7e80c6 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/leaf/NullViewOperand.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/leaf/NullViewOperand.java @@ -1,63 +1,63 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iotdb.commons.schema.view.viewExpression.leaf; - -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; -import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; - -import java.io.IOException; -import java.io.OutputStream; -import java.nio.ByteBuffer; - -public class NullViewOperand extends LeafViewOperand { - - // region member variables and init functions +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// +// package org.apache.iotdb.commons.schema.view.viewExpression.leaf; +// +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; +// import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; +// +// import java.io.IOException; +// import java.io.OutputStream; +// import java.nio.ByteBuffer; +// +// public class NullViewOperand extends LeafViewOperand { +// +// // region member variables and init functions public NullViewOperand() {} ; - // endregion - - // region common interfaces that have to be implemented - @Override - public R accept(ViewExpressionVisitor visitor, C context) { - return visitor.visitNullOperand(this, context); - } - - @Override - public ViewExpressionType getExpressionType() { - return ViewExpressionType.NULL; - } - - @Override - public String toString(boolean isRoot) { - return "null"; - } - - @Override - protected void serialize(ByteBuffer byteBuffer) { - // do nothing - } - - @Override - protected void serialize(OutputStream stream) throws IOException { - // do nothing - } - // endregion -} +// // endregion +// +// // region common interfaces that have to be implemented +// @Override +// public R accept(ViewExpressionVisitor visitor, C context) { +// return visitor.visitNullOperand(this, context); +// } +// +// @Override +// public ViewExpressionType getExpressionType() { +// return ViewExpressionType.NULL; +// } +// +// @Override +// public String toString(boolean isRoot) { +// return "null"; +// } +// +// @Override +// protected void serialize(ByteBuffer byteBuffer) { +// // do nothing +// } +// +// @Override +// protected void serialize(OutputStream stream) throws IOException { +// // do nothing +// } +// // endregion +// } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/leaf/TimeSeriesViewOperand.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/leaf/TimeSeriesViewOperand.java index e530dee48799f..2dab5c6eb9800 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/leaf/TimeSeriesViewOperand.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/leaf/TimeSeriesViewOperand.java @@ -1,93 +1,93 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iotdb.commons.schema.view.viewExpression.leaf; - -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; -import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// +// package org.apache.iotdb.commons.schema.view.viewExpression.leaf; +// +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; +// import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; import org.apache.tsfile.utils.ReadWriteIOUtils; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.nio.ByteBuffer; +// +// import java.io.IOException; +// import java.io.InputStream; +// import java.io.OutputStream; +// import java.nio.ByteBuffer; import java.util.Objects; - -public class TimeSeriesViewOperand extends LeafViewOperand { - - // region member variables and init functions - private String pathString; - - public TimeSeriesViewOperand(String path) { - this.pathString = path; - } - - public TimeSeriesViewOperand(ByteBuffer byteBuffer) { - this.pathString = ReadWriteIOUtils.readString(byteBuffer); - } - - public TimeSeriesViewOperand(InputStream inputStream) { - try { - this.pathString = ReadWriteIOUtils.readString(inputStream); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - // endregion - - // region common interfaces that have to be implemented - @Override - public R accept(ViewExpressionVisitor visitor, C context) { - return visitor.visitTimeSeriesOperand(this, context); - } - - @Override - public ViewExpressionType getExpressionType() { - return ViewExpressionType.TIMESERIES; - } - - @Override - public String toString(boolean isRoot) { - return this.pathString; - } - - @Override - protected void serialize(ByteBuffer byteBuffer) { - ReadWriteIOUtils.write(pathString, byteBuffer); - } - - @Override - protected void serialize(OutputStream stream) throws IOException { - ReadWriteIOUtils.write(pathString, stream); - } - - // endregion - - public String getPathString() { - return pathString; - } - - public void setPathString(String path) { - this.pathString = path; - } +// +// public class TimeSeriesViewOperand extends LeafViewOperand { +// +// // region member variables and init functions +// private String pathString; +// +// public TimeSeriesViewOperand(String path) { +// this.pathString = path; +// } +// +// public TimeSeriesViewOperand(ByteBuffer byteBuffer) { +// this.pathString = ReadWriteIOUtils.readString(byteBuffer); +// } +// +// public TimeSeriesViewOperand(InputStream inputStream) { +// try { +// this.pathString = ReadWriteIOUtils.readString(inputStream); +// } catch (IOException e) { +// throw new RuntimeException(e); +// } +// } + +// // endregion +// +// // region common interfaces that have to be implemented +// @Override +// public R accept(ViewExpressionVisitor visitor, C context) { +// return visitor.visitTimeSeriesOperand(this, context); +// } +// +// @Override +// public ViewExpressionType getExpressionType() { +// return ViewExpressionType.TIMESERIES; +// } +// +// @Override +// public String toString(boolean isRoot) { +// return this.pathString; +// } +// +// @Override +// protected void serialize(ByteBuffer byteBuffer) { +// ReadWriteIOUtils.write(pathString, byteBuffer); +// } +// +// @Override +// protected void serialize(OutputStream stream) throws IOException { +// ReadWriteIOUtils.write(pathString, stream); +// } + +// // endregion +// +// public String getPathString() { +// return pathString; +// } +// +// public void setPathString(String path) { +// this.pathString = path; +// } @Override public boolean equals(Object o) { @@ -101,4 +101,4 @@ public boolean equals(Object o) { public int hashCode() { return Objects.hash(pathString); } -} +// } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/leaf/TimestampViewOperand.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/leaf/TimestampViewOperand.java index a64d720c1fcdb..88434dec8a71c 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/leaf/TimestampViewOperand.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/leaf/TimestampViewOperand.java @@ -1,74 +1,74 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iotdb.commons.schema.view.viewExpression.leaf; - -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; -import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.nio.ByteBuffer; - -public class TimestampViewOperand extends LeafViewOperand { - // region member variables and init functions - public TimestampViewOperand() { - // do nothing +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// +// package org.apache.iotdb.commons.schema.view.viewExpression.leaf; +// +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; +// import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; +// +// import java.io.IOException; +// import java.io.InputStream; +// import java.io.OutputStream; +// import java.nio.ByteBuffer; +// +// public class TimestampViewOperand extends LeafViewOperand { +// // region member variables and init functions +// public TimestampViewOperand() { +// // do nothing } ; +// +// public TimestampViewOperand(ByteBuffer byteBuffer) { +// // do nothing +// } +// +// public TimestampViewOperand(InputStream inputStream) { +// // do nothing +// } - public TimestampViewOperand(ByteBuffer byteBuffer) { - // do nothing - } - - public TimestampViewOperand(InputStream inputStream) { - // do nothing - } - - // endregion - - // region common interfaces that have to be implemented - @Override - public R accept(ViewExpressionVisitor visitor, C context) { - return visitor.visitTimeStampOperand(this, context); - } - - @Override - public ViewExpressionType getExpressionType() { - return ViewExpressionType.TIMESTAMP; - } - - @Override - public String toString(boolean isRoot) { - return "TIMESTAMP"; - } - - @Override - protected void serialize(ByteBuffer byteBuffer) { - // do nothing - } - - @Override - protected void serialize(OutputStream stream) throws IOException { - // do nothing - } - - // endregion -} +// // endregion +// +// // region common interfaces that have to be implemented +// @Override +// public R accept(ViewExpressionVisitor visitor, C context) { +// return visitor.visitTimeStampOperand(this, context); +// } +// +// @Override +// public ViewExpressionType getExpressionType() { +// return ViewExpressionType.TIMESTAMP; +// } +// +// @Override +// public String toString(boolean isRoot) { +// return "TIMESTAMP"; +// } +// +// @Override +// protected void serialize(ByteBuffer byteBuffer) { +// // do nothing +// } +// +// @Override +// protected void serialize(OutputStream stream) throws IOException { +// // do nothing +// } +// +// // endregion +// } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/multi/FunctionViewExpression.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/multi/FunctionViewExpression.java index 1f73f59ae00f0..ebada44d13c4c 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/multi/FunctionViewExpression.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/multi/FunctionViewExpression.java @@ -1,134 +1,134 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iotdb.commons.schema.view.viewExpression.multi; - -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; -import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// +// package org.apache.iotdb.commons.schema.view.viewExpression.multi; +// +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; +// import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; import org.apache.tsfile.utils.ReadWriteIOUtils; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.nio.ByteBuffer; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; - -public class FunctionViewExpression extends ViewExpression { - +// +// import java.io.IOException; +// import java.io.InputStream; +// import java.io.OutputStream; +// import java.nio.ByteBuffer; +// import java.util.ArrayList; +// import java.util.LinkedHashMap; +// import java.util.List; +// +// public class FunctionViewExpression extends ViewExpression { +// /** region member variables and init functions */ - private final String functionName; - - /** - * for a map {key1: value1, key2: value2}, this struct saves String[]{"key1", "value1", "key2", - * "value2"} - */ - private final List functionAttributesKeyValueList; - - /** - * example: select udf(a, b, udf(c)) from root.sg.d; - * - *

3 expressions [root.sg.d.a, root.sg.d.b, udf(root.sg.d.c)] will be in this field. - */ - private List expressions; - - public FunctionViewExpression(String functionName) { - this.functionName = functionName; - functionAttributesKeyValueList = new ArrayList<>(); - expressions = new ArrayList<>(); - } - - public FunctionViewExpression( - String functionName, - List functionAttributeKeys, - List functionAttributeValues, - List expressions) { - this.functionName = functionName; - this.functionAttributesKeyValueList = new ArrayList<>(); - if (functionAttributeKeys.size() == functionAttributeValues.size()) { - for (int i = 0; i < functionAttributeKeys.size(); i++) { - this.functionAttributesKeyValueList.add(functionAttributeKeys.get(i)); - this.functionAttributesKeyValueList.add(functionAttributeValues.get(i)); - } - } else { - String errorMsg = +// private final String functionName; +// +// /** +// * for a map {key1: value1, key2: value2}, this struct saves String[]{"key1", "value1", "key2", +// * "value2"} +// */ +// private final List functionAttributesKeyValueList; +// +// /** +// * example: select udf(a, b, udf(c)) from root.sg.d; +// * +// *

3 expressions [root.sg.d.a, root.sg.d.b, udf(root.sg.d.c)] will be in this field. +// */ +// private List expressions; +// +// public FunctionViewExpression(String functionName) { +// this.functionName = functionName; +// functionAttributesKeyValueList = new ArrayList<>(); +// expressions = new ArrayList<>(); +// } +// +// public FunctionViewExpression( +// String functionName, +// List functionAttributeKeys, +// List functionAttributeValues, +// List expressions) { +// this.functionName = functionName; +// this.functionAttributesKeyValueList = new ArrayList<>(); +// if (functionAttributeKeys.size() == functionAttributeValues.size()) { +// for (int i = 0; i < functionAttributeKeys.size(); i++) { +// this.functionAttributesKeyValueList.add(functionAttributeKeys.get(i)); +// this.functionAttributesKeyValueList.add(functionAttributeValues.get(i)); +// } +// } else { +// String errorMsg = "Illegal parameters during FunctionExpression construction. Array length mismatch."; - throw new RuntimeException(errorMsg); - } - this.expressions = expressions; - } - - public FunctionViewExpression(ByteBuffer byteBuffer) { - functionName = ReadWriteIOUtils.readString(byteBuffer); - functionAttributesKeyValueList = ReadWriteIOUtils.readStringList(byteBuffer); - int expressionSize = ReadWriteIOUtils.readInt(byteBuffer); - expressions = new ArrayList<>(); - for (int i = 0; i < expressionSize; i++) { - expressions.add(ViewExpression.deserialize(byteBuffer)); - } - } - - public FunctionViewExpression(InputStream inputStream) { - try { - functionName = ReadWriteIOUtils.readString(inputStream); - functionAttributesKeyValueList = ReadWriteIOUtils.readStringList(inputStream); - int expressionSize = ReadWriteIOUtils.readInt(inputStream); - expressions = new ArrayList<>(); - for (int i = 0; i < expressionSize; i++) { - expressions.add(ViewExpression.deserialize(inputStream)); - } - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - // endregion - - // region common interfaces that have to be implemented - @Override - public R accept(ViewExpressionVisitor visitor, C context) { - return visitor.visitFunctionExpression(this, context); - } - - @Override - public ViewExpressionType getExpressionType() { - return ViewExpressionType.FUNCTION; - } - - @Override - protected boolean isLeafOperandInternal() { - // if this expression has no children, return true; else return false. +// throw new RuntimeException(errorMsg); +// } +// this.expressions = expressions; +// } +// +// public FunctionViewExpression(ByteBuffer byteBuffer) { +// functionName = ReadWriteIOUtils.readString(byteBuffer); +// functionAttributesKeyValueList = ReadWriteIOUtils.readStringList(byteBuffer); +// int expressionSize = ReadWriteIOUtils.readInt(byteBuffer); +// expressions = new ArrayList<>(); +// for (int i = 0; i < expressionSize; i++) { +// expressions.add(ViewExpression.deserialize(byteBuffer)); +// } +// } +// +// public FunctionViewExpression(InputStream inputStream) { +// try { +// functionName = ReadWriteIOUtils.readString(inputStream); +// functionAttributesKeyValueList = ReadWriteIOUtils.readStringList(inputStream); +// int expressionSize = ReadWriteIOUtils.readInt(inputStream); +// expressions = new ArrayList<>(); +// for (int i = 0; i < expressionSize; i++) { +// expressions.add(ViewExpression.deserialize(inputStream)); +// } +// } catch (IOException e) { +// throw new RuntimeException(e); +// } +// } + +// // endregion +// +// // region common interfaces that have to be implemented +// @Override +// public R accept(ViewExpressionVisitor visitor, C context) { +// return visitor.visitFunctionExpression(this, context); +// } +// +// @Override +// public ViewExpressionType getExpressionType() { +// return ViewExpressionType.FUNCTION; +// } +// +// @Override +// protected boolean isLeafOperandInternal() { +// // if this expression has no children, return true; else return false. return this.expressions.isEmpty(); - } - - @Override - public List getChildViewExpressions() { - return this.expressions; - } - - @Override - public String toString(boolean isRoot) { - StringBuilder result = new StringBuilder(this.functionName); - int keyValueSize = this.functionAttributesKeyValueList.size(); +// } +// +// @Override +// public List getChildViewExpressions() { +// return this.expressions; +// } +// +// @Override +// public String toString(boolean isRoot) { +// StringBuilder result = new StringBuilder(this.functionName); +// int keyValueSize = this.functionAttributesKeyValueList.size(); result.append("("); for (int i = 0; i < this.expressions.size(); i++) { @@ -139,66 +139,66 @@ public String toString(boolean isRoot) { result.append(", "); } - if (this.functionAttributesKeyValueList.size() > 1) { +// if (this.functionAttributesKeyValueList.size() > 1) { if (!this.expressions.isEmpty()) { result.append(", "); } - for (int i = 0; i + 1 < keyValueSize; i += 2) { - result - .append(this.functionAttributesKeyValueList.get(i)) - .append("=") - .append(this.functionAttributesKeyValueList.get(i + 1)); - if (i + 2 >= keyValueSize) { - break; - } - result.append(", "); - } - } - - result.append(")"); - return result.toString(); - } - - @Override - protected void serialize(ByteBuffer byteBuffer) { - ReadWriteIOUtils.write(functionName, byteBuffer); - ReadWriteIOUtils.writeStringList(functionAttributesKeyValueList, byteBuffer); - ReadWriteIOUtils.write(expressions.size(), byteBuffer); - for (ViewExpression expression : expressions) { - ViewExpression.serialize(expression, byteBuffer); - } - } - - @Override - protected void serialize(OutputStream stream) throws IOException { - ReadWriteIOUtils.write(functionName, stream); - ReadWriteIOUtils.writeStringList(functionAttributesKeyValueList, stream); - ReadWriteIOUtils.write(expressions.size(), stream); - for (ViewExpression expression : expressions) { - ViewExpression.serialize(expression, stream); - } - } - - // endregion - - public String getFunctionName() { - return this.functionName; - } - - public LinkedHashMap getFunctionAttributes() { - LinkedHashMap result = new LinkedHashMap<>(); - for (int i = 0; i + 1 < this.functionAttributesKeyValueList.size(); i += 2) { - result.put( - this.functionAttributesKeyValueList.get(i), - this.functionAttributesKeyValueList.get(i + 1)); - } - return result; - } - - public List getExpressions() { - return this.expressions; - } +// for (int i = 0; i + 1 < keyValueSize; i += 2) { +// result +// .append(this.functionAttributesKeyValueList.get(i)) +// .append("=") +// .append(this.functionAttributesKeyValueList.get(i + 1)); +// if (i + 2 >= keyValueSize) { +// break; +// } +// result.append(", "); +// } +// } + +// result.append(")"); +// return result.toString(); +// } +// +// @Override +// protected void serialize(ByteBuffer byteBuffer) { +// ReadWriteIOUtils.write(functionName, byteBuffer); +// ReadWriteIOUtils.writeStringList(functionAttributesKeyValueList, byteBuffer); +// ReadWriteIOUtils.write(expressions.size(), byteBuffer); +// for (ViewExpression expression : expressions) { +// ViewExpression.serialize(expression, byteBuffer); +// } +// } +// +// @Override +// protected void serialize(OutputStream stream) throws IOException { +// ReadWriteIOUtils.write(functionName, stream); +// ReadWriteIOUtils.writeStringList(functionAttributesKeyValueList, stream); +// ReadWriteIOUtils.write(expressions.size(), stream); +// for (ViewExpression expression : expressions) { +// ViewExpression.serialize(expression, stream); +// } +// } + +// // endregion +// +// public String getFunctionName() { +// return this.functionName; +// } +// +// public LinkedHashMap getFunctionAttributes() { +// LinkedHashMap result = new LinkedHashMap<>(); +// for (int i = 0; i + 1 < this.functionAttributesKeyValueList.size(); i += 2) { +// result.put( +// this.functionAttributesKeyValueList.get(i), +// this.functionAttributesKeyValueList.get(i + 1)); +// } +// return result; +// } +// +// public List getExpressions() { +// return this.expressions; +// } @Override public boolean equals(Object obj) { @@ -213,4 +213,4 @@ public boolean equals(Object obj) { && functionAttributesKeyValueList.equals(that.functionAttributesKeyValueList) && expressions.equals(that.expressions); } -} +// } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/ternary/BetweenViewExpression.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/ternary/BetweenViewExpression.java index e4af291fb08b0..c502ff85cfec8 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/ternary/BetweenViewExpression.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/ternary/BetweenViewExpression.java @@ -1,114 +1,114 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iotdb.commons.schema.view.viewExpression.ternary; - -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; -import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// +// package org.apache.iotdb.commons.schema.view.viewExpression.ternary; +// +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; +// import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; import org.apache.tsfile.utils.ReadWriteIOUtils; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.nio.ByteBuffer; - -public class BetweenViewExpression extends TernaryViewExpression { - - // region member variables and init functions - /** default value is false. */ - private final boolean isNotBetween; - - public BetweenViewExpression( - ViewExpression firstExpression, - ViewExpression secondExpression, - ViewExpression thirdExpression, - boolean isNotBetween) { - super(firstExpression, secondExpression, thirdExpression); - this.isNotBetween = isNotBetween; - } - - public BetweenViewExpression( - ViewExpression firstExpression, - ViewExpression secondExpression, - ViewExpression thirdExpression) { - super(firstExpression, secondExpression, thirdExpression); - this.isNotBetween = false; - } - - public BetweenViewExpression(ByteBuffer byteBuffer) { - super(byteBuffer); - this.isNotBetween = ReadWriteIOUtils.readBool(byteBuffer); - } - - public BetweenViewExpression(InputStream inputStream) { - super(inputStream); - try { - this.isNotBetween = ReadWriteIOUtils.readBool(inputStream); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - // endregion - - // region common interfaces that have to be implemented - @Override - public R accept(ViewExpressionVisitor visitor, C context) { - return visitor.visitBetweenExpression(this, context); - } - - @Override - public ViewExpressionType getExpressionType() { - return ViewExpressionType.BETWEEN; - } - - @Override - public String toString(boolean isRoot) { - String basicString = - this.firstExpression.toString(true) - + " BETWEEN " - + this.secondExpression.toString(false) - + " AND " - + this.secondExpression.toString(false); - if (isRoot) { - return basicString; - } - return "(" + basicString + ")"; - } - - @Override - protected void serialize(ByteBuffer byteBuffer) { - super.serialize(byteBuffer); - ReadWriteIOUtils.write(isNotBetween, byteBuffer); - } - - @Override - protected void serialize(OutputStream stream) throws IOException { - super.serialize(stream); - ReadWriteIOUtils.write(isNotBetween, stream); - } - - // endregion - - public boolean isNotBetween() { - return isNotBetween; - } -} +// +// import java.io.IOException; +// import java.io.InputStream; +// import java.io.OutputStream; +// import java.nio.ByteBuffer; +// +// public class BetweenViewExpression extends TernaryViewExpression { +// +// // region member variables and init functions +// /** default value is false. */ +// private final boolean isNotBetween; +// +// public BetweenViewExpression( +// ViewExpression firstExpression, +// ViewExpression secondExpression, +// ViewExpression thirdExpression, +// boolean isNotBetween) { +// super(firstExpression, secondExpression, thirdExpression); +// this.isNotBetween = isNotBetween; +// } +// +// public BetweenViewExpression( +// ViewExpression firstExpression, +// ViewExpression secondExpression, +// ViewExpression thirdExpression) { +// super(firstExpression, secondExpression, thirdExpression); +// this.isNotBetween = false; +// } +// +// public BetweenViewExpression(ByteBuffer byteBuffer) { +// super(byteBuffer); +// this.isNotBetween = ReadWriteIOUtils.readBool(byteBuffer); +// } +// +// public BetweenViewExpression(InputStream inputStream) { +// super(inputStream); +// try { +// this.isNotBetween = ReadWriteIOUtils.readBool(inputStream); +// } catch (IOException e) { +// throw new RuntimeException(e); +// } +// } + +// // endregion +// +// // region common interfaces that have to be implemented +// @Override +// public R accept(ViewExpressionVisitor visitor, C context) { +// return visitor.visitBetweenExpression(this, context); +// } +// +// @Override +// public ViewExpressionType getExpressionType() { +// return ViewExpressionType.BETWEEN; +// } +// +// @Override +// public String toString(boolean isRoot) { +// String basicString = +// this.firstExpression.toString(true) +// + " BETWEEN " +// + this.secondExpression.toString(false) +// + " AND " +// + this.secondExpression.toString(false); +// if (isRoot) { +// return basicString; +// } +// return "(" + basicString + ")"; +// } +// +// @Override +// protected void serialize(ByteBuffer byteBuffer) { +// super.serialize(byteBuffer); +// ReadWriteIOUtils.write(isNotBetween, byteBuffer); +// } +// +// @Override +// protected void serialize(OutputStream stream) throws IOException { +// super.serialize(stream); +// ReadWriteIOUtils.write(isNotBetween, stream); +// } + +// // endregion +// +// public boolean isNotBetween() { +// return isNotBetween; +// } +// } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/ternary/TernaryViewExpression.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/ternary/TernaryViewExpression.java index 9ce3c7b2352f7..c76dd70da08f7 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/ternary/TernaryViewExpression.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/ternary/TernaryViewExpression.java @@ -1,107 +1,107 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iotdb.commons.schema.view.viewExpression.ternary; - -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.nio.ByteBuffer; -import java.util.Arrays; -import java.util.List; - -public abstract class TernaryViewExpression extends ViewExpression { - - // region member variables and init functions - protected final ViewExpression firstExpression; - - protected final ViewExpression secondExpression; - - protected final ViewExpression thirdExpression; - - protected TernaryViewExpression( - ViewExpression firstExpression, - ViewExpression secondExpression, - ViewExpression thirdExpression) { - this.firstExpression = firstExpression; - this.secondExpression = secondExpression; - this.thirdExpression = thirdExpression; - } - - protected TernaryViewExpression(ByteBuffer byteBuffer) { - this.firstExpression = ViewExpression.deserialize(byteBuffer); - this.secondExpression = ViewExpression.deserialize(byteBuffer); - this.thirdExpression = ViewExpression.deserialize(byteBuffer); - } - - protected TernaryViewExpression(InputStream inputStream) { - this.firstExpression = ViewExpression.deserialize(inputStream); - this.secondExpression = ViewExpression.deserialize(inputStream); - this.thirdExpression = ViewExpression.deserialize(inputStream); - } - - // endregion - - // region common interfaces that have to be implemented - @Override - public R accept(ViewExpressionVisitor visitor, C context) { - return visitor.visitTernaryExpression(this, context); - } - - @Override - protected final boolean isLeafOperandInternal() { - return false; - } - - @Override - public final List getChildViewExpressions() { - return Arrays.asList(firstExpression, secondExpression, thirdExpression); - } - - @Override - protected void serialize(ByteBuffer byteBuffer) { - ViewExpression.serialize(firstExpression, byteBuffer); - ViewExpression.serialize(secondExpression, byteBuffer); - ViewExpression.serialize(thirdExpression, byteBuffer); - } - - @Override - protected void serialize(OutputStream stream) throws IOException { - ViewExpression.serialize(firstExpression, stream); - ViewExpression.serialize(secondExpression, stream); - ViewExpression.serialize(thirdExpression, stream); - } - - // endregion - - public ViewExpression getFirstExpression() { - return this.firstExpression; - } - - public ViewExpression getSecondExpression() { - return this.secondExpression; - } - - public ViewExpression getThirdExpression() { - return this.thirdExpression; - } -} +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// +// package org.apache.iotdb.commons.schema.view.viewExpression.ternary; +// +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; +// +// import java.io.IOException; +// import java.io.InputStream; +// import java.io.OutputStream; +// import java.nio.ByteBuffer; +// import java.util.Arrays; +// import java.util.List; +// +// public abstract class TernaryViewExpression extends ViewExpression { +// +// // region member variables and init functions +// protected final ViewExpression firstExpression; +// +// protected final ViewExpression secondExpression; +// +// protected final ViewExpression thirdExpression; +// +// protected TernaryViewExpression( +// ViewExpression firstExpression, +// ViewExpression secondExpression, +// ViewExpression thirdExpression) { +// this.firstExpression = firstExpression; +// this.secondExpression = secondExpression; +// this.thirdExpression = thirdExpression; +// } +// +// protected TernaryViewExpression(ByteBuffer byteBuffer) { +// this.firstExpression = ViewExpression.deserialize(byteBuffer); +// this.secondExpression = ViewExpression.deserialize(byteBuffer); +// this.thirdExpression = ViewExpression.deserialize(byteBuffer); +// } +// +// protected TernaryViewExpression(InputStream inputStream) { +// this.firstExpression = ViewExpression.deserialize(inputStream); +// this.secondExpression = ViewExpression.deserialize(inputStream); +// this.thirdExpression = ViewExpression.deserialize(inputStream); +// } + +// // endregion +// +// // region common interfaces that have to be implemented +// @Override +// public R accept(ViewExpressionVisitor visitor, C context) { +// return visitor.visitTernaryExpression(this, context); +// } +// +// @Override +// protected final boolean isLeafOperandInternal() { +// return false; +// } +// +// @Override +// public final List getChildViewExpressions() { +// return Arrays.asList(firstExpression, secondExpression, thirdExpression); +// } +// +// @Override +// protected void serialize(ByteBuffer byteBuffer) { +// ViewExpression.serialize(firstExpression, byteBuffer); +// ViewExpression.serialize(secondExpression, byteBuffer); +// ViewExpression.serialize(thirdExpression, byteBuffer); +// } +// +// @Override +// protected void serialize(OutputStream stream) throws IOException { +// ViewExpression.serialize(firstExpression, stream); +// ViewExpression.serialize(secondExpression, stream); +// ViewExpression.serialize(thirdExpression, stream); +// } + +// // endregion +// +// public ViewExpression getFirstExpression() { +// return this.firstExpression; +// } +// +// public ViewExpression getSecondExpression() { +// return this.secondExpression; +// } +// +// public ViewExpression getThirdExpression() { +// return this.thirdExpression; +// } +// } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/unary/InViewExpression.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/unary/InViewExpression.java index 50441bbf946e8..f11402792e84d 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/unary/InViewExpression.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/unary/InViewExpression.java @@ -1,109 +1,109 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iotdb.commons.schema.view.viewExpression.unary; - -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; -import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// +// package org.apache.iotdb.commons.schema.view.viewExpression.unary; +// +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; +// import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; import org.apache.tsfile.utils.ReadWriteIOUtils; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.nio.ByteBuffer; -import java.util.LinkedHashSet; -import java.util.List; - -public class InViewExpression extends UnaryViewExpression { - - // region member variables and init functions - private final boolean isNotIn; - - private final List valueList; - - public InViewExpression(ViewExpression expression, boolean isNotIn, List values) { - super(expression); - this.isNotIn = isNotIn; - this.valueList = values; - } - - public InViewExpression(ByteBuffer byteBuffer) { - super(ViewExpression.deserialize(byteBuffer)); - isNotIn = ReadWriteIOUtils.readBool(byteBuffer); - valueList = ReadWriteIOUtils.readStringList(byteBuffer); - } - - public InViewExpression(InputStream inputStream) { - super(ViewExpression.deserialize(inputStream)); - try { - isNotIn = ReadWriteIOUtils.readBool(inputStream); - valueList = ReadWriteIOUtils.readStringList(inputStream); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - // endregion - - // region common interfaces that have to be implemented - @Override - public R accept(ViewExpressionVisitor visitor, C context) { - return visitor.visitInExpression(this, context); - } - - @Override - public ViewExpressionType getExpressionType() { - return ViewExpressionType.IN; - } - - @Override - public String toString(boolean isRoot) { - return "IN " + this.expression.toString(); - } - - @Override - protected void serialize(ByteBuffer byteBuffer) { - super.serialize(byteBuffer); - ReadWriteIOUtils.write(isNotIn, byteBuffer); - ReadWriteIOUtils.writeStringList(this.valueList, byteBuffer); - } - - @Override - protected void serialize(OutputStream stream) throws IOException { - super.serialize(stream); - ReadWriteIOUtils.write(isNotIn, stream); - ReadWriteIOUtils.writeStringList(this.valueList, stream); - } - - // endregion - - public boolean isNotIn() { - return isNotIn; - } - - public LinkedHashSet getValuesInLinkedHashSet() { - return new LinkedHashSet<>(this.valueList); - } - - public List getValueList() { - return this.valueList; - } -} +// +// import java.io.IOException; +// import java.io.InputStream; +// import java.io.OutputStream; +// import java.nio.ByteBuffer; +// import java.util.LinkedHashSet; +// import java.util.List; +// +// public class InViewExpression extends UnaryViewExpression { +// +// // region member variables and init functions +// private final boolean isNotIn; +// +// private final List valueList; +// +// public InViewExpression(ViewExpression expression, boolean isNotIn, List values) { +// super(expression); +// this.isNotIn = isNotIn; +// this.valueList = values; +// } +// +// public InViewExpression(ByteBuffer byteBuffer) { +// super(ViewExpression.deserialize(byteBuffer)); +// isNotIn = ReadWriteIOUtils.readBool(byteBuffer); +// valueList = ReadWriteIOUtils.readStringList(byteBuffer); +// } +// +// public InViewExpression(InputStream inputStream) { +// super(ViewExpression.deserialize(inputStream)); +// try { +// isNotIn = ReadWriteIOUtils.readBool(inputStream); +// valueList = ReadWriteIOUtils.readStringList(inputStream); +// } catch (IOException e) { +// throw new RuntimeException(e); +// } +// } + +// // endregion +// +// // region common interfaces that have to be implemented +// @Override +// public R accept(ViewExpressionVisitor visitor, C context) { +// return visitor.visitInExpression(this, context); +// } +// +// @Override +// public ViewExpressionType getExpressionType() { +// return ViewExpressionType.IN; +// } +// +// @Override +// public String toString(boolean isRoot) { +// return "IN " + this.expression.toString(); +// } +// +// @Override +// protected void serialize(ByteBuffer byteBuffer) { +// super.serialize(byteBuffer); +// ReadWriteIOUtils.write(isNotIn, byteBuffer); +// ReadWriteIOUtils.writeStringList(this.valueList, byteBuffer); +// } +// +// @Override +// protected void serialize(OutputStream stream) throws IOException { +// super.serialize(stream); +// ReadWriteIOUtils.write(isNotIn, stream); +// ReadWriteIOUtils.writeStringList(this.valueList, stream); +// } + +// // endregion +// +// public boolean isNotIn() { +// return isNotIn; +// } +// +// public LinkedHashSet getValuesInLinkedHashSet() { +// return new LinkedHashSet<>(this.valueList); +// } +// +// public List getValueList() { +// return this.valueList; +// } +// } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/unary/IsNullViewExpression.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/unary/IsNullViewExpression.java index 655418c5bf895..808b12123934d 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/unary/IsNullViewExpression.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/unary/IsNullViewExpression.java @@ -1,92 +1,92 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iotdb.commons.schema.view.viewExpression.unary; - -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; -import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// +// package org.apache.iotdb.commons.schema.view.viewExpression.unary; +// +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; +// import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; import org.apache.tsfile.utils.ReadWriteIOUtils; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.nio.ByteBuffer; - -public class IsNullViewExpression extends UnaryViewExpression { - - // region member variables and init functions - private final boolean isNot; - - public IsNullViewExpression(ViewExpression expression, boolean isNot) { - super(expression); - this.isNot = isNot; - } - - public IsNullViewExpression(ByteBuffer byteBuffer) { - super(ViewExpression.deserialize(byteBuffer)); - isNot = ReadWriteIOUtils.readBool(byteBuffer); - } - - public IsNullViewExpression(InputStream inputStream) { - super(ViewExpression.deserialize(inputStream)); - try { - isNot = ReadWriteIOUtils.readBool(inputStream); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - // endregion - - // region common interfaces that have to be implemented - @Override - public R accept(ViewExpressionVisitor visitor, C context) { - return visitor.visitIsNullExpression(this, context); - } - - @Override - public ViewExpressionType getExpressionType() { - return ViewExpressionType.IS_NULL; - } - - @Override - public String toString(boolean isRoot) { - return this.expression.toString(false) + " IS_NULL"; - } - - @Override - protected void serialize(ByteBuffer byteBuffer) { - super.serialize(byteBuffer); - ReadWriteIOUtils.write(isNot, byteBuffer); - } - - @Override - protected void serialize(OutputStream stream) throws IOException { - super.serialize(stream); - ReadWriteIOUtils.write(isNot, stream); - } - - // endregion - - public boolean isNot() { - return isNot; - } -} +// +// import java.io.IOException; +// import java.io.InputStream; +// import java.io.OutputStream; +// import java.nio.ByteBuffer; +// +// public class IsNullViewExpression extends UnaryViewExpression { +// +// // region member variables and init functions +// private final boolean isNot; +// +// public IsNullViewExpression(ViewExpression expression, boolean isNot) { +// super(expression); +// this.isNot = isNot; +// } +// +// public IsNullViewExpression(ByteBuffer byteBuffer) { +// super(ViewExpression.deserialize(byteBuffer)); +// isNot = ReadWriteIOUtils.readBool(byteBuffer); +// } +// +// public IsNullViewExpression(InputStream inputStream) { +// super(ViewExpression.deserialize(inputStream)); +// try { +// isNot = ReadWriteIOUtils.readBool(inputStream); +// } catch (IOException e) { +// throw new RuntimeException(e); +// } +// } + +// // endregion +// +// // region common interfaces that have to be implemented +// @Override +// public R accept(ViewExpressionVisitor visitor, C context) { +// return visitor.visitIsNullExpression(this, context); +// } +// +// @Override +// public ViewExpressionType getExpressionType() { +// return ViewExpressionType.IS_NULL; +// } +// +// @Override +// public String toString(boolean isRoot) { +// return this.expression.toString(false) + " IS_NULL"; +// } +// +// @Override +// protected void serialize(ByteBuffer byteBuffer) { +// super.serialize(byteBuffer); +// ReadWriteIOUtils.write(isNot, byteBuffer); +// } +// +// @Override +// protected void serialize(OutputStream stream) throws IOException { +// super.serialize(stream); +// ReadWriteIOUtils.write(isNot, stream); +// } + +// // endregion +// +// public boolean isNot() { +// return isNot; +// } +// } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/unary/LikeViewExpression.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/unary/LikeViewExpression.java index 96c41008bddd4..1fe5195e6a1f4 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/unary/LikeViewExpression.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/unary/LikeViewExpression.java @@ -1,60 +1,60 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iotdb.commons.schema.view.viewExpression.unary; - -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; -import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// +// package org.apache.iotdb.commons.schema.view.viewExpression.unary; +// +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; +// import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; import org.apache.tsfile.utils.ReadWriteIOUtils; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.nio.ByteBuffer; +// +// import java.io.IOException; +// import java.io.InputStream; +// import java.io.OutputStream; +// import java.nio.ByteBuffer; import java.util.Optional; -public class LikeViewExpression extends UnaryViewExpression { - - // region member variables and init functions +// public class LikeViewExpression extends UnaryViewExpression { +// +// // region member variables and init functions private final String pattern; private final Optional escape; private final boolean isNot; public LikeViewExpression( ViewExpression expression, String pattern, Optional escape, boolean isNot) { - super(expression); +// super(expression); this.pattern = pattern; this.escape = escape; this.isNot = isNot; - } - +// } +// public LikeViewExpression(ViewExpression expression, String pattern, boolean isNot) { - super(expression); - this.pattern = pattern; +// super(expression); +// this.pattern = pattern; this.escape = Optional.empty(); this.isNot = isNot; - } - - public LikeViewExpression(ByteBuffer byteBuffer) { - super(ViewExpression.deserialize(byteBuffer)); +// } +// +// public LikeViewExpression(ByteBuffer byteBuffer) { +// super(ViewExpression.deserialize(byteBuffer)); pattern = ReadWriteIOUtils.readString(byteBuffer); // Read the flag to determine whether the current code is 1.3.x or 2.0.x. // If it is 1.3.x, we expect to read a boolean value, assign it to isNot, and set escape to @@ -82,11 +82,11 @@ public LikeViewExpression(ByteBuffer byteBuffer) { default: throw new IllegalStateException("Unexpected value in LikeViewExpression: " + judge); } - } - - public LikeViewExpression(InputStream inputStream) { - super(ViewExpression.deserialize(inputStream)); - try { +// } +// +// public LikeViewExpression(InputStream inputStream) { +// super(ViewExpression.deserialize(inputStream)); +// try { pattern = ReadWriteIOUtils.readString(inputStream); // Read the flag to determine whether the current code is 1.3.x or 2.0.x. // If it is 1.3.x, we expect to read a boolean value, assign it to isNot, and set escape to @@ -115,26 +115,26 @@ public LikeViewExpression(InputStream inputStream) { default: throw new IllegalStateException("Unexpected value in LikeViewExpression: " + judge); } - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - // endregion - - // region common interfaces that have to be implemented - @Override - public R accept(ViewExpressionVisitor visitor, C context) { - return visitor.visitLikeExpression(this, context); - } - - @Override - public ViewExpressionType getExpressionType() { - return ViewExpressionType.LIKE; - } - - @Override - public String toString(boolean isRoot) { +// } catch (IOException e) { +// throw new RuntimeException(e); +// } +// } + +// // endregion +// +// // region common interfaces that have to be implemented +// @Override +// public R accept(ViewExpressionVisitor visitor, C context) { +// return visitor.visitLikeExpression(this, context); +// } +// +// @Override +// public ViewExpressionType getExpressionType() { +// return ViewExpressionType.LIKE; +// } +// +// @Override +// public String toString(boolean isRoot) { String basicString = this.expression.toString(false) + (isNot ? "NOT LIKE " : "LIKE ") @@ -144,15 +144,15 @@ public String toString(boolean isRoot) { if (escape.isPresent()) { basicString += " escape = '" + escape.get() + "'"; } - if (isRoot) { - return basicString; - } - return "( " + basicString + " )"; - } - - @Override +// if (isRoot) { +// return basicString; +// } +// return "( " + basicString + " )"; +// } +// +// @Override public void serialize(ByteBuffer byteBuffer) { - super.serialize(byteBuffer); +// super.serialize(byteBuffer); ReadWriteIOUtils.write(pattern, byteBuffer); // This flag is added to be compatible with versions 1.3.x and 2.0.x ReadWriteIOUtils.write((byte) 2, byteBuffer); @@ -161,11 +161,11 @@ public void serialize(ByteBuffer byteBuffer) { ReadWriteIOUtils.write(escape.get().toString(), byteBuffer); } ReadWriteIOUtils.write(isNot, byteBuffer); - } - - @Override +// } +// +// @Override public void serialize(OutputStream stream) throws IOException { - super.serialize(stream); +// super.serialize(stream); ReadWriteIOUtils.write(pattern, stream); // This flag is added to be compatible with versions 1.3.x and 2.0.x ReadWriteIOUtils.write((byte) 2, stream); @@ -174,18 +174,18 @@ public void serialize(OutputStream stream) throws IOException { ReadWriteIOUtils.write(escape.get().toString(), stream); } ReadWriteIOUtils.write(isNot, stream); - } - - // endregion +// } +// // endregion +// public String getPattern() { return pattern; - } - +// } +// public Optional getEscape() { return escape; - } - +// } +// public boolean isNot() { return isNot; } @@ -204,4 +204,4 @@ public boolean equals(Object obj) { && escape.equals(target.escape) && isNot == target.isNot; } -} +// } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/unary/LogicNotViewExpression.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/unary/LogicNotViewExpression.java index b3eb5924b4219..a8f314d0e73f8 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/unary/LogicNotViewExpression.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/unary/LogicNotViewExpression.java @@ -1,62 +1,62 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iotdb.commons.schema.view.viewExpression.unary; - -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; -import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; - -import java.io.InputStream; -import java.nio.ByteBuffer; - -public class LogicNotViewExpression extends UnaryViewExpression { - - // region member variables and init functions - public LogicNotViewExpression(ViewExpression expression) { - super(expression); - } - - public LogicNotViewExpression(ByteBuffer byteBuffer) { - super(ViewExpression.deserialize(byteBuffer)); - } - - public LogicNotViewExpression(InputStream inputStream) { - super(ViewExpression.deserialize(inputStream)); - } - - // endregion - - // region common interfaces that have to be implemented - @Override - public R accept(ViewExpressionVisitor visitor, C context) { - return visitor.visitLogicNotExpression(this, context); - } - - @Override - public ViewExpressionType getExpressionType() { - return ViewExpressionType.LOGIC_NOT; - } - - @Override - public String toString(boolean isRoot) { - return "NOT " + this.expression.toString(false); - } - // endregion -} +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// +// package org.apache.iotdb.commons.schema.view.viewExpression.unary; +// +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; +// import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; +// +// import java.io.InputStream; +// import java.nio.ByteBuffer; +// +// public class LogicNotViewExpression extends UnaryViewExpression { +// +// // region member variables and init functions +// public LogicNotViewExpression(ViewExpression expression) { +// super(expression); +// } +// +// public LogicNotViewExpression(ByteBuffer byteBuffer) { +// super(ViewExpression.deserialize(byteBuffer)); +// } +// +// public LogicNotViewExpression(InputStream inputStream) { +// super(ViewExpression.deserialize(inputStream)); +// } + +// // endregion +// +// // region common interfaces that have to be implemented +// @Override +// public R accept(ViewExpressionVisitor visitor, C context) { +// return visitor.visitLogicNotExpression(this, context); +// } +// +// @Override +// public ViewExpressionType getExpressionType() { +// return ViewExpressionType.LOGIC_NOT; +// } +// +// @Override +// public String toString(boolean isRoot) { +// return "NOT " + this.expression.toString(false); +// } +// // endregion +// } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/unary/NegationViewExpression.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/unary/NegationViewExpression.java index 2d3e9aa611fcd..57762bb1476f8 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/unary/NegationViewExpression.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/unary/NegationViewExpression.java @@ -1,62 +1,62 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iotdb.commons.schema.view.viewExpression.unary; - -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; -import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; - -import java.io.InputStream; -import java.nio.ByteBuffer; - -public class NegationViewExpression extends UnaryViewExpression { - - // region member variables and init functions - public NegationViewExpression(ViewExpression expression) { - super(expression); - } - - public NegationViewExpression(ByteBuffer byteBuffer) { - super(ViewExpression.deserialize(byteBuffer)); - } - - public NegationViewExpression(InputStream inputStream) { - super(ViewExpression.deserialize(inputStream)); - } - - // endregion - - // region common interfaces that have to be implemented - @Override - public R accept(ViewExpressionVisitor visitor, C context) { - return visitor.visitNegationExpression(this, context); - } - - @Override - public ViewExpressionType getExpressionType() { - return ViewExpressionType.NEGATION; - } - - @Override - public String toString(boolean isRoot) { - return "NEGATION_OF " + this.expression.toString(false); - } - // endregion -} +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// +// package org.apache.iotdb.commons.schema.view.viewExpression.unary; +// +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; +// import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; +// +// import java.io.InputStream; +// import java.nio.ByteBuffer; +// +// public class NegationViewExpression extends UnaryViewExpression { +// +// // region member variables and init functions +// public NegationViewExpression(ViewExpression expression) { +// super(expression); +// } +// +// public NegationViewExpression(ByteBuffer byteBuffer) { +// super(ViewExpression.deserialize(byteBuffer)); +// } +// +// public NegationViewExpression(InputStream inputStream) { +// super(ViewExpression.deserialize(inputStream)); +// } + +// // endregion +// +// // region common interfaces that have to be implemented +// @Override +// public R accept(ViewExpressionVisitor visitor, C context) { +// return visitor.visitNegationExpression(this, context); +// } +// +// @Override +// public ViewExpressionType getExpressionType() { +// return ViewExpressionType.NEGATION; +// } +// +// @Override +// public String toString(boolean isRoot) { +// return "NEGATION_OF " + this.expression.toString(false); +// } +// // endregion +// } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/unary/RegularViewExpression.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/unary/RegularViewExpression.java index 3afc8c9590313..a6a9ea0b11635 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/unary/RegularViewExpression.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/unary/RegularViewExpression.java @@ -1,125 +1,125 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iotdb.commons.schema.view.viewExpression.unary; - -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; -import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; - import org.apache.tsfile.external.commons.lang3.Validate; +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// +// package org.apache.iotdb.commons.schema.view.viewExpression.unary; +// +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType; +// import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; +// +// import org.apache.commons.lang3.Validate; import org.apache.tsfile.utils.ReadWriteIOUtils; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.nio.ByteBuffer; -import java.util.regex.Pattern; - -public class RegularViewExpression extends UnaryViewExpression { - - // region member variables and init functions - private final String patternString; - private final Pattern pattern; - +// +// import java.io.IOException; +// import java.io.InputStream; +// import java.io.OutputStream; +// import java.nio.ByteBuffer; +// import java.util.regex.Pattern; +// +// public class RegularViewExpression extends UnaryViewExpression { +// +// // region member variables and init functions +// private final String patternString; +// private final Pattern pattern; +// private final boolean isNot; public RegularViewExpression(ViewExpression expression, String patternString, boolean isNot) { - super(expression); - this.patternString = patternString; +// super(expression); +// this.patternString = patternString; this.isNot = isNot; - pattern = Pattern.compile(patternString); - } - +// pattern = Pattern.compile(patternString); +// } +// public RegularViewExpression( ViewExpression expression, String patternString, Pattern pattern, boolean isNot) { - super(expression); - this.patternString = patternString; - this.pattern = pattern; +// super(expression); +// this.patternString = patternString; +// this.pattern = pattern; this.isNot = isNot; - } - - public RegularViewExpression(ByteBuffer byteBuffer) { - super(ViewExpression.deserialize(byteBuffer)); - patternString = ReadWriteIOUtils.readString(byteBuffer); +// } +// +// public RegularViewExpression(ByteBuffer byteBuffer) { +// super(ViewExpression.deserialize(byteBuffer)); +// patternString = ReadWriteIOUtils.readString(byteBuffer); isNot = ReadWriteIOUtils.readBool(byteBuffer); - pattern = Pattern.compile(Validate.notNull(patternString)); - } - - public RegularViewExpression(InputStream inputStream) { - super(ViewExpression.deserialize(inputStream)); - try { - patternString = ReadWriteIOUtils.readString(inputStream); +// pattern = Pattern.compile(Validate.notNull(patternString)); +// } +// +// public RegularViewExpression(InputStream inputStream) { +// super(ViewExpression.deserialize(inputStream)); +// try { +// patternString = ReadWriteIOUtils.readString(inputStream); isNot = ReadWriteIOUtils.readBool(inputStream); - pattern = Pattern.compile(Validate.notNull(patternString)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - // endregion - - // region common interfaces that have to be implemented - @Override - public R accept(ViewExpressionVisitor visitor, C context) { - return visitor.visitRegularExpression(this, context); - } - - @Override - public ViewExpressionType getExpressionType() { - return ViewExpressionType.REGEXP; - } - - @Override - public String toString(boolean isRoot) { +// pattern = Pattern.compile(Validate.notNull(patternString)); +// } catch (IOException e) { +// throw new RuntimeException(e); +// } +// } +// // endregion +// +// // region common interfaces that have to be implemented +// @Override +// public R accept(ViewExpressionVisitor visitor, C context) { +// return visitor.visitRegularExpression(this, context); +// } +// +// @Override +// public ViewExpressionType getExpressionType() { +// return ViewExpressionType.REGEXP; +// } +// +// @Override +// public String toString(boolean isRoot) { return (isNot ? "NOT " : "") + "REGULAR(" + this.expression.toString() + ", " + this.patternString + ")"; - } - - @Override - protected void serialize(ByteBuffer byteBuffer) { - super.serialize(byteBuffer); - ReadWriteIOUtils.write(patternString, byteBuffer); +// } +// +// @Override +// protected void serialize(ByteBuffer byteBuffer) { +// super.serialize(byteBuffer); +// ReadWriteIOUtils.write(patternString, byteBuffer); ReadWriteIOUtils.write(isNot, byteBuffer); - } - - @Override - protected void serialize(OutputStream stream) throws IOException { - super.serialize(stream); - ReadWriteIOUtils.write(patternString, stream); +// } +// +// @Override +// protected void serialize(OutputStream stream) throws IOException { +// super.serialize(stream); +// ReadWriteIOUtils.write(patternString, stream); ReadWriteIOUtils.write(isNot, stream); - } +// } - // endregion - public String getPatternString() { - return patternString; - } - - public Pattern getPattern() { - return pattern; - } +// // endregion +// public String getPatternString() { +// return patternString; +// } +// +// public Pattern getPattern() { +// return pattern; +// } public boolean isNot() { return isNot; } -} +// } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/unary/UnaryViewExpression.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/unary/UnaryViewExpression.java index be424a10a0b85..8519309456837 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/unary/UnaryViewExpression.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/unary/UnaryViewExpression.java @@ -1,74 +1,74 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// +// package org.apache.iotdb.commons.schema.view.viewExpression.unary; +// +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; +// +// import java.io.IOException; +// import java.io.OutputStream; +// import java.nio.ByteBuffer; +// import java.util.Arrays; +// import java.util.List; +// +// public abstract class UnaryViewExpression extends ViewExpression { +// +// // region member variables and init functions +// protected final ViewExpression expression; +// +// protected UnaryViewExpression(ViewExpression expression) { +// this.expression = expression; +// } +// +// // endregion +// +// // region common interfaces that have to be implemented +// @Override +// public R accept(ViewExpressionVisitor visitor, C context) { +// return visitor.visitUnaryExpression(this, context); +// } +// +// @Override +// protected final boolean isLeafOperandInternal() { +// return false; +// } +// +// @Override +// public final List getChildViewExpressions() { +// // leaf node has no child nodes. +// return Arrays.asList(expression); +// } +// +// @Override +// protected void serialize(ByteBuffer byteBuffer) { +// ViewExpression.serialize(expression, byteBuffer); +// } +// +// @Override +// protected void serialize(OutputStream stream) throws IOException { +// ViewExpression.serialize(expression, stream); +// } -package org.apache.iotdb.commons.schema.view.viewExpression.unary; - -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor; - -import java.io.IOException; -import java.io.OutputStream; -import java.nio.ByteBuffer; -import java.util.Arrays; -import java.util.List; - -public abstract class UnaryViewExpression extends ViewExpression { - - // region member variables and init functions - protected final ViewExpression expression; - - protected UnaryViewExpression(ViewExpression expression) { - this.expression = expression; - } - - // endregion - - // region common interfaces that have to be implemented - @Override - public R accept(ViewExpressionVisitor visitor, C context) { - return visitor.visitUnaryExpression(this, context); - } - - @Override - protected final boolean isLeafOperandInternal() { - return false; - } - - @Override - public final List getChildViewExpressions() { - // leaf node has no child nodes. - return Arrays.asList(expression); - } - - @Override - protected void serialize(ByteBuffer byteBuffer) { - ViewExpression.serialize(expression, byteBuffer); - } - - @Override - protected void serialize(OutputStream stream) throws IOException { - ViewExpression.serialize(expression, stream); - } - - // endregion - - public final ViewExpression getExpression() { - return expression; - } -} +// // endregion +// +// public final ViewExpression getExpression() { +// return expression; +// } +// } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/visitor/ViewExpressionVisitor.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/visitor/ViewExpressionVisitor.java index fdbd55db5a331..2daab0cb325bc 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/visitor/ViewExpressionVisitor.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/view/viewExpression/visitor/ViewExpressionVisitor.java @@ -1,225 +1,225 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.iotdb.commons.schema.view.viewExpression.visitor; - -import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.BinaryViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.AdditionViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.ArithmeticBinaryViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.DivisionViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.ModuloViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.MultiplicationViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.SubtractionViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.CompareBinaryViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.EqualToViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.GreaterEqualViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.GreaterThanViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.LessEqualViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.LessThanViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.NonEqualViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.logic.LogicAndViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.logic.LogicBinaryViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.binary.logic.LogicOrViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.leaf.ConstantViewOperand; -import org.apache.iotdb.commons.schema.view.viewExpression.leaf.LeafViewOperand; -import org.apache.iotdb.commons.schema.view.viewExpression.leaf.NullViewOperand; -import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimeSeriesViewOperand; -import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimestampViewOperand; -import org.apache.iotdb.commons.schema.view.viewExpression.multi.FunctionViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.ternary.BetweenViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.ternary.TernaryViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.unary.InViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.unary.IsNullViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.unary.LikeViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.unary.LogicNotViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.unary.NegationViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.unary.RegularViewExpression; -import org.apache.iotdb.commons.schema.view.viewExpression.unary.UnaryViewExpression; - -/** - * This class provides a visitor of {@link ViewExpression}, which can be extended to create a - * visitor which only needs to handle a subset of the available methods. - * - * @param The return type of the visit operation. - * @param The context information during visiting. - */ -public abstract class ViewExpressionVisitor { - - public R process(ViewExpression expression, C context) { - return expression.accept(this, context); - } - - public abstract R visitExpression(ViewExpression expression, C context); - - // region leaf operand - public R visitLeafOperand(LeafViewOperand leafViewOperand, C context) { - return visitExpression(leafViewOperand, context); - } - - public R visitConstantOperand(ConstantViewOperand constantOperand, C context) { - return visitLeafOperand(constantOperand, context); - } - - public R visitNullOperand(NullViewOperand nullOperand, C context) { - return visitLeafOperand(nullOperand, context); - } - - public R visitTimeSeriesOperand(TimeSeriesViewOperand timeSeriesOperand, C context) { - return visitLeafOperand(timeSeriesOperand, context); - } - - public R visitTimeStampOperand(TimestampViewOperand timestampOperand, C context) { - return visitLeafOperand(timestampOperand, context); - } - - // endregion - - // region Unary Expressions - public R visitUnaryExpression(UnaryViewExpression unaryViewExpression, C context) { - return visitExpression(unaryViewExpression, context); - } - - public R visitInExpression(InViewExpression inExpression, C context) { - return visitUnaryExpression(inExpression, context); - } - - public R visitIsNullExpression(IsNullViewExpression isNullExpression, C context) { - return visitUnaryExpression(isNullExpression, context); - } - - public R visitLikeExpression(LikeViewExpression likeExpression, C context) { - return visitUnaryExpression(likeExpression, context); - } - - public R visitLogicNotExpression(LogicNotViewExpression logicNotExpression, C context) { - return visitUnaryExpression(logicNotExpression, context); - } - - public R visitNegationExpression(NegationViewExpression negationExpression, C context) { - return visitUnaryExpression(negationExpression, context); - } - - public R visitRegularExpression(RegularViewExpression regularExpression, C context) { - return visitUnaryExpression(regularExpression, context); - } - - // endregion - - // region Binary Expressions - public R visitBinaryExpression(BinaryViewExpression binaryViewExpression, C context) { - return visitExpression(binaryViewExpression, context); - } - - // region Binary : Arithmetic Binary Expression - public R visitArithmeticBinaryExpression( - ArithmeticBinaryViewExpression arithmeticBinaryExpression, C context) { - return visitBinaryExpression(arithmeticBinaryExpression, context); - } - - public R visitAdditionExpression(AdditionViewExpression additionExpression, C context) { - return visitArithmeticBinaryExpression(additionExpression, context); - } - - public R visitDivisionExpression(DivisionViewExpression divisionExpression, C context) { - return visitArithmeticBinaryExpression(divisionExpression, context); - } - - public R visitModuloExpression(ModuloViewExpression moduloExpression, C context) { - return visitArithmeticBinaryExpression(moduloExpression, context); - } - - public R visitMultiplicationExpression( - MultiplicationViewExpression multiplicationExpression, C context) { - return visitArithmeticBinaryExpression(multiplicationExpression, context); - } - - public R visitSubtractionExpression(SubtractionViewExpression subtractionExpression, C context) { - return visitArithmeticBinaryExpression(subtractionExpression, context); - } - - // endregion - - // region Binary: Compare Binary Expression - public R visitCompareBinaryExpression( - CompareBinaryViewExpression compareBinaryExpression, C context) { - return visitBinaryExpression(compareBinaryExpression, context); - } - - public R visitEqualToExpression(EqualToViewExpression equalToExpression, C context) { - return visitCompareBinaryExpression(equalToExpression, context); - } - - public R visitGreaterEqualExpression( - GreaterEqualViewExpression greaterEqualExpression, C context) { - return visitCompareBinaryExpression(greaterEqualExpression, context); - } - - public R visitGreaterThanExpression(GreaterThanViewExpression greaterThanExpression, C context) { - return visitCompareBinaryExpression(greaterThanExpression, context); - } - - public R visitLessEqualExpression(LessEqualViewExpression lessEqualExpression, C context) { - return visitCompareBinaryExpression(lessEqualExpression, context); - } - - public R visitLessThanExpression(LessThanViewExpression lessThanExpression, C context) { - return visitCompareBinaryExpression(lessThanExpression, context); - } - - public R visitNonEqualExpression(NonEqualViewExpression nonEqualExpression, C context) { - return visitCompareBinaryExpression(nonEqualExpression, context); - } - - // endregion - - // region Binary : Logic Binary Expression - public R visitLogicBinaryExpression(LogicBinaryViewExpression logicBinaryExpression, C context) { - return visitBinaryExpression(logicBinaryExpression, context); - } - - public R visitLogicAndExpression(LogicAndViewExpression logicAndExpression, C context) { - return visitLogicBinaryExpression(logicAndExpression, context); - } - - public R visitLogicOrExpression(LogicOrViewExpression logicOrExpression, C context) { - return visitLogicBinaryExpression(logicOrExpression, context); - } - - // endregion - - // endregion - - // region Ternary Expressions - public R visitTernaryExpression(TernaryViewExpression ternaryViewExpression, C context) { - return visitExpression(ternaryViewExpression, context); - } - - public R visitBetweenExpression(BetweenViewExpression betweenViewExpression, C context) { - return visitTernaryExpression(betweenViewExpression, context); - } - - // endregion - - // region FunctionExpression - public R visitFunctionExpression(FunctionViewExpression functionViewExpression, C context) { - return visitExpression(functionViewExpression, context); - } - // endregion -} +// /* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor license agreements. See the NOTICE file +// * distributed with this work for additional information +// * regarding copyright ownership. The ASF licenses this file +// * to you under the Apache License, Version 2.0 (the +// * "License"); you may not use this file except in compliance +// * with the License. You may obtain a copy of the License at +// * +// * http://www.apache.org/licenses/LICENSE-2.0 +// * +// * Unless required by applicable law or agreed to in writing, +// * software distributed under the License is distributed on an +// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// * KIND, either express or implied. See the License for the +// * specific language governing permissions and limitations +// * under the License. +// */ +// +// package org.apache.iotdb.commons.schema.view.viewExpression.visitor; +// +// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.BinaryViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.AdditionViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.ArithmeticBinaryViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.DivisionViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.ModuloViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.MultiplicationViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.SubtractionViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.CompareBinaryViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.EqualToViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.GreaterEqualViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.GreaterThanViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.LessEqualViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.LessThanViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.NonEqualViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.logic.LogicAndViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.logic.LogicBinaryViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.binary.logic.LogicOrViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.leaf.ConstantViewOperand; +// import org.apache.iotdb.commons.schema.view.viewExpression.leaf.LeafViewOperand; +// import org.apache.iotdb.commons.schema.view.viewExpression.leaf.NullViewOperand; +// import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimeSeriesViewOperand; +// import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimestampViewOperand; +// import org.apache.iotdb.commons.schema.view.viewExpression.multi.FunctionViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.ternary.BetweenViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.ternary.TernaryViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.unary.InViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.unary.IsNullViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.unary.LikeViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.unary.LogicNotViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.unary.NegationViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.unary.RegularViewExpression; +// import org.apache.iotdb.commons.schema.view.viewExpression.unary.UnaryViewExpression; +// +// /** +// * This class provides a visitor of {@link ViewExpression}, which can be extended to create a +// * visitor which only needs to handle a subset of the available methods. +// * +// * @param The return type of the visit operation. +// * @param The context information during visiting. +// */ +// public abstract class ViewExpressionVisitor { +// +// public R process(ViewExpression expression, C context) { +// return expression.accept(this, context); +// } +// +// public abstract R visitExpression(ViewExpression expression, C context); +// +// // region leaf operand +// public R visitLeafOperand(LeafViewOperand leafViewOperand, C context) { +// return visitExpression(leafViewOperand, context); +// } +// +// public R visitConstantOperand(ConstantViewOperand constantOperand, C context) { +// return visitLeafOperand(constantOperand, context); +// } +// +// public R visitNullOperand(NullViewOperand nullOperand, C context) { +// return visitLeafOperand(nullOperand, context); +// } +// +// public R visitTimeSeriesOperand(TimeSeriesViewOperand timeSeriesOperand, C context) { +// return visitLeafOperand(timeSeriesOperand, context); +// } +// +// public R visitTimeStampOperand(TimestampViewOperand timestampOperand, C context) { +// return visitLeafOperand(timestampOperand, context); +// } + +// // endregion +// +// // region Unary Expressions +// public R visitUnaryExpression(UnaryViewExpression unaryViewExpression, C context) { +// return visitExpression(unaryViewExpression, context); +// } +// +// public R visitInExpression(InViewExpression inExpression, C context) { +// return visitUnaryExpression(inExpression, context); +// } +// +// public R visitIsNullExpression(IsNullViewExpression isNullExpression, C context) { +// return visitUnaryExpression(isNullExpression, context); +// } +// +// public R visitLikeExpression(LikeViewExpression likeExpression, C context) { +// return visitUnaryExpression(likeExpression, context); +// } +// +// public R visitLogicNotExpression(LogicNotViewExpression logicNotExpression, C context) { +// return visitUnaryExpression(logicNotExpression, context); +// } +// +// public R visitNegationExpression(NegationViewExpression negationExpression, C context) { +// return visitUnaryExpression(negationExpression, context); +// } +// +// public R visitRegularExpression(RegularViewExpression regularExpression, C context) { +// return visitUnaryExpression(regularExpression, context); +// } + +// // endregion +// +// // region Binary Expressions +// public R visitBinaryExpression(BinaryViewExpression binaryViewExpression, C context) { +// return visitExpression(binaryViewExpression, context); +// } +// +// // region Binary : Arithmetic Binary Expression +// public R visitArithmeticBinaryExpression( +// ArithmeticBinaryViewExpression arithmeticBinaryExpression, C context) { +// return visitBinaryExpression(arithmeticBinaryExpression, context); +// } +// +// public R visitAdditionExpression(AdditionViewExpression additionExpression, C context) { +// return visitArithmeticBinaryExpression(additionExpression, context); +// } +// +// public R visitDivisionExpression(DivisionViewExpression divisionExpression, C context) { +// return visitArithmeticBinaryExpression(divisionExpression, context); +// } +// +// public R visitModuloExpression(ModuloViewExpression moduloExpression, C context) { +// return visitArithmeticBinaryExpression(moduloExpression, context); +// } +// +// public R visitMultiplicationExpression( +// MultiplicationViewExpression multiplicationExpression, C context) { +// return visitArithmeticBinaryExpression(multiplicationExpression, context); +// } +// +// public R visitSubtractionExpression(SubtractionViewExpression subtractionExpression, C context) { +// return visitArithmeticBinaryExpression(subtractionExpression, context); +// } + +// // endregion +// +// // region Binary: Compare Binary Expression +// public R visitCompareBinaryExpression( +// CompareBinaryViewExpression compareBinaryExpression, C context) { +// return visitBinaryExpression(compareBinaryExpression, context); +// } +// +// public R visitEqualToExpression(EqualToViewExpression equalToExpression, C context) { +// return visitCompareBinaryExpression(equalToExpression, context); +// } +// +// public R visitGreaterEqualExpression( +// GreaterEqualViewExpression greaterEqualExpression, C context) { +// return visitCompareBinaryExpression(greaterEqualExpression, context); +// } +// +// public R visitGreaterThanExpression(GreaterThanViewExpression greaterThanExpression, C context) { +// return visitCompareBinaryExpression(greaterThanExpression, context); +// } +// +// public R visitLessEqualExpression(LessEqualViewExpression lessEqualExpression, C context) { +// return visitCompareBinaryExpression(lessEqualExpression, context); +// } +// +// public R visitLessThanExpression(LessThanViewExpression lessThanExpression, C context) { +// return visitCompareBinaryExpression(lessThanExpression, context); +// } +// +// public R visitNonEqualExpression(NonEqualViewExpression nonEqualExpression, C context) { +// return visitCompareBinaryExpression(nonEqualExpression, context); +// } + +// // endregion +// +// // region Binary : Logic Binary Expression +// public R visitLogicBinaryExpression(LogicBinaryViewExpression logicBinaryExpression, C context) { +// return visitBinaryExpression(logicBinaryExpression, context); +// } +// +// public R visitLogicAndExpression(LogicAndViewExpression logicAndExpression, C context) { +// return visitLogicBinaryExpression(logicAndExpression, context); +// } +// +// public R visitLogicOrExpression(LogicOrViewExpression logicOrExpression, C context) { +// return visitLogicBinaryExpression(logicOrExpression, context); +// } + +// // endregion +// +// // endregion +// +// // region Ternary Expressions +// public R visitTernaryExpression(TernaryViewExpression ternaryViewExpression, C context) { +// return visitExpression(ternaryViewExpression, context); +// } +// +// public R visitBetweenExpression(BetweenViewExpression betweenViewExpression, C context) { +// return visitTernaryExpression(betweenViewExpression, context); +// } + +// // endregion +// +// // region FunctionExpression +// public R visitFunctionExpression(FunctionViewExpression functionViewExpression, C context) { +// return visitExpression(functionViewExpression, context); +// } +// // endregion +// }