public override DataTable GetSchemaTable()

in src/Apache.IoTDB.Data/IoTDBDataReader.cs [455:565]


        public override DataTable GetSchemaTable()
        {
            if (_dataSet.HasNext())
            {
                rowdata = _dataSet.GetRow();
            }
            var schemaTable = new DataTable("SchemaTable");
            if (_metas != null && rowdata != null)
            {
                var ColumnName = new DataColumn(SchemaTableColumn.ColumnName, typeof(string));
                var ColumnOrdinal = new DataColumn(SchemaTableColumn.ColumnOrdinal, typeof(int));
                var ColumnSize = new DataColumn(SchemaTableColumn.ColumnSize, typeof(int));
                var NumericPrecision = new DataColumn(SchemaTableColumn.NumericPrecision, typeof(short));
                var NumericScale = new DataColumn(SchemaTableColumn.NumericScale, typeof(short));

                var DataType = new DataColumn(SchemaTableColumn.DataType, typeof(Type));
                var DataTypeName = new DataColumn("DataTypeName", typeof(string));

                var IsLong = new DataColumn(SchemaTableColumn.IsLong, typeof(bool));
                var AllowDBNull = new DataColumn(SchemaTableColumn.AllowDBNull, typeof(bool));

                var IsUnique = new DataColumn(SchemaTableColumn.IsUnique, typeof(bool));
                var IsKey = new DataColumn(SchemaTableColumn.IsKey, typeof(bool));
                var IsAutoIncrement = new DataColumn(SchemaTableOptionalColumn.IsAutoIncrement, typeof(bool));

                var BaseCatalogName = new DataColumn(SchemaTableOptionalColumn.BaseCatalogName, typeof(string));
                var BaseSchemaName = new DataColumn(SchemaTableColumn.BaseSchemaName, typeof(string));
                var BaseTableName = new DataColumn(SchemaTableColumn.BaseTableName, typeof(string));
                var BaseColumnName = new DataColumn(SchemaTableColumn.BaseColumnName, typeof(string));

                var BaseServerName = new DataColumn(SchemaTableOptionalColumn.BaseServerName, typeof(string));
                var IsAliased = new DataColumn(SchemaTableColumn.IsAliased, typeof(bool));
                var IsExpression = new DataColumn(SchemaTableColumn.IsExpression, typeof(bool));

                var columns = schemaTable.Columns;

                columns.Add(ColumnName);
                columns.Add(ColumnOrdinal);
                columns.Add(ColumnSize);
                columns.Add(NumericPrecision);
                columns.Add(NumericScale);
                columns.Add(IsUnique);
                columns.Add(IsKey);
                columns.Add(BaseServerName);
                columns.Add(BaseCatalogName);
                columns.Add(BaseColumnName);
                columns.Add(BaseSchemaName);
                columns.Add(BaseTableName);
                columns.Add(DataType);
                columns.Add(DataTypeName);
                columns.Add(AllowDBNull);
                columns.Add(IsAliased);
                columns.Add(IsExpression);
                columns.Add(IsAutoIncrement);
                columns.Add(IsLong);



                var schemaRow1 = schemaTable.NewRow();

                var columnName1 = "timestamp";
                schemaRow1[ColumnName] = columnName1;
                schemaRow1[ColumnOrdinal] = 0;

                schemaRow1[NumericPrecision] = DBNull.Value;
                schemaRow1[NumericScale] = DBNull.Value;
                schemaRow1[BaseServerName] = _command.Connection.DataSource;

                schemaRow1[BaseColumnName] = columnName1;
                schemaRow1[BaseSchemaName] = DBNull.Value;
                var tableName1 = string.Empty;
                schemaRow1[BaseTableName] = tableName1;
                schemaRow1[DataType] = typeof(DateTime);
                schemaRow1[DataTypeName] = nameof(DateTime);
                schemaRow1[IsExpression] = columnName1 == null;
                schemaRow1[IsLong] = DBNull.Value;
                schemaRow1[IsKey] = true;


                schemaTable.Rows.Add(schemaRow1);


                for (var i = 1; i < rowdata.Measurements.Count + 1; i++)
                {
                    var schemaRow = schemaTable.NewRow();

                    var columnName = rowdata.Measurements[i - 1];
                    schemaRow[ColumnName] = columnName;
                    schemaRow[ColumnOrdinal] = i;

                    schemaRow[NumericPrecision] = DBNull.Value;
                    schemaRow[NumericScale] = DBNull.Value;
                    schemaRow[BaseServerName] = _command.Connection.DataSource;

                    schemaRow[BaseColumnName] = columnName;
                    schemaRow[BaseSchemaName] = DBNull.Value;
                    var tableName = string.Empty;
                    schemaRow[BaseTableName] = tableName;
                    schemaRow[DataType] = GetFieldType(i);
                    schemaRow[DataTypeName] = GetDataTypeName(i);
                    schemaRow[IsExpression] = columnName == null;
                    schemaRow[IsLong] = DBNull.Value;
                    schemaRow[IsKey] = false;
                    schemaRow[AllowDBNull] = true;
                    schemaTable.Rows.Add(schemaRow);
                }

            }

            return schemaTable;
        }