@@ -514,12 +514,50 @@ public void testInformationSchema() throws SQLException {
514514 "ColumnName,DataType,Category," ,
515515 new HashSet <>(Arrays .asList ("word,STRING,TAG," , "reserved,INT32,ATTRIBUTE," )));
516516
517- // Currently only root can query information_schema
517+ // Only root user is allowed
518+ Assert .assertThrows (SQLException .class , () -> statement .execute ("select * from regions" ));
519+ Assert .assertThrows (SQLException .class , () -> statement .execute ("select * from pipes" ));
520+ Assert .assertThrows (SQLException .class , () -> statement .execute ("select * from topics" ));
518521 Assert .assertThrows (
519- SQLException .class ,
520- () -> {
521- statement .execute ("select * from databases" );
522- });
522+ SQLException .class , () -> statement .execute ("select * from subscriptions" ));
523+ Assert .assertThrows (
524+ SQLException .class , () -> statement .execute ("select * from configurations" ));
525+
526+ // No auth needed
527+ TestUtils .assertResultSetEqual (
528+ statement .executeQuery (
529+ "select * from pipe_plugins where plugin_name = 'IOTDB-THRIFT-SINK'" ),
530+ "plugin_name,plugin_type,class_name,plugin_jar," ,
531+ Collections .singleton (
532+ "IOTDB-THRIFT-SINK,Builtin,org.apache.iotdb.commons.pipe.agent.plugin.builtin.connector.iotdb.thrift.IoTDBThriftConnector,null," ));
533+
534+ TestUtils .assertResultSetEqual (
535+ statement .executeQuery (
536+ "select model_id from information_schema.models where model_type = 'BUILT_IN_FORECAST'" ),
537+ "model_id," ,
538+ new HashSet <>(
539+ Arrays .asList (
540+ "_timerxl," ,
541+ "_STLForecaster," ,
542+ "_NaiveForecaster," ,
543+ "_ARIMA," ,
544+ "_ExponentialSmoothing," )));
545+
546+ TestUtils .assertResultSetEqual (
547+ statement .executeQuery (
548+ "select distinct(function_type) from information_schema.functions" ),
549+ "function_type," ,
550+ new HashSet <>(
551+ Arrays .asList (
552+ "built-in scalar function," ,
553+ "built-in aggregate function," ,
554+ "built-in table function," )));
555+
556+ TestUtils .assertResultSetEqual (
557+ statement .executeQuery (
558+ "select * from information_schema.keywords where reserved > 0 limit 1" ),
559+ "word,reserved," ,
560+ Collections .singleton ("AINODES,1," ));
523561 }
524562
525563 try (final Connection connection =
@@ -715,6 +753,8 @@ public void testDBAuth() throws SQLException {
715753 final Statement adminStmt = adminCon .createStatement ()) {
716754 adminStmt .execute ("create user test 'password'" );
717755 adminStmt .execute ("create database db" );
756+ adminStmt .execute (
757+ "create pipe a2b with source('double-living'='true') with sink ('sink'='write-back-sink')" );
718758 }
719759
720760 try (final Connection userCon =
@@ -724,6 +764,10 @@ public void testDBAuth() throws SQLException {
724764 userStmt .executeQuery ("show databases" ),
725765 "Database,TTL(ms),SchemaReplicationFactor,DataReplicationFactor,TimePartitionInterval," ,
726766 Collections .singleton ("information_schema,INF,null,null,null," ));
767+ TestUtils .assertResultSetEqual (
768+ userStmt .executeQuery ("select * from information_schema.databases" ),
769+ "database,ttl(ms),schema_replication_factor,data_replication_factor,time_partition_interval,schema_region_group_num,data_region_group_num," ,
770+ Collections .singleton ("information_schema,INF,null,null,null,null,null," ));
727771 }
728772
729773 try (final Connection adminCon = EnvFactory .getEnv ().getConnection (BaseEnv .TABLE_SQL_DIALECT );
0 commit comments