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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion iotdb-client/client-py/tests/integration/test_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def test_non_time_query():
"Attributes",
"Deadband",
"DeadbandParameters",
"ViewType",
// "ViewType",
]
assert_array_equal(
df.values,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ ddlStatement
| callInference | loadModel | unloadModel
// Quota
| setSpaceQuota | showSpaceQuota | setThrottleQuota | showThrottleQuota
// View
// // View
| createLogicalView | dropLogicalView | showLogicalView | renameLogicalView | alterLogicalView
// Table View
| createTableView
Expand Down Expand Up @@ -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?
;
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<IConfigMNode> createLogicalViewMNode(
//
// @Override
// public IMeasurementMNode<IConfigMNode> createLogicalViewMNode(
IDeviceMNode<IConfigMNode> parent, String name, IMeasurementSchema measurementSchema) {
throw new UnsupportedOperationException("View is not supported.");
}
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -102,7 +102,7 @@ protected Flow executeFromState(
} else {
setFailure(
new ProcedureException(
new ViewNotExistException(
// new ViewNotExistException(
patternTree.getAllPathPatterns().stream()
.map(PartialPath::getFullPath)
.collect(Collectors.toList()))));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -591,28 +591,28 @@ public TSStatus visitDeactivateTemplate(
}
}

@Override
// @Override
public TSStatus visitCreateLogicalView(
final CreateLogicalViewNode node, final ISchemaRegion schemaRegion) {
final Map<PartialPath, ViewExpression> viewPathToSourceMap =
node.getViewPathToSourceExpressionMap();
final List<TSStatus> failingStatus = new ArrayList<>();
for (final Map.Entry<PartialPath, ViewExpression> 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) {
Expand Down
Loading
Loading