joooger commented on a change in pull request #6240: IGNITE-11434 SQL: Create a 
view with list of existing COLUMNS
URL: https://github.com/apache/ignite/pull/6240#discussion_r270861824
 
 

 ##########
 File path: 
modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sys/view/SqlSystemViewColumns.java
 ##########
 @@ -0,0 +1,142 @@
+/*
+ * 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.ignite.internal.processors.query.h2.sys.view;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.function.Predicate;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.processors.query.QueryUtils;
+import org.apache.ignite.internal.processors.query.h2.SchemaManager;
+import org.apache.ignite.internal.processors.query.h2.opt.GridH2Table;
+import org.apache.ignite.internal.util.typedef.F;
+import org.h2.engine.Session;
+import org.h2.result.Row;
+import org.h2.result.SearchRow;
+import org.h2.table.Column;
+import org.h2.table.IndexColumn;
+import org.h2.value.DataType;
+import org.h2.value.Value;
+
+/**
+ * View that contains information about all the sql tables' columns in the 
cluster.
+ */
+public class SqlSystemViewColumns extends SqlAbstractLocalSystemView {
+    /** Name of the column that contains names of sql tables. */
+    private static final String TABLE_NAME = "TABLE_NAME";
+
+    /** Name of the column that contains names of sql table's columns. */
+    private static final String COLUMN_NAME = "COLUMN_NAME";
+
+    /** Schema manager. */
+    private final SchemaManager schemaMgr;
+
+    /**
+     * Creates view with columns.
+     *
+     * @param ctx Kernal context.
+     * @param schemaMgr Schema manager.
+     */
+    public SqlSystemViewColumns(GridKernalContext ctx, SchemaManager 
schemaMgr) {
+        super("COLUMNS", "Ignite columns", ctx, new String[] {TABLE_NAME, 
COLUMN_NAME},
+            newColumn("SCHEMA_NAME"),
+            newColumn(TABLE_NAME),
+            newColumn(COLUMN_NAME),
+            newColumn("COLUMN_ID", Value.INT),
 
 Review comment:
   I'm not sure that ordinal position should be a internal columnId, may be it 
will be better to use col.getColumnId() - QueryUtils.DEFAULT_COLUMNS_COUNT.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to