You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by "citrusreticulata (via GitHub)" <gi...@apache.org> on 2023/06/06 15:17:36 UTC

[GitHub] [iotdb] citrusreticulata opened a new pull request, #10060: Support multiple creation of views; fix illegal timeseries creation caused by select into; views created by aggregation function is illegal now.

citrusreticulata opened a new pull request, #10060:
URL: https://github.com/apache/iotdb/pull/10060

   ### Support multiple creation of views
   ```
   IoTDB> CREATE TIMESERIES root.db.d01.s01 INT32 encoding=RLE compression=SNAPPY;
   Msg: The statement is executed successfully.
   IoTDB> CREATE TIMESERIES root.db.d01.s02 INT32 encoding=RLE compression=SNAPPY;
   Msg: The statement is executed successfully.
   IoTDB> CREATE TIMESERIES root.db.d02.s01 INT32 encoding=RLE compression=SNAPPY;
   Msg: The statement is executed successfully.
   IoTDB> CREATE TIMESERIES root.db.d02.s02 INT32 encoding=RLE compression=SNAPPY;
   Msg: The statement is executed successfully.
   IoTDB>
   IoTDB> CREATE VIEW root.multi_view.all_in_one(${2}_${3}) AS SELECT * FROM root.db.**;
   Msg: The statement is executed successfully.
   IoTDB> SHOW VIEW;
   +----------------------------------+---------------+--------+----+----------+--------+---------------+
   |                        Timeseries|       Database|DataType|Tags|Attributes|ViewType|         Source|
   +----------------------------------+---------------+--------+----+----------+--------+---------------+
   |root.multi_view.all_in_one.d02_s02|root.multi_view|   INT32|null|      null| logical|root.db.d02.s02|
   |root.multi_view.all_in_one.d01_s02|root.multi_view|   INT32|null|      null| logical|root.db.d01.s02|
   |root.multi_view.all_in_one.d01_s01|root.multi_view|   INT32|null|      null| logical|root.db.d01.s01|
   |root.multi_view.all_in_one.d02_s01|root.multi_view|   INT32|null|      null| logical|root.db.d02.s01|
   +----------------------------------+---------------+--------+----+----------+--------+---------------+
   Total line number = 4
   It costs 0.018s
   IoTDB>
   ```
   
   ### fix illegal timeseries creation caused by select into
   ```
   IoTDB> SELECT s01, s02 into root.db.myinto.d01(${3}_$abc) FROM root.db.d02;
   Msg: 701: Parsed node name s01_$abc is illegal, unquoted node name can only consist of digits, characters and underscore, or start or end with wildcard
   IoTDB>
   ```
   
   ### views created by aggregation function is illegal now.
   ```
   IoTDB> CREATE VIEW root.cal_view(agg_avg1, agg_avg2) AS SELECT AVG(s01)+1 FROM root.db.d01, root.db.d02;
   Msg: 300: View unsupported, because: This view contains aggregation function(s) named [avg(root.db.d01.s01)]
   IoTDB>
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [iotdb] MarcosZyk commented on a diff in pull request #10060: Support multiple creation of views & Fix illegal view creation

Posted by "MarcosZyk (via GitHub)" <gi...@apache.org>.
MarcosZyk commented on code in PR #10060:
URL: https://github.com/apache/iotdb/pull/10060#discussion_r1220769022


##########
server/src/main/java/org/apache/iotdb/db/metadata/view/ViewPathType.java:
##########
@@ -20,7 +20,13 @@
 package org.apache.iotdb.db.metadata.view;
 
 public enum ViewPathType {
+  /** Example: root.db.d01.s01, root.db.d02.s01, root.db.d02.s02 */
   FULL_PATH_LIST,
+  /** Example: root.db(d01.s01, d02.s02, status) */
   PATHS_GROUP,
-  QUERY_STATEMENT
+  /** Example: SELECT s01, s02 FROM root.db.*; */
+  QUERY_STATEMENT,
+
+  /** Example: root.db.view(${2}_temperature) */
+  INTO_ITEM,

Review Comment:
   Rename to ```BATCH_GENERATION```



##########
server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/view/CreateLogicalViewStatement.java:
##########
@@ -21,22 +21,30 @@
 
 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.metadata.view.ViewPathType;
 import org.apache.iotdb.db.metadata.view.ViewPaths;
+import org.apache.iotdb.db.mpp.plan.analyze.SelectIntoUtils;
 import org.apache.iotdb.db.mpp.plan.expression.Expression;
+import org.apache.iotdb.db.mpp.plan.expression.leaf.TimeSeriesOperand;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
 import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
+import org.apache.iotdb.db.mpp.plan.statement.component.IntoComponent;
+import org.apache.iotdb.db.mpp.plan.statement.component.IntoItem;
 import org.apache.iotdb.db.mpp.plan.statement.crud.QueryStatement;
 import org.apache.iotdb.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
   private ViewPaths targetPaths;
+  private IntoItem intoItem;

Review Comment:
   Rename the variable name to ```batchGenerationItem```, which is implemented based on IntoItem.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [iotdb] citrusreticulata commented on a diff in pull request #10060: Support multiple creation of views & Fix illegal view creation

Posted by "citrusreticulata (via GitHub)" <gi...@apache.org>.
citrusreticulata commented on code in PR #10060:
URL: https://github.com/apache/iotdb/pull/10060#discussion_r1220864563


##########
server/src/main/java/org/apache/iotdb/db/metadata/view/ViewPathType.java:
##########
@@ -20,7 +20,13 @@
 package org.apache.iotdb.db.metadata.view;
 
 public enum ViewPathType {
+  /** Example: root.db.d01.s01, root.db.d02.s01, root.db.d02.s02 */
   FULL_PATH_LIST,
+  /** Example: root.db(d01.s01, d02.s02, status) */
   PATHS_GROUP,
-  QUERY_STATEMENT
+  /** Example: SELECT s01, s02 FROM root.db.*; */
+  QUERY_STATEMENT,
+
+  /** Example: root.db.view(${2}_temperature) */
+  INTO_ITEM,

Review Comment:
   resolved



##########
server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/view/CreateLogicalViewStatement.java:
##########
@@ -21,22 +21,30 @@
 
 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.metadata.view.ViewPathType;
 import org.apache.iotdb.db.metadata.view.ViewPaths;
+import org.apache.iotdb.db.mpp.plan.analyze.SelectIntoUtils;
 import org.apache.iotdb.db.mpp.plan.expression.Expression;
+import org.apache.iotdb.db.mpp.plan.expression.leaf.TimeSeriesOperand;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
 import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
+import org.apache.iotdb.db.mpp.plan.statement.component.IntoComponent;
+import org.apache.iotdb.db.mpp.plan.statement.component.IntoItem;
 import org.apache.iotdb.db.mpp.plan.statement.crud.QueryStatement;
 import org.apache.iotdb.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
   private ViewPaths targetPaths;
+  private IntoItem intoItem;

Review Comment:
   resolved



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [iotdb] MarcosZyk merged pull request #10060: Support multiple creation of views & Fix illegal view creation

Posted by "MarcosZyk (via GitHub)" <gi...@apache.org>.
MarcosZyk merged PR #10060:
URL: https://github.com/apache/iotdb/pull/10060


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org