[jira] [Commented] (DRILL-4728) Add support for new metadata fetch APIs
[ https://issues.apache.org/jira/browse/DRILL-4728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15410133#comment-15410133 ] ASF GitHub Bot commented on DRILL-4728: --- Github user vkorukanti commented on a diff in the pull request: https://github.com/apache/drill/pull/527#discussion_r73764733 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/ops/QueryContext.java --- @@ -97,7 +94,7 @@ public QueryContext(final UserSession session, final DrillbitContext drillbitCon plannerSettings.getPlanningMemoryLimit()); bufferManager = new BufferManagerImpl(this.allocator); viewExpansionContext = new ViewExpansionContext(this); -schemaTreesToClose = Lists.newArrayList(); +schemaTreeProvider = new SchemaTreeProvider(drillbitContext); --- End diff -- yes. It contains the schema trees that are created within the query. It is going to differ for every query depending upon what schemas are added. Also it is a very light weight object. > Add support for new metadata fetch APIs > --- > > Key: DRILL-4728 > URL: https://issues.apache.org/jira/browse/DRILL-4728 > Project: Apache Drill > Issue Type: Sub-task > Components: Metadata >Reporter: Venki Korukanti >Assignee: Venki Korukanti > Fix For: 1.8.0 > > > Please see the doc attached to the parent JIRA DRILL-4714 for details on APIs. > Add support for following APIs (including {{protobuf}} messages, server > handling code and Java client APIs) > {code} >List getCatalogs(Filter catalogNameFilter) >List getSchemas( > Filter catalogNameFilter, > Filter schemaNameFilter >) >List getTables( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter >) >List getColumns( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter, > Filter columnNameFilter >) > {code} > Note: native client changes are not going to be included in this patch. Will > file a separate JIRA. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4728) Add support for new metadata fetch APIs
[ https://issues.apache.org/jira/browse/DRILL-4728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15410127#comment-15410127 ] ASF GitHub Bot commented on DRILL-4728: --- Github user sudheeshkatkam commented on a diff in the pull request: https://github.com/apache/drill/pull/527#discussion_r73764478 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/ops/QueryContext.java --- @@ -97,7 +94,7 @@ public QueryContext(final UserSession session, final DrillbitContext drillbitCon plannerSettings.getPlanningMemoryLimit()); bufferManager = new BufferManagerImpl(this.allocator); viewExpansionContext = new ViewExpansionContext(this); -schemaTreesToClose = Lists.newArrayList(); +schemaTreeProvider = new SchemaTreeProvider(drillbitContext); --- End diff -- Does this need to be created once per query? Can one instance live in Drillbit or UserSession? > Add support for new metadata fetch APIs > --- > > Key: DRILL-4728 > URL: https://issues.apache.org/jira/browse/DRILL-4728 > Project: Apache Drill > Issue Type: Sub-task > Components: Metadata >Reporter: Venki Korukanti >Assignee: Venki Korukanti > Fix For: 1.8.0 > > > Please see the doc attached to the parent JIRA DRILL-4714 for details on APIs. > Add support for following APIs (including {{protobuf}} messages, server > handling code and Java client APIs) > {code} >List getCatalogs(Filter catalogNameFilter) >List getSchemas( > Filter catalogNameFilter, > Filter schemaNameFilter >) >List getTables( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter >) >List getColumns( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter, > Filter columnNameFilter >) > {code} > Note: native client changes are not going to be included in this patch. Will > file a separate JIRA. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4728) Add support for new metadata fetch APIs
[ https://issues.apache.org/jira/browse/DRILL-4728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15410164#comment-15410164 ] ASF GitHub Bot commented on DRILL-4728: --- Github user sudheeshkatkam commented on a diff in the pull request: https://github.com/apache/drill/pull/527#discussion_r73766580 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/store/pojo/PojoRecordReader.java --- @@ -47,24 +46,30 @@ import org.apache.drill.exec.vector.AllocationHelper; import org.apache.drill.exec.vector.ValueVector; +import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; -public class PojoRecordReader extends AbstractRecordReader { +public class PojoRecordReader extends AbstractRecordReader implements Iterable { private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(PojoRecordReader.class); private static final ControlsInjector injector = ControlsInjectorFactory.getInjector(PojoRecordReader.class); - public final int forJsonIgnore = 1; - private final Class pojoClass; - private final Iterator iterator; + private final List pojoObjects; private PojoWriter[] writers; private boolean doCurrent; private T currentPojo; private OperatorContext operatorContext; + private Iterator currentIterator; + + /** + * TODO: Cleanup the callers to pass the List of POJO objects directly rather than iterator. + * @param pojoClass + * @param iterator + */ public PojoRecordReader(Class pojoClass, Iterator iterator) { this.pojoClass = pojoClass; -this.iterator = iterator; +this.pojoObjects = ImmutableList.copyOf(iterator); --- End diff -- We lose laziness by doing this. I am not sure if queries will be impacted (queries on information schema and sys tables), since this will be done at setup time? > Add support for new metadata fetch APIs > --- > > Key: DRILL-4728 > URL: https://issues.apache.org/jira/browse/DRILL-4728 > Project: Apache Drill > Issue Type: Sub-task > Components: Metadata >Reporter: Venki Korukanti >Assignee: Venki Korukanti > Fix For: 1.8.0 > > > Please see the doc attached to the parent JIRA DRILL-4714 for details on APIs. > Add support for following APIs (including {{protobuf}} messages, server > handling code and Java client APIs) > {code} >List getCatalogs(Filter catalogNameFilter) >List getSchemas( > Filter catalogNameFilter, > Filter schemaNameFilter >) >List getTables( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter >) >List getColumns( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter, > Filter columnNameFilter >) > {code} > Note: native client changes are not going to be included in this patch. Will > file a separate JIRA. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4728) Add support for new metadata fetch APIs
[ https://issues.apache.org/jira/browse/DRILL-4728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15410172#comment-15410172 ] ASF GitHub Bot commented on DRILL-4728: --- Github user vkorukanti commented on a diff in the pull request: https://github.com/apache/drill/pull/527#discussion_r73767170 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/store/pojo/PojoRecordReader.java --- @@ -47,24 +46,30 @@ import org.apache.drill.exec.vector.AllocationHelper; import org.apache.drill.exec.vector.ValueVector; +import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; -public class PojoRecordReader extends AbstractRecordReader { +public class PojoRecordReader extends AbstractRecordReader implements Iterable { private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(PojoRecordReader.class); private static final ControlsInjector injector = ControlsInjectorFactory.getInjector(PojoRecordReader.class); - public final int forJsonIgnore = 1; - private final Class pojoClass; - private final Iterator iterator; + private final List pojoObjects; private PojoWriter[] writers; private boolean doCurrent; private T currentPojo; private OperatorContext operatorContext; + private Iterator currentIterator; + + /** + * TODO: Cleanup the callers to pass the List of POJO objects directly rather than iterator. + * @param pojoClass + * @param iterator + */ public PojoRecordReader(Class pojoClass, Iterator iterator) { this.pojoClass = pojoClass; -this.iterator = iterator; +this.pojoObjects = ImmutableList.copyOf(iterator); --- End diff -- We already create a list and pass the iterator. So we are not losing any lazyness. Are there any places where we populate when iterator is accessed? > Add support for new metadata fetch APIs > --- > > Key: DRILL-4728 > URL: https://issues.apache.org/jira/browse/DRILL-4728 > Project: Apache Drill > Issue Type: Sub-task > Components: Metadata >Reporter: Venki Korukanti >Assignee: Venki Korukanti > Fix For: 1.8.0 > > > Please see the doc attached to the parent JIRA DRILL-4714 for details on APIs. > Add support for following APIs (including {{protobuf}} messages, server > handling code and Java client APIs) > {code} >List getCatalogs(Filter catalogNameFilter) >List getSchemas( > Filter catalogNameFilter, > Filter schemaNameFilter >) >List getTables( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter >) >List getColumns( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter, > Filter columnNameFilter >) > {code} > Note: native client changes are not going to be included in this patch. Will > file a separate JIRA. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4728) Add support for new metadata fetch APIs
[ https://issues.apache.org/jira/browse/DRILL-4728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15410174#comment-15410174 ] ASF GitHub Bot commented on DRILL-4728: --- Github user vkorukanti commented on a diff in the pull request: https://github.com/apache/drill/pull/527#discussion_r73767387 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/store/SchemaTreeProvider.java --- @@ -0,0 +1,105 @@ +/** + * 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.drill.exec.store; + +import org.apache.calcite.jdbc.SimpleCalciteSchema; +import org.apache.calcite.schema.SchemaPlus; +import org.apache.drill.common.AutoCloseables; +import org.apache.drill.common.exceptions.DrillRuntimeException; +import org.apache.drill.exec.ExecConstants; +import org.apache.drill.exec.server.DrillbitContext; +import org.apache.drill.exec.store.SchemaConfig.SchemaConfigInfoProvider; +import org.apache.drill.exec.util.ImpersonationUtil; + +import com.google.common.collect.Lists; + +import java.io.IOException; +import java.util.List; + +/** + * Class which creates new schema trees. It keeps track of newly created schema trees and closes them safely as + * part of {@link #close()}. + */ +public class SchemaTreeProvider implements AutoCloseable { + private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(SchemaTreeProvider.class); + + private final DrillbitContext dContext; + private final List schemaTreesToClose; + private final boolean isImpersonationEnabled; + + public SchemaTreeProvider(final DrillbitContext dContext) { +this.dContext = dContext; +schemaTreesToClose = Lists.newArrayList(); +isImpersonationEnabled = dContext.getConfig().getBoolean(ExecConstants.IMPERSONATION_ENABLED); + } + + /** + * Return root schema with schema owner as the given user. + * + * @param userName Name of the user who is accessing the storage sources. + * @param provider {@link SchemaConfigInfoProvider} instance + * @return Root of the schema tree. + */ + public SchemaPlus getRootSchema(final String userName, final SchemaConfigInfoProvider provider) { +final String schemaUser = isImpersonationEnabled ? userName : ImpersonationUtil.getProcessUserName(); +final SchemaConfig schemaConfig = SchemaConfig.newBuilder(schemaUser, provider).build(); +return getRootSchema(schemaConfig); + } + + /** + * Create and return a SchemaTree with given schemaConfig. + * @param schemaConfig + * @return + */ + public SchemaPlus getRootSchema(SchemaConfig schemaConfig) { +try { + final SchemaPlus rootSchema = SimpleCalciteSchema.createRootSchema(false); + dContext.getSchemaFactory().registerSchemas(schemaConfig, rootSchema); + schemaTreesToClose.add(rootSchema); + return rootSchema; +} catch(IOException e) { + // We can't proceed further without a schema, throw a runtime exception. + final String errMsg = String.format("Failed to create schema tree: %s", e.getMessage()); + logger.error(errMsg, e); + throw new DrillRuntimeException(errMsg, e); --- End diff -- updated to use UserException > Add support for new metadata fetch APIs > --- > > Key: DRILL-4728 > URL: https://issues.apache.org/jira/browse/DRILL-4728 > Project: Apache Drill > Issue Type: Sub-task > Components: Metadata >Reporter: Venki Korukanti >Assignee: Venki Korukanti > Fix For: 1.8.0 > > > Please see the doc attached to the parent JIRA DRILL-4714 for details on APIs. > Add support for following APIs (including {{protobuf}} messages, server > handling code and Java client APIs) > {code} >List getCatalogs(Filter catalogNameFilter) >List g
[jira] [Commented] (DRILL-4728) Add support for new metadata fetch APIs
[ https://issues.apache.org/jira/browse/DRILL-4728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15410178#comment-15410178 ] ASF GitHub Bot commented on DRILL-4728: --- Github user vkorukanti commented on a diff in the pull request: https://github.com/apache/drill/pull/527#discussion_r73767470 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/store/SchemaTreeProvider.java --- @@ -0,0 +1,105 @@ +/** + * 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.drill.exec.store; + +import org.apache.calcite.jdbc.SimpleCalciteSchema; +import org.apache.calcite.schema.SchemaPlus; +import org.apache.drill.common.AutoCloseables; +import org.apache.drill.common.exceptions.DrillRuntimeException; +import org.apache.drill.exec.ExecConstants; +import org.apache.drill.exec.server.DrillbitContext; +import org.apache.drill.exec.store.SchemaConfig.SchemaConfigInfoProvider; +import org.apache.drill.exec.util.ImpersonationUtil; + +import com.google.common.collect.Lists; + +import java.io.IOException; +import java.util.List; + +/** + * Class which creates new schema trees. It keeps track of newly created schema trees and closes them safely as + * part of {@link #close()}. + */ +public class SchemaTreeProvider implements AutoCloseable { + private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(SchemaTreeProvider.class); + + private final DrillbitContext dContext; + private final List schemaTreesToClose; + private final boolean isImpersonationEnabled; + + public SchemaTreeProvider(final DrillbitContext dContext) { +this.dContext = dContext; +schemaTreesToClose = Lists.newArrayList(); +isImpersonationEnabled = dContext.getConfig().getBoolean(ExecConstants.IMPERSONATION_ENABLED); + } + + /** + * Return root schema with schema owner as the given user. + * + * @param userName Name of the user who is accessing the storage sources. + * @param provider {@link SchemaConfigInfoProvider} instance + * @return Root of the schema tree. + */ + public SchemaPlus getRootSchema(final String userName, final SchemaConfigInfoProvider provider) { --- End diff -- Changed both methods to use createRootSchema > Add support for new metadata fetch APIs > --- > > Key: DRILL-4728 > URL: https://issues.apache.org/jira/browse/DRILL-4728 > Project: Apache Drill > Issue Type: Sub-task > Components: Metadata >Reporter: Venki Korukanti >Assignee: Venki Korukanti > Fix For: 1.8.0 > > > Please see the doc attached to the parent JIRA DRILL-4714 for details on APIs. > Add support for following APIs (including {{protobuf}} messages, server > handling code and Java client APIs) > {code} >List getCatalogs(Filter catalogNameFilter) >List getSchemas( > Filter catalogNameFilter, > Filter schemaNameFilter >) >List getTables( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter >) >List getColumns( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter, > Filter columnNameFilter >) > {code} > Note: native client changes are not going to be included in this patch. Will > file a separate JIRA. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4728) Add support for new metadata fetch APIs
[ https://issues.apache.org/jira/browse/DRILL-4728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15410179#comment-15410179 ] ASF GitHub Bot commented on DRILL-4728: --- Github user sudheeshkatkam commented on a diff in the pull request: https://github.com/apache/drill/pull/527#discussion_r73767561 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/store/pojo/PojoRecordReader.java --- @@ -47,24 +46,30 @@ import org.apache.drill.exec.vector.AllocationHelper; import org.apache.drill.exec.vector.ValueVector; +import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; -public class PojoRecordReader extends AbstractRecordReader { +public class PojoRecordReader extends AbstractRecordReader implements Iterable { private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(PojoRecordReader.class); private static final ControlsInjector injector = ControlsInjectorFactory.getInjector(PojoRecordReader.class); - public final int forJsonIgnore = 1; - private final Class pojoClass; - private final Iterator iterator; + private final List pojoObjects; private PojoWriter[] writers; private boolean doCurrent; private T currentPojo; private OperatorContext operatorContext; + private Iterator currentIterator; + + /** + * TODO: Cleanup the callers to pass the List of POJO objects directly rather than iterator. + * @param pojoClass + * @param iterator + */ public PojoRecordReader(Class pojoClass, Iterator iterator) { this.pojoClass = pojoClass; -this.iterator = iterator; +this.pojoObjects = ImmutableList.copyOf(iterator); --- End diff -- I looked; most of the calls are `list.iterator()`, beats the purpose. > Add support for new metadata fetch APIs > --- > > Key: DRILL-4728 > URL: https://issues.apache.org/jira/browse/DRILL-4728 > Project: Apache Drill > Issue Type: Sub-task > Components: Metadata >Reporter: Venki Korukanti >Assignee: Venki Korukanti > Fix For: 1.8.0 > > > Please see the doc attached to the parent JIRA DRILL-4714 for details on APIs. > Add support for following APIs (including {{protobuf}} messages, server > handling code and Java client APIs) > {code} >List getCatalogs(Filter catalogNameFilter) >List getSchemas( > Filter catalogNameFilter, > Filter schemaNameFilter >) >List getTables( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter >) >List getColumns( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter, > Filter columnNameFilter >) > {code} > Note: native client changes are not going to be included in this patch. Will > file a separate JIRA. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4728) Add support for new metadata fetch APIs
[ https://issues.apache.org/jira/browse/DRILL-4728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15410184#comment-15410184 ] ASF GitHub Bot commented on DRILL-4728: --- Github user sudheeshkatkam commented on a diff in the pull request: https://github.com/apache/drill/pull/527#discussion_r73767794 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/client/DrillClient.java --- @@ -411,6 +420,98 @@ public void runQuery(QueryType type, List planFragments, UserResul } /** + * Get the list of catalogs in INFORMATION_SCHEMA.CATALOGS table satisfying the given filters. + * + * @param catalogNameFilter Filter on catalog name. Pass null to apply no filter. + * @return + */ + public DrillRpcFuture getCatalogs(LikeFilter catalogNameFilter) { --- End diff -- `DrillRpcFuture` allows for cancellation (through `cancel(boolean mayInterruptIfRunning)`). Do we ignore the cancellation? > Add support for new metadata fetch APIs > --- > > Key: DRILL-4728 > URL: https://issues.apache.org/jira/browse/DRILL-4728 > Project: Apache Drill > Issue Type: Sub-task > Components: Metadata >Reporter: Venki Korukanti >Assignee: Venki Korukanti > Fix For: 1.8.0 > > > Please see the doc attached to the parent JIRA DRILL-4714 for details on APIs. > Add support for following APIs (including {{protobuf}} messages, server > handling code and Java client APIs) > {code} >List getCatalogs(Filter catalogNameFilter) >List getSchemas( > Filter catalogNameFilter, > Filter schemaNameFilter >) >List getTables( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter >) >List getColumns( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter, > Filter columnNameFilter >) > {code} > Note: native client changes are not going to be included in this patch. Will > file a separate JIRA. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4728) Add support for new metadata fetch APIs
[ https://issues.apache.org/jira/browse/DRILL-4728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15410186#comment-15410186 ] ASF GitHub Bot commented on DRILL-4728: --- Github user vkorukanti commented on a diff in the pull request: https://github.com/apache/drill/pull/527#discussion_r73767987 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/client/DrillClient.java --- @@ -411,6 +420,98 @@ public void runQuery(QueryType type, List planFragments, UserResul } /** + * Get the list of catalogs in INFORMATION_SCHEMA.CATALOGS table satisfying the given filters. + * + * @param catalogNameFilter Filter on catalog name. Pass null to apply no filter. + * @return + */ + public DrillRpcFuture getCatalogs(LikeFilter catalogNameFilter) { --- End diff -- These APIs are supposed to be fast, not sure implementing cancel provides any value. > Add support for new metadata fetch APIs > --- > > Key: DRILL-4728 > URL: https://issues.apache.org/jira/browse/DRILL-4728 > Project: Apache Drill > Issue Type: Sub-task > Components: Metadata >Reporter: Venki Korukanti >Assignee: Venki Korukanti > Fix For: 1.8.0 > > > Please see the doc attached to the parent JIRA DRILL-4714 for details on APIs. > Add support for following APIs (including {{protobuf}} messages, server > handling code and Java client APIs) > {code} >List getCatalogs(Filter catalogNameFilter) >List getSchemas( > Filter catalogNameFilter, > Filter schemaNameFilter >) >List getTables( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter >) >List getColumns( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter, > Filter columnNameFilter >) > {code} > Note: native client changes are not going to be included in this patch. Will > file a separate JIRA. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4728) Add support for new metadata fetch APIs
[ https://issues.apache.org/jira/browse/DRILL-4728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15410220#comment-15410220 ] ASF GitHub Bot commented on DRILL-4728: --- Github user vkorukanti commented on a diff in the pull request: https://github.com/apache/drill/pull/527#discussion_r73769636 --- Diff: exec/jdbc-all/pom.xml --- @@ -441,7 +441,7 @@ This is likely due to you adding new dependencies to a java-exec and not updating the excludes in this module. This is important as it minimizes the size of the dependency of Drill application users. - 2000 + 2100 --- End diff -- The size increase is due to new protobuf files. > Add support for new metadata fetch APIs > --- > > Key: DRILL-4728 > URL: https://issues.apache.org/jira/browse/DRILL-4728 > Project: Apache Drill > Issue Type: Sub-task > Components: Metadata >Reporter: Venki Korukanti >Assignee: Venki Korukanti > Fix For: 1.8.0 > > > Please see the doc attached to the parent JIRA DRILL-4714 for details on APIs. > Add support for following APIs (including {{protobuf}} messages, server > handling code and Java client APIs) > {code} >List getCatalogs(Filter catalogNameFilter) >List getSchemas( > Filter catalogNameFilter, > Filter schemaNameFilter >) >List getTables( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter >) >List getColumns( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter, > Filter columnNameFilter >) > {code} > Note: native client changes are not going to be included in this patch. Will > file a separate JIRA. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4728) Add support for new metadata fetch APIs
[ https://issues.apache.org/jira/browse/DRILL-4728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15410222#comment-15410222 ] ASF GitHub Bot commented on DRILL-4728: --- Github user vkorukanti commented on a diff in the pull request: https://github.com/apache/drill/pull/527#discussion_r73769668 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/work/metadata/MetadataProvider.java --- @@ -0,0 +1,451 @@ +/** + * 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.drill.exec.work.metadata; + +import static org.apache.drill.exec.store.ischema.InfoSchemaConstants.CATS_COL_CATALOG_NAME; +import static org.apache.drill.exec.store.ischema.InfoSchemaConstants.SCHS_COL_SCHEMA_NAME; +import static org.apache.drill.exec.store.ischema.InfoSchemaConstants.SHRD_COL_TABLE_NAME; +import static org.apache.drill.exec.store.ischema.InfoSchemaConstants.SHRD_COL_TABLE_SCHEMA; +import static org.apache.drill.exec.store.ischema.InfoSchemaTableType.CATALOGS; +import static org.apache.drill.exec.store.ischema.InfoSchemaTableType.COLUMNS; +import static org.apache.drill.exec.store.ischema.InfoSchemaTableType.SCHEMATA; +import static org.apache.drill.exec.store.ischema.InfoSchemaTableType.TABLES; + +import java.util.UUID; + +import org.apache.calcite.schema.SchemaPlus; +import org.apache.drill.common.exceptions.ErrorHelper; +import org.apache.drill.exec.ops.ViewExpansionContext; +import org.apache.drill.exec.proto.UserBitShared.DrillPBError; +import org.apache.drill.exec.proto.UserBitShared.DrillPBError.ErrorType; +import org.apache.drill.exec.proto.UserProtos.CatalogMetadata; +import org.apache.drill.exec.proto.UserProtos.ColumnMetadata; +import org.apache.drill.exec.proto.UserProtos.GetCatalogsResp; +import org.apache.drill.exec.proto.UserProtos.GetCatalogsReq; +import org.apache.drill.exec.proto.UserProtos.GetColumnsReq; +import org.apache.drill.exec.proto.UserProtos.GetColumnsResp; +import org.apache.drill.exec.proto.UserProtos.GetSchemasReq; +import org.apache.drill.exec.proto.UserProtos.GetSchemasResp; +import org.apache.drill.exec.proto.UserProtos.GetTablesReq; +import org.apache.drill.exec.proto.UserProtos.GetTablesResp; +import org.apache.drill.exec.proto.UserProtos.LikeFilter; +import org.apache.drill.exec.proto.UserProtos.RequestStatus; +import org.apache.drill.exec.proto.UserProtos.RpcType; +import org.apache.drill.exec.proto.UserProtos.SchemaMetadata; +import org.apache.drill.exec.proto.UserProtos.TableMetadata; +import org.apache.drill.exec.rpc.Response; +import org.apache.drill.exec.rpc.ResponseSender; +import org.apache.drill.exec.rpc.user.UserServer.UserClientConnection; +import org.apache.drill.exec.rpc.user.UserSession; +import org.apache.drill.exec.server.DrillbitContext; +import org.apache.drill.exec.server.options.OptionValue; +import org.apache.drill.exec.store.SchemaConfig.SchemaConfigInfoProvider; +import org.apache.drill.exec.store.SchemaTreeProvider; +import org.apache.drill.exec.store.ischema.InfoSchemaConstants; +import org.apache.drill.exec.store.ischema.InfoSchemaFilter; +import org.apache.drill.exec.store.ischema.InfoSchemaFilter.ConstantExprNode; +import org.apache.drill.exec.store.ischema.InfoSchemaFilter.ExprNode; +import org.apache.drill.exec.store.ischema.InfoSchemaFilter.FieldExprNode; +import org.apache.drill.exec.store.ischema.InfoSchemaFilter.FunctionExprNode; +import org.apache.drill.exec.store.ischema.InfoSchemaTableType; +import org.apache.drill.exec.store.ischema.Records.Catalog; +import org.apache.drill.exec.store.ischema.Records.Column; +import org.apache.drill.exec.store.ischema.Records.Schema; +import org.apache.drill.exec.store.ischema.Records.Table; +import org.apache.drill.exec.store.pojo.PojoRecordReader; + +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableList; +
[jira] [Commented] (DRILL-4728) Add support for new metadata fetch APIs
[ https://issues.apache.org/jira/browse/DRILL-4728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15410226#comment-15410226 ] ASF GitHub Bot commented on DRILL-4728: --- Github user sudheeshkatkam commented on a diff in the pull request: https://github.com/apache/drill/pull/527#discussion_r73769751 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/work/metadata/MetadataProvider.java --- @@ -0,0 +1,451 @@ +/** + * 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.drill.exec.work.metadata; + +import static org.apache.drill.exec.store.ischema.InfoSchemaConstants.CATS_COL_CATALOG_NAME; +import static org.apache.drill.exec.store.ischema.InfoSchemaConstants.SCHS_COL_SCHEMA_NAME; +import static org.apache.drill.exec.store.ischema.InfoSchemaConstants.SHRD_COL_TABLE_NAME; +import static org.apache.drill.exec.store.ischema.InfoSchemaConstants.SHRD_COL_TABLE_SCHEMA; +import static org.apache.drill.exec.store.ischema.InfoSchemaTableType.CATALOGS; +import static org.apache.drill.exec.store.ischema.InfoSchemaTableType.COLUMNS; +import static org.apache.drill.exec.store.ischema.InfoSchemaTableType.SCHEMATA; +import static org.apache.drill.exec.store.ischema.InfoSchemaTableType.TABLES; + +import java.util.UUID; + +import org.apache.calcite.schema.SchemaPlus; +import org.apache.drill.common.exceptions.ErrorHelper; +import org.apache.drill.exec.ops.ViewExpansionContext; +import org.apache.drill.exec.proto.UserBitShared.DrillPBError; +import org.apache.drill.exec.proto.UserBitShared.DrillPBError.ErrorType; +import org.apache.drill.exec.proto.UserProtos.CatalogMetadata; +import org.apache.drill.exec.proto.UserProtos.ColumnMetadata; +import org.apache.drill.exec.proto.UserProtos.GetCatalogsResp; +import org.apache.drill.exec.proto.UserProtos.GetCatalogsReq; +import org.apache.drill.exec.proto.UserProtos.GetColumnsReq; +import org.apache.drill.exec.proto.UserProtos.GetColumnsResp; +import org.apache.drill.exec.proto.UserProtos.GetSchemasReq; +import org.apache.drill.exec.proto.UserProtos.GetSchemasResp; +import org.apache.drill.exec.proto.UserProtos.GetTablesReq; +import org.apache.drill.exec.proto.UserProtos.GetTablesResp; +import org.apache.drill.exec.proto.UserProtos.LikeFilter; +import org.apache.drill.exec.proto.UserProtos.RequestStatus; +import org.apache.drill.exec.proto.UserProtos.RpcType; +import org.apache.drill.exec.proto.UserProtos.SchemaMetadata; +import org.apache.drill.exec.proto.UserProtos.TableMetadata; +import org.apache.drill.exec.rpc.Response; +import org.apache.drill.exec.rpc.ResponseSender; +import org.apache.drill.exec.rpc.user.UserServer.UserClientConnection; +import org.apache.drill.exec.rpc.user.UserSession; +import org.apache.drill.exec.server.DrillbitContext; +import org.apache.drill.exec.server.options.OptionValue; +import org.apache.drill.exec.store.SchemaConfig.SchemaConfigInfoProvider; +import org.apache.drill.exec.store.SchemaTreeProvider; +import org.apache.drill.exec.store.ischema.InfoSchemaConstants; +import org.apache.drill.exec.store.ischema.InfoSchemaFilter; +import org.apache.drill.exec.store.ischema.InfoSchemaFilter.ConstantExprNode; +import org.apache.drill.exec.store.ischema.InfoSchemaFilter.ExprNode; +import org.apache.drill.exec.store.ischema.InfoSchemaFilter.FieldExprNode; +import org.apache.drill.exec.store.ischema.InfoSchemaFilter.FunctionExprNode; +import org.apache.drill.exec.store.ischema.InfoSchemaTableType; +import org.apache.drill.exec.store.ischema.Records.Catalog; +import org.apache.drill.exec.store.ischema.Records.Column; +import org.apache.drill.exec.store.ischema.Records.Schema; +import org.apache.drill.exec.store.ischema.Records.Table; +import org.apache.drill.exec.store.pojo.PojoRecordReader; + +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableList;
[jira] [Commented] (DRILL-4728) Add support for new metadata fetch APIs
[ https://issues.apache.org/jira/browse/DRILL-4728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15410233#comment-15410233 ] ASF GitHub Bot commented on DRILL-4728: --- Github user vkorukanti commented on a diff in the pull request: https://github.com/apache/drill/pull/527#discussion_r73769951 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/work/metadata/MetadataProvider.java --- @@ -0,0 +1,451 @@ +/** + * 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.drill.exec.work.metadata; + +import static org.apache.drill.exec.store.ischema.InfoSchemaConstants.CATS_COL_CATALOG_NAME; +import static org.apache.drill.exec.store.ischema.InfoSchemaConstants.SCHS_COL_SCHEMA_NAME; +import static org.apache.drill.exec.store.ischema.InfoSchemaConstants.SHRD_COL_TABLE_NAME; +import static org.apache.drill.exec.store.ischema.InfoSchemaConstants.SHRD_COL_TABLE_SCHEMA; +import static org.apache.drill.exec.store.ischema.InfoSchemaTableType.CATALOGS; +import static org.apache.drill.exec.store.ischema.InfoSchemaTableType.COLUMNS; +import static org.apache.drill.exec.store.ischema.InfoSchemaTableType.SCHEMATA; +import static org.apache.drill.exec.store.ischema.InfoSchemaTableType.TABLES; + +import java.util.UUID; + +import org.apache.calcite.schema.SchemaPlus; +import org.apache.drill.common.exceptions.ErrorHelper; +import org.apache.drill.exec.ops.ViewExpansionContext; +import org.apache.drill.exec.proto.UserBitShared.DrillPBError; +import org.apache.drill.exec.proto.UserBitShared.DrillPBError.ErrorType; +import org.apache.drill.exec.proto.UserProtos.CatalogMetadata; +import org.apache.drill.exec.proto.UserProtos.ColumnMetadata; +import org.apache.drill.exec.proto.UserProtos.GetCatalogsResp; +import org.apache.drill.exec.proto.UserProtos.GetCatalogsReq; +import org.apache.drill.exec.proto.UserProtos.GetColumnsReq; +import org.apache.drill.exec.proto.UserProtos.GetColumnsResp; +import org.apache.drill.exec.proto.UserProtos.GetSchemasReq; +import org.apache.drill.exec.proto.UserProtos.GetSchemasResp; +import org.apache.drill.exec.proto.UserProtos.GetTablesReq; +import org.apache.drill.exec.proto.UserProtos.GetTablesResp; +import org.apache.drill.exec.proto.UserProtos.LikeFilter; +import org.apache.drill.exec.proto.UserProtos.RequestStatus; +import org.apache.drill.exec.proto.UserProtos.RpcType; +import org.apache.drill.exec.proto.UserProtos.SchemaMetadata; +import org.apache.drill.exec.proto.UserProtos.TableMetadata; +import org.apache.drill.exec.rpc.Response; +import org.apache.drill.exec.rpc.ResponseSender; +import org.apache.drill.exec.rpc.user.UserServer.UserClientConnection; +import org.apache.drill.exec.rpc.user.UserSession; +import org.apache.drill.exec.server.DrillbitContext; +import org.apache.drill.exec.server.options.OptionValue; +import org.apache.drill.exec.store.SchemaConfig.SchemaConfigInfoProvider; +import org.apache.drill.exec.store.SchemaTreeProvider; +import org.apache.drill.exec.store.ischema.InfoSchemaConstants; +import org.apache.drill.exec.store.ischema.InfoSchemaFilter; +import org.apache.drill.exec.store.ischema.InfoSchemaFilter.ConstantExprNode; +import org.apache.drill.exec.store.ischema.InfoSchemaFilter.ExprNode; +import org.apache.drill.exec.store.ischema.InfoSchemaFilter.FieldExprNode; +import org.apache.drill.exec.store.ischema.InfoSchemaFilter.FunctionExprNode; +import org.apache.drill.exec.store.ischema.InfoSchemaTableType; +import org.apache.drill.exec.store.ischema.Records.Catalog; +import org.apache.drill.exec.store.ischema.Records.Column; +import org.apache.drill.exec.store.ischema.Records.Schema; +import org.apache.drill.exec.store.ischema.Records.Table; +import org.apache.drill.exec.store.pojo.PojoRecordReader; + +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableList; +
[jira] [Commented] (DRILL-4728) Add support for new metadata fetch APIs
[ https://issues.apache.org/jira/browse/DRILL-4728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15410237#comment-15410237 ] ASF GitHub Bot commented on DRILL-4728: --- Github user sudheeshkatkam commented on a diff in the pull request: https://github.com/apache/drill/pull/527#discussion_r73770112 --- Diff: exec/jdbc-all/pom.xml --- @@ -441,7 +441,7 @@ This is likely due to you adding new dependencies to a java-exec and not updating the excludes in this module. This is important as it minimizes the size of the dependency of Drill application users. - 2000 + 2100 --- End diff -- I ran into this issue as well, while add more functionality to the client. > Add support for new metadata fetch APIs > --- > > Key: DRILL-4728 > URL: https://issues.apache.org/jira/browse/DRILL-4728 > Project: Apache Drill > Issue Type: Sub-task > Components: Metadata >Reporter: Venki Korukanti >Assignee: Venki Korukanti > Fix For: 1.8.0 > > > Please see the doc attached to the parent JIRA DRILL-4714 for details on APIs. > Add support for following APIs (including {{protobuf}} messages, server > handling code and Java client APIs) > {code} >List getCatalogs(Filter catalogNameFilter) >List getSchemas( > Filter catalogNameFilter, > Filter schemaNameFilter >) >List getTables( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter >) >List getColumns( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter, > Filter columnNameFilter >) > {code} > Note: native client changes are not going to be included in this patch. Will > file a separate JIRA. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4728) Add support for new metadata fetch APIs
[ https://issues.apache.org/jira/browse/DRILL-4728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15410242#comment-15410242 ] ASF GitHub Bot commented on DRILL-4728: --- Github user vkorukanti commented on the issue: https://github.com/apache/drill/pull/527 Rebased the patch and addressed review comments. > Add support for new metadata fetch APIs > --- > > Key: DRILL-4728 > URL: https://issues.apache.org/jira/browse/DRILL-4728 > Project: Apache Drill > Issue Type: Sub-task > Components: Metadata >Reporter: Venki Korukanti >Assignee: Venki Korukanti > Fix For: 1.8.0 > > > Please see the doc attached to the parent JIRA DRILL-4714 for details on APIs. > Add support for following APIs (including {{protobuf}} messages, server > handling code and Java client APIs) > {code} >List getCatalogs(Filter catalogNameFilter) >List getSchemas( > Filter catalogNameFilter, > Filter schemaNameFilter >) >List getTables( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter >) >List getColumns( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter, > Filter columnNameFilter >) > {code} > Note: native client changes are not going to be included in this patch. Will > file a separate JIRA. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4728) Add support for new metadata fetch APIs
[ https://issues.apache.org/jira/browse/DRILL-4728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15410279#comment-15410279 ] ASF GitHub Bot commented on DRILL-4728: --- Github user sudheeshkatkam commented on a diff in the pull request: https://github.com/apache/drill/pull/527#discussion_r73773119 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/work/metadata/MetadataProvider.java --- @@ -0,0 +1,451 @@ +/** + * 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.drill.exec.work.metadata; + +import static org.apache.drill.exec.store.ischema.InfoSchemaConstants.CATS_COL_CATALOG_NAME; +import static org.apache.drill.exec.store.ischema.InfoSchemaConstants.SCHS_COL_SCHEMA_NAME; +import static org.apache.drill.exec.store.ischema.InfoSchemaConstants.SHRD_COL_TABLE_NAME; +import static org.apache.drill.exec.store.ischema.InfoSchemaConstants.SHRD_COL_TABLE_SCHEMA; +import static org.apache.drill.exec.store.ischema.InfoSchemaTableType.CATALOGS; +import static org.apache.drill.exec.store.ischema.InfoSchemaTableType.COLUMNS; +import static org.apache.drill.exec.store.ischema.InfoSchemaTableType.SCHEMATA; +import static org.apache.drill.exec.store.ischema.InfoSchemaTableType.TABLES; + +import java.util.UUID; + +import org.apache.calcite.schema.SchemaPlus; +import org.apache.drill.common.exceptions.ErrorHelper; +import org.apache.drill.exec.ops.ViewExpansionContext; +import org.apache.drill.exec.proto.UserBitShared.DrillPBError; +import org.apache.drill.exec.proto.UserBitShared.DrillPBError.ErrorType; +import org.apache.drill.exec.proto.UserProtos.CatalogMetadata; +import org.apache.drill.exec.proto.UserProtos.ColumnMetadata; +import org.apache.drill.exec.proto.UserProtos.GetCatalogsResp; +import org.apache.drill.exec.proto.UserProtos.GetCatalogsReq; +import org.apache.drill.exec.proto.UserProtos.GetColumnsReq; +import org.apache.drill.exec.proto.UserProtos.GetColumnsResp; +import org.apache.drill.exec.proto.UserProtos.GetSchemasReq; +import org.apache.drill.exec.proto.UserProtos.GetSchemasResp; +import org.apache.drill.exec.proto.UserProtos.GetTablesReq; +import org.apache.drill.exec.proto.UserProtos.GetTablesResp; +import org.apache.drill.exec.proto.UserProtos.LikeFilter; +import org.apache.drill.exec.proto.UserProtos.RequestStatus; +import org.apache.drill.exec.proto.UserProtos.RpcType; +import org.apache.drill.exec.proto.UserProtos.SchemaMetadata; +import org.apache.drill.exec.proto.UserProtos.TableMetadata; +import org.apache.drill.exec.rpc.Response; +import org.apache.drill.exec.rpc.ResponseSender; +import org.apache.drill.exec.rpc.user.UserServer.UserClientConnection; +import org.apache.drill.exec.rpc.user.UserSession; +import org.apache.drill.exec.server.DrillbitContext; +import org.apache.drill.exec.server.options.OptionValue; +import org.apache.drill.exec.store.SchemaConfig.SchemaConfigInfoProvider; +import org.apache.drill.exec.store.SchemaTreeProvider; +import org.apache.drill.exec.store.ischema.InfoSchemaConstants; +import org.apache.drill.exec.store.ischema.InfoSchemaFilter; +import org.apache.drill.exec.store.ischema.InfoSchemaFilter.ConstantExprNode; +import org.apache.drill.exec.store.ischema.InfoSchemaFilter.ExprNode; +import org.apache.drill.exec.store.ischema.InfoSchemaFilter.FieldExprNode; +import org.apache.drill.exec.store.ischema.InfoSchemaFilter.FunctionExprNode; +import org.apache.drill.exec.store.ischema.InfoSchemaTableType; +import org.apache.drill.exec.store.ischema.Records.Catalog; +import org.apache.drill.exec.store.ischema.Records.Column; +import org.apache.drill.exec.store.ischema.Records.Schema; +import org.apache.drill.exec.store.ischema.Records.Table; +import org.apache.drill.exec.store.pojo.PojoRecordReader; + +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableList;
[jira] [Commented] (DRILL-4728) Add support for new metadata fetch APIs
[ https://issues.apache.org/jira/browse/DRILL-4728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15410288#comment-15410288 ] ASF GitHub Bot commented on DRILL-4728: --- Github user sudheeshkatkam commented on the issue: https://github.com/apache/drill/pull/527 +1 > Add support for new metadata fetch APIs > --- > > Key: DRILL-4728 > URL: https://issues.apache.org/jira/browse/DRILL-4728 > Project: Apache Drill > Issue Type: Sub-task > Components: Metadata >Reporter: Venki Korukanti >Assignee: Venki Korukanti > Fix For: 1.8.0 > > > Please see the doc attached to the parent JIRA DRILL-4714 for details on APIs. > Add support for following APIs (including {{protobuf}} messages, server > handling code and Java client APIs) > {code} >List getCatalogs(Filter catalogNameFilter) >List getSchemas( > Filter catalogNameFilter, > Filter schemaNameFilter >) >List getTables( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter >) >List getColumns( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter, > Filter columnNameFilter >) > {code} > Note: native client changes are not going to be included in this patch. Will > file a separate JIRA. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4728) Add support for new metadata fetch APIs
[ https://issues.apache.org/jira/browse/DRILL-4728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15411040#comment-15411040 ] ASF GitHub Bot commented on DRILL-4728: --- Github user vkorukanti commented on a diff in the pull request: https://github.com/apache/drill/pull/527#discussion_r73807725 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/work/metadata/MetadataProvider.java --- @@ -0,0 +1,451 @@ +/** + * 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.drill.exec.work.metadata; + +import static org.apache.drill.exec.store.ischema.InfoSchemaConstants.CATS_COL_CATALOG_NAME; +import static org.apache.drill.exec.store.ischema.InfoSchemaConstants.SCHS_COL_SCHEMA_NAME; +import static org.apache.drill.exec.store.ischema.InfoSchemaConstants.SHRD_COL_TABLE_NAME; +import static org.apache.drill.exec.store.ischema.InfoSchemaConstants.SHRD_COL_TABLE_SCHEMA; +import static org.apache.drill.exec.store.ischema.InfoSchemaTableType.CATALOGS; +import static org.apache.drill.exec.store.ischema.InfoSchemaTableType.COLUMNS; +import static org.apache.drill.exec.store.ischema.InfoSchemaTableType.SCHEMATA; +import static org.apache.drill.exec.store.ischema.InfoSchemaTableType.TABLES; + +import java.util.UUID; + +import org.apache.calcite.schema.SchemaPlus; +import org.apache.drill.common.exceptions.ErrorHelper; +import org.apache.drill.exec.ops.ViewExpansionContext; +import org.apache.drill.exec.proto.UserBitShared.DrillPBError; +import org.apache.drill.exec.proto.UserBitShared.DrillPBError.ErrorType; +import org.apache.drill.exec.proto.UserProtos.CatalogMetadata; +import org.apache.drill.exec.proto.UserProtos.ColumnMetadata; +import org.apache.drill.exec.proto.UserProtos.GetCatalogsResp; +import org.apache.drill.exec.proto.UserProtos.GetCatalogsReq; +import org.apache.drill.exec.proto.UserProtos.GetColumnsReq; +import org.apache.drill.exec.proto.UserProtos.GetColumnsResp; +import org.apache.drill.exec.proto.UserProtos.GetSchemasReq; +import org.apache.drill.exec.proto.UserProtos.GetSchemasResp; +import org.apache.drill.exec.proto.UserProtos.GetTablesReq; +import org.apache.drill.exec.proto.UserProtos.GetTablesResp; +import org.apache.drill.exec.proto.UserProtos.LikeFilter; +import org.apache.drill.exec.proto.UserProtos.RequestStatus; +import org.apache.drill.exec.proto.UserProtos.RpcType; +import org.apache.drill.exec.proto.UserProtos.SchemaMetadata; +import org.apache.drill.exec.proto.UserProtos.TableMetadata; +import org.apache.drill.exec.rpc.Response; +import org.apache.drill.exec.rpc.ResponseSender; +import org.apache.drill.exec.rpc.user.UserServer.UserClientConnection; +import org.apache.drill.exec.rpc.user.UserSession; +import org.apache.drill.exec.server.DrillbitContext; +import org.apache.drill.exec.server.options.OptionValue; +import org.apache.drill.exec.store.SchemaConfig.SchemaConfigInfoProvider; +import org.apache.drill.exec.store.SchemaTreeProvider; +import org.apache.drill.exec.store.ischema.InfoSchemaConstants; +import org.apache.drill.exec.store.ischema.InfoSchemaFilter; +import org.apache.drill.exec.store.ischema.InfoSchemaFilter.ConstantExprNode; +import org.apache.drill.exec.store.ischema.InfoSchemaFilter.ExprNode; +import org.apache.drill.exec.store.ischema.InfoSchemaFilter.FieldExprNode; +import org.apache.drill.exec.store.ischema.InfoSchemaFilter.FunctionExprNode; +import org.apache.drill.exec.store.ischema.InfoSchemaTableType; +import org.apache.drill.exec.store.ischema.Records.Catalog; +import org.apache.drill.exec.store.ischema.Records.Column; +import org.apache.drill.exec.store.ischema.Records.Schema; +import org.apache.drill.exec.store.ischema.Records.Table; +import org.apache.drill.exec.store.pojo.PojoRecordReader; + +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableList; +
[jira] [Commented] (DRILL-4728) Add support for new metadata fetch APIs
[ https://issues.apache.org/jira/browse/DRILL-4728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15411044#comment-15411044 ] ASF GitHub Bot commented on DRILL-4728: --- Github user vkorukanti commented on a diff in the pull request: https://github.com/apache/drill/pull/527#discussion_r73807939 --- Diff: protocol/src/main/protobuf/User.proto --- @@ -98,3 +106,141 @@ message BitToUserHandshake { optional string errorId = 4; optional string errorMessage = 5; } + +/* + * Enum indicating the request status. + */ +enum RequestStatus { --- End diff -- added UNKNOWN = 0. > Add support for new metadata fetch APIs > --- > > Key: DRILL-4728 > URL: https://issues.apache.org/jira/browse/DRILL-4728 > Project: Apache Drill > Issue Type: Sub-task > Components: Metadata >Reporter: Venki Korukanti >Assignee: Venki Korukanti > Fix For: 1.8.0 > > > Please see the doc attached to the parent JIRA DRILL-4714 for details on APIs. > Add support for following APIs (including {{protobuf}} messages, server > handling code and Java client APIs) > {code} >List getCatalogs(Filter catalogNameFilter) >List getSchemas( > Filter catalogNameFilter, > Filter schemaNameFilter >) >List getTables( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter >) >List getColumns( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter, > Filter columnNameFilter >) > {code} > Note: native client changes are not going to be included in this patch. Will > file a separate JIRA. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4728) Add support for new metadata fetch APIs
[ https://issues.apache.org/jira/browse/DRILL-4728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15411046#comment-15411046 ] ASF GitHub Bot commented on DRILL-4728: --- Github user asfgit closed the pull request at: https://github.com/apache/drill/pull/527 > Add support for new metadata fetch APIs > --- > > Key: DRILL-4728 > URL: https://issues.apache.org/jira/browse/DRILL-4728 > Project: Apache Drill > Issue Type: Sub-task > Components: Metadata >Reporter: Venki Korukanti >Assignee: Venki Korukanti > Fix For: 1.8.0 > > > Please see the doc attached to the parent JIRA DRILL-4714 for details on APIs. > Add support for following APIs (including {{protobuf}} messages, server > handling code and Java client APIs) > {code} >List getCatalogs(Filter catalogNameFilter) >List getSchemas( > Filter catalogNameFilter, > Filter schemaNameFilter >) >List getTables( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter >) >List getColumns( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter, > Filter columnNameFilter >) > {code} > Note: native client changes are not going to be included in this patch. Will > file a separate JIRA. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4728) Add support for new metadata fetch APIs
[ https://issues.apache.org/jira/browse/DRILL-4728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15337230#comment-15337230 ] ASF GitHub Bot commented on DRILL-4728: --- GitHub user vkorukanti opened a pull request: https://github.com/apache/drill/pull/527 DRILL-4728: Add support for new metadata fetch APIs + Protobuf messages - GetCatalogsReq -> GetCatalogsResp - GetSchemasReq -> GetSchemasResp - GetTablesReq -> GetTablesResp - GetColumnsReq -> GetColumnsResp + Java Drill client changes + Server side changes to handle the metadata API calls - Provide a self contained `Runnable` implementation for each metadata API that process the requests and sends the response to client - In `UserWorker` override the `handle` method that takes the `ResponseSender` and send the response from the `handle` method instead of returning it. - Add a method for each new API to UserWorker to submit the metadata work. - Add a method `addNewWork(Runnable runnable)` to `WorkerBee` to submit a generic `Runnable` to `ExecutorService`. - Move out couple of methods from `QueryContext` into a separate interface `SchemaConfigInfoProvider` to enable instantiating Schema trees without the full `QueryContext` + RPC version is not yet updated. Will updated once all APIs are in master. @parthchandra Could you please review the patch? You can merge this pull request into a Git repository by running: $ git pull https://github.com/vkorukanti/drill DRILL-4728 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/drill/pull/527.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #527 commit 04f0057b4784e19ea4ecd411ff74ce6ad1d52259 Author: vkorukanti Date: 2016-06-09T23:03:06Z DRILL-4728: Add support for new metadata fetch APIs + Protobuf messages - GetCatalogsReq -> GetCatalogsResp - GetSchemasReq -> GetSchemasResp - GetTablesReq -> GetTablesResp - GetColumnsReq -> GetColumnsResp + Java Drill client changes + Server side changes to handle the metadata API calls - Provide a self contained `Runnable` implementation for each metadata API that process the requests and sends the response to client - In `UserWorker` override the `handle` method that takes the `ResponseSender` and send the response from the `handle` method instead of returning it. - Add a method for each new API to UserWorker to submit the metadata work. - Add a method `addNewWork(Runnable runnable)` to `WorkerBee` to submit a generic `Runnable` to `ExecutorService`. - Move out couple of methods from `QueryContext` into a separate interface `SchemaConfigInfoProvider` to enable instantiating Schema trees without the full `QueryContext` Change-Id: I4509b1b1e747c5ef19654c48da87fe048a9740e8 > Add support for new metadata fetch APIs > --- > > Key: DRILL-4728 > URL: https://issues.apache.org/jira/browse/DRILL-4728 > Project: Apache Drill > Issue Type: Sub-task > Components: Metadata >Reporter: Venki Korukanti >Assignee: Venki Korukanti > Fix For: 1.8.0 > > > Please see the doc attached to the parent JIRA DRILL-4714 for details on APIs. > Add support for following APIs (including {{protobuf}} messages, server > handling code and Java client APIs) > {code} >List getCatalogs(Filter catalogNameFilter) >List getSchemas( > Filter catalogNameFilter, > Filter schemaNameFilter >) >List getTables( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter >) >List getColumns( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter, > Filter columnNameFilter >) > {code} > Note: native client changes are not going to be included in this patch. Will > file a separate JIRA. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4728) Add support for new metadata fetch APIs
[ https://issues.apache.org/jira/browse/DRILL-4728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15337546#comment-15337546 ] ASF GitHub Bot commented on DRILL-4728: --- Github user amansinha100 commented on the issue: https://github.com/apache/drill/pull/527 @vkorukanti can this go in after the 1.7 release ? (looking at the number of changes, it seems the review process could take couple of days or more). > Add support for new metadata fetch APIs > --- > > Key: DRILL-4728 > URL: https://issues.apache.org/jira/browse/DRILL-4728 > Project: Apache Drill > Issue Type: Sub-task > Components: Metadata >Reporter: Venki Korukanti >Assignee: Venki Korukanti > Fix For: 1.8.0 > > > Please see the doc attached to the parent JIRA DRILL-4714 for details on APIs. > Add support for following APIs (including {{protobuf}} messages, server > handling code and Java client APIs) > {code} >List getCatalogs(Filter catalogNameFilter) >List getSchemas( > Filter catalogNameFilter, > Filter schemaNameFilter >) >List getTables( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter >) >List getColumns( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter, > Filter columnNameFilter >) > {code} > Note: native client changes are not going to be included in this patch. Will > file a separate JIRA. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4728) Add support for new metadata fetch APIs
[ https://issues.apache.org/jira/browse/DRILL-4728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15337919#comment-15337919 ] ASF GitHub Bot commented on DRILL-4728: --- Github user vkorukanti commented on the issue: https://github.com/apache/drill/pull/527 @amansinha100 I am targeting this for 1.8. > Add support for new metadata fetch APIs > --- > > Key: DRILL-4728 > URL: https://issues.apache.org/jira/browse/DRILL-4728 > Project: Apache Drill > Issue Type: Sub-task > Components: Metadata >Reporter: Venki Korukanti >Assignee: Venki Korukanti > Fix For: 1.8.0 > > > Please see the doc attached to the parent JIRA DRILL-4714 for details on APIs. > Add support for following APIs (including {{protobuf}} messages, server > handling code and Java client APIs) > {code} >List getCatalogs(Filter catalogNameFilter) >List getSchemas( > Filter catalogNameFilter, > Filter schemaNameFilter >) >List getTables( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter >) >List getColumns( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter, > Filter columnNameFilter >) > {code} > Note: native client changes are not going to be included in this patch. Will > file a separate JIRA. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4728) Add support for new metadata fetch APIs
[ https://issues.apache.org/jira/browse/DRILL-4728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15352138#comment-15352138 ] ASF GitHub Bot commented on DRILL-4728: --- Github user parthchandra commented on the issue: https://github.com/apache/drill/pull/527 +1. LGTM with one comment. > Add support for new metadata fetch APIs > --- > > Key: DRILL-4728 > URL: https://issues.apache.org/jira/browse/DRILL-4728 > Project: Apache Drill > Issue Type: Sub-task > Components: Metadata >Reporter: Venki Korukanti >Assignee: Venki Korukanti > Fix For: 1.8.0 > > > Please see the doc attached to the parent JIRA DRILL-4714 for details on APIs. > Add support for following APIs (including {{protobuf}} messages, server > handling code and Java client APIs) > {code} >List getCatalogs(Filter catalogNameFilter) >List getSchemas( > Filter catalogNameFilter, > Filter schemaNameFilter >) >List getTables( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter >) >List getColumns( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter, > Filter columnNameFilter >) > {code} > Note: native client changes are not going to be included in this patch. Will > file a separate JIRA. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4728) Add support for new metadata fetch APIs
[ https://issues.apache.org/jira/browse/DRILL-4728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15352137#comment-15352137 ] ASF GitHub Bot commented on DRILL-4728: --- Github user parthchandra commented on a diff in the pull request: https://github.com/apache/drill/pull/527#discussion_r68682152 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/store/SchemaTreeProvider.java --- @@ -0,0 +1,105 @@ +/** + * 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.drill.exec.store; + +import org.apache.calcite.jdbc.SimpleCalciteSchema; +import org.apache.calcite.schema.SchemaPlus; +import org.apache.drill.common.AutoCloseables; +import org.apache.drill.common.exceptions.DrillRuntimeException; +import org.apache.drill.exec.ExecConstants; +import org.apache.drill.exec.server.DrillbitContext; +import org.apache.drill.exec.store.SchemaConfig.SchemaConfigInfoProvider; +import org.apache.drill.exec.util.ImpersonationUtil; + +import com.google.common.collect.Lists; + +import java.io.IOException; +import java.util.List; + +/** + * Class which creates new schema trees. It keeps track of newly created schema trees and closes them safely as + * part of {@link #close()}. + */ +public class SchemaTreeProvider implements AutoCloseable { + private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(SchemaTreeProvider.class); + + private final DrillbitContext dContext; + private final List schemaTreesToClose; + private final boolean isImpersonationEnabled; + + public SchemaTreeProvider(final DrillbitContext dContext) { +this.dContext = dContext; +schemaTreesToClose = Lists.newArrayList(); +isImpersonationEnabled = dContext.getConfig().getBoolean(ExecConstants.IMPERSONATION_ENABLED); + } + + /** + * Return root schema with schema owner as the given user. + * + * @param userName Name of the user who is accessing the storage sources. + * @param provider {@link SchemaConfigInfoProvider} instance + * @return Root of the schema tree. + */ + public SchemaPlus getRootSchema(final String userName, final SchemaConfigInfoProvider provider) { +final String schemaUser = isImpersonationEnabled ? userName : ImpersonationUtil.getProcessUserName(); +final SchemaConfig schemaConfig = SchemaConfig.newBuilder(schemaUser, provider).build(); +return getRootSchema(schemaConfig); + } + + /** + * Create and return a SchemaTree with given schemaConfig. + * @param schemaConfig + * @return + */ + public SchemaPlus getRootSchema(SchemaConfig schemaConfig) { +try { + final SchemaPlus rootSchema = SimpleCalciteSchema.createRootSchema(false); + dContext.getSchemaFactory().registerSchemas(schemaConfig, rootSchema); + schemaTreesToClose.add(rootSchema); + return rootSchema; +} catch(IOException e) { + // We can't proceed further without a schema, throw a runtime exception. + final String errMsg = String.format("Failed to create schema tree: %s", e.getMessage()); + logger.error(errMsg, e); + throw new DrillRuntimeException(errMsg, e); --- End diff -- Probably should change this to be a UserException (as this will get sent back to the client) > Add support for new metadata fetch APIs > --- > > Key: DRILL-4728 > URL: https://issues.apache.org/jira/browse/DRILL-4728 > Project: Apache Drill > Issue Type: Sub-task > Components: Metadata >Reporter: Venki Korukanti >Assignee: Venki Korukanti > Fix For: 1.8.0 > > > Please see the doc attached to the parent JIRA DRILL-4714 for details on APIs. > Add support for following APIs (including {{protobuf}} messages, server > handling code and Java client APIs) >
[jira] [Commented] (DRILL-4728) Add support for new metadata fetch APIs
[ https://issues.apache.org/jira/browse/DRILL-4728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15353958#comment-15353958 ] ASF GitHub Bot commented on DRILL-4728: --- Github user sudheeshkatkam commented on a diff in the pull request: https://github.com/apache/drill/pull/527#discussion_r68865600 --- Diff: exec/jdbc-all/pom.xml --- @@ -441,7 +441,7 @@ This is likely due to you adding new dependencies to a java-exec and not updating the excludes in this module. This is important as it minimizes the size of the dependency of Drill application users. - 2000 + 2100 --- End diff -- Is this intended? > Add support for new metadata fetch APIs > --- > > Key: DRILL-4728 > URL: https://issues.apache.org/jira/browse/DRILL-4728 > Project: Apache Drill > Issue Type: Sub-task > Components: Metadata >Reporter: Venki Korukanti >Assignee: Venki Korukanti > Fix For: 1.8.0 > > > Please see the doc attached to the parent JIRA DRILL-4714 for details on APIs. > Add support for following APIs (including {{protobuf}} messages, server > handling code and Java client APIs) > {code} >List getCatalogs(Filter catalogNameFilter) >List getSchemas( > Filter catalogNameFilter, > Filter schemaNameFilter >) >List getTables( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter >) >List getColumns( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter, > Filter columnNameFilter >) > {code} > Note: native client changes are not going to be included in this patch. Will > file a separate JIRA. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4728) Add support for new metadata fetch APIs
[ https://issues.apache.org/jira/browse/DRILL-4728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15353952#comment-15353952 ] ASF GitHub Bot commented on DRILL-4728: --- Github user sudheeshkatkam commented on a diff in the pull request: https://github.com/apache/drill/pull/527#discussion_r68865535 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/store/SchemaTreeProvider.java --- @@ -0,0 +1,105 @@ +/** + * 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.drill.exec.store; + +import org.apache.calcite.jdbc.SimpleCalciteSchema; +import org.apache.calcite.schema.SchemaPlus; +import org.apache.drill.common.AutoCloseables; +import org.apache.drill.common.exceptions.DrillRuntimeException; +import org.apache.drill.exec.ExecConstants; +import org.apache.drill.exec.server.DrillbitContext; +import org.apache.drill.exec.store.SchemaConfig.SchemaConfigInfoProvider; +import org.apache.drill.exec.util.ImpersonationUtil; + +import com.google.common.collect.Lists; + +import java.io.IOException; +import java.util.List; + +/** + * Class which creates new schema trees. It keeps track of newly created schema trees and closes them safely as + * part of {@link #close()}. + */ +public class SchemaTreeProvider implements AutoCloseable { + private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(SchemaTreeProvider.class); + + private final DrillbitContext dContext; + private final List schemaTreesToClose; + private final boolean isImpersonationEnabled; + + public SchemaTreeProvider(final DrillbitContext dContext) { +this.dContext = dContext; +schemaTreesToClose = Lists.newArrayList(); +isImpersonationEnabled = dContext.getConfig().getBoolean(ExecConstants.IMPERSONATION_ENABLED); + } + + /** + * Return root schema with schema owner as the given user. + * + * @param userName Name of the user who is accessing the storage sources. + * @param provider {@link SchemaConfigInfoProvider} instance + * @return Root of the schema tree. + */ + public SchemaPlus getRootSchema(final String userName, final SchemaConfigInfoProvider provider) { --- End diff -- createRootSchema(...)? > Add support for new metadata fetch APIs > --- > > Key: DRILL-4728 > URL: https://issues.apache.org/jira/browse/DRILL-4728 > Project: Apache Drill > Issue Type: Sub-task > Components: Metadata >Reporter: Venki Korukanti >Assignee: Venki Korukanti > Fix For: 1.8.0 > > > Please see the doc attached to the parent JIRA DRILL-4714 for details on APIs. > Add support for following APIs (including {{protobuf}} messages, server > handling code and Java client APIs) > {code} >List getCatalogs(Filter catalogNameFilter) >List getSchemas( > Filter catalogNameFilter, > Filter schemaNameFilter >) >List getTables( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter >) >List getColumns( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter, > Filter columnNameFilter >) > {code} > Note: native client changes are not going to be included in this patch. Will > file a separate JIRA. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4728) Add support for new metadata fetch APIs
[ https://issues.apache.org/jira/browse/DRILL-4728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15353959#comment-15353959 ] ASF GitHub Bot commented on DRILL-4728: --- Github user sudheeshkatkam commented on a diff in the pull request: https://github.com/apache/drill/pull/527#discussion_r68865614 --- Diff: protocol/src/main/protobuf/User.proto --- @@ -98,3 +106,141 @@ message BitToUserHandshake { optional string errorId = 4; optional string errorMessage = 5; } + +/* + * Enum indicating the request status. + */ +enum RequestStatus { --- End diff -- Although we haven't done this previously, I think we should use "UNKNOWN = 0" for enums to avoid problems [mentioned here](http://androiddevblog.com/protocol-buffers-pitfall-adding-enum-values/). > Add support for new metadata fetch APIs > --- > > Key: DRILL-4728 > URL: https://issues.apache.org/jira/browse/DRILL-4728 > Project: Apache Drill > Issue Type: Sub-task > Components: Metadata >Reporter: Venki Korukanti >Assignee: Venki Korukanti > Fix For: 1.8.0 > > > Please see the doc attached to the parent JIRA DRILL-4714 for details on APIs. > Add support for following APIs (including {{protobuf}} messages, server > handling code and Java client APIs) > {code} >List getCatalogs(Filter catalogNameFilter) >List getSchemas( > Filter catalogNameFilter, > Filter schemaNameFilter >) >List getTables( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter >) >List getColumns( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter, > Filter columnNameFilter >) > {code} > Note: native client changes are not going to be included in this patch. Will > file a separate JIRA. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (DRILL-4728) Add support for new metadata fetch APIs
[ https://issues.apache.org/jira/browse/DRILL-4728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15353956#comment-15353956 ] ASF GitHub Bot commented on DRILL-4728: --- Github user sudheeshkatkam commented on a diff in the pull request: https://github.com/apache/drill/pull/527#discussion_r68865548 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/work/metadata/MetadataProvider.java --- @@ -0,0 +1,451 @@ +/** + * 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.drill.exec.work.metadata; + +import static org.apache.drill.exec.store.ischema.InfoSchemaConstants.CATS_COL_CATALOG_NAME; +import static org.apache.drill.exec.store.ischema.InfoSchemaConstants.SCHS_COL_SCHEMA_NAME; +import static org.apache.drill.exec.store.ischema.InfoSchemaConstants.SHRD_COL_TABLE_NAME; +import static org.apache.drill.exec.store.ischema.InfoSchemaConstants.SHRD_COL_TABLE_SCHEMA; +import static org.apache.drill.exec.store.ischema.InfoSchemaTableType.CATALOGS; +import static org.apache.drill.exec.store.ischema.InfoSchemaTableType.COLUMNS; +import static org.apache.drill.exec.store.ischema.InfoSchemaTableType.SCHEMATA; +import static org.apache.drill.exec.store.ischema.InfoSchemaTableType.TABLES; + +import java.util.UUID; + +import org.apache.calcite.schema.SchemaPlus; +import org.apache.drill.common.exceptions.ErrorHelper; +import org.apache.drill.exec.ops.ViewExpansionContext; +import org.apache.drill.exec.proto.UserBitShared.DrillPBError; +import org.apache.drill.exec.proto.UserBitShared.DrillPBError.ErrorType; +import org.apache.drill.exec.proto.UserProtos.CatalogMetadata; +import org.apache.drill.exec.proto.UserProtos.ColumnMetadata; +import org.apache.drill.exec.proto.UserProtos.GetCatalogsResp; +import org.apache.drill.exec.proto.UserProtos.GetCatalogsReq; +import org.apache.drill.exec.proto.UserProtos.GetColumnsReq; +import org.apache.drill.exec.proto.UserProtos.GetColumnsResp; +import org.apache.drill.exec.proto.UserProtos.GetSchemasReq; +import org.apache.drill.exec.proto.UserProtos.GetSchemasResp; +import org.apache.drill.exec.proto.UserProtos.GetTablesReq; +import org.apache.drill.exec.proto.UserProtos.GetTablesResp; +import org.apache.drill.exec.proto.UserProtos.LikeFilter; +import org.apache.drill.exec.proto.UserProtos.RequestStatus; +import org.apache.drill.exec.proto.UserProtos.RpcType; +import org.apache.drill.exec.proto.UserProtos.SchemaMetadata; +import org.apache.drill.exec.proto.UserProtos.TableMetadata; +import org.apache.drill.exec.rpc.Response; +import org.apache.drill.exec.rpc.ResponseSender; +import org.apache.drill.exec.rpc.user.UserServer.UserClientConnection; +import org.apache.drill.exec.rpc.user.UserSession; +import org.apache.drill.exec.server.DrillbitContext; +import org.apache.drill.exec.server.options.OptionValue; +import org.apache.drill.exec.store.SchemaConfig.SchemaConfigInfoProvider; +import org.apache.drill.exec.store.SchemaTreeProvider; +import org.apache.drill.exec.store.ischema.InfoSchemaConstants; +import org.apache.drill.exec.store.ischema.InfoSchemaFilter; +import org.apache.drill.exec.store.ischema.InfoSchemaFilter.ConstantExprNode; +import org.apache.drill.exec.store.ischema.InfoSchemaFilter.ExprNode; +import org.apache.drill.exec.store.ischema.InfoSchemaFilter.FieldExprNode; +import org.apache.drill.exec.store.ischema.InfoSchemaFilter.FunctionExprNode; +import org.apache.drill.exec.store.ischema.InfoSchemaTableType; +import org.apache.drill.exec.store.ischema.Records.Catalog; +import org.apache.drill.exec.store.ischema.Records.Column; +import org.apache.drill.exec.store.ischema.Records.Schema; +import org.apache.drill.exec.store.ischema.Records.Table; +import org.apache.drill.exec.store.pojo.PojoRecordReader; + +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableList;
[jira] [Commented] (DRILL-4728) Add support for new metadata fetch APIs
[ https://issues.apache.org/jira/browse/DRILL-4728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15353957#comment-15353957 ] ASF GitHub Bot commented on DRILL-4728: --- Github user sudheeshkatkam commented on a diff in the pull request: https://github.com/apache/drill/pull/527#discussion_r68865590 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/work/metadata/MetadataProvider.java --- @@ -0,0 +1,451 @@ +/** + * 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.drill.exec.work.metadata; + +import static org.apache.drill.exec.store.ischema.InfoSchemaConstants.CATS_COL_CATALOG_NAME; +import static org.apache.drill.exec.store.ischema.InfoSchemaConstants.SCHS_COL_SCHEMA_NAME; +import static org.apache.drill.exec.store.ischema.InfoSchemaConstants.SHRD_COL_TABLE_NAME; +import static org.apache.drill.exec.store.ischema.InfoSchemaConstants.SHRD_COL_TABLE_SCHEMA; +import static org.apache.drill.exec.store.ischema.InfoSchemaTableType.CATALOGS; +import static org.apache.drill.exec.store.ischema.InfoSchemaTableType.COLUMNS; +import static org.apache.drill.exec.store.ischema.InfoSchemaTableType.SCHEMATA; +import static org.apache.drill.exec.store.ischema.InfoSchemaTableType.TABLES; + +import java.util.UUID; + +import org.apache.calcite.schema.SchemaPlus; +import org.apache.drill.common.exceptions.ErrorHelper; +import org.apache.drill.exec.ops.ViewExpansionContext; +import org.apache.drill.exec.proto.UserBitShared.DrillPBError; +import org.apache.drill.exec.proto.UserBitShared.DrillPBError.ErrorType; +import org.apache.drill.exec.proto.UserProtos.CatalogMetadata; +import org.apache.drill.exec.proto.UserProtos.ColumnMetadata; +import org.apache.drill.exec.proto.UserProtos.GetCatalogsResp; +import org.apache.drill.exec.proto.UserProtos.GetCatalogsReq; +import org.apache.drill.exec.proto.UserProtos.GetColumnsReq; +import org.apache.drill.exec.proto.UserProtos.GetColumnsResp; +import org.apache.drill.exec.proto.UserProtos.GetSchemasReq; +import org.apache.drill.exec.proto.UserProtos.GetSchemasResp; +import org.apache.drill.exec.proto.UserProtos.GetTablesReq; +import org.apache.drill.exec.proto.UserProtos.GetTablesResp; +import org.apache.drill.exec.proto.UserProtos.LikeFilter; +import org.apache.drill.exec.proto.UserProtos.RequestStatus; +import org.apache.drill.exec.proto.UserProtos.RpcType; +import org.apache.drill.exec.proto.UserProtos.SchemaMetadata; +import org.apache.drill.exec.proto.UserProtos.TableMetadata; +import org.apache.drill.exec.rpc.Response; +import org.apache.drill.exec.rpc.ResponseSender; +import org.apache.drill.exec.rpc.user.UserServer.UserClientConnection; +import org.apache.drill.exec.rpc.user.UserSession; +import org.apache.drill.exec.server.DrillbitContext; +import org.apache.drill.exec.server.options.OptionValue; +import org.apache.drill.exec.store.SchemaConfig.SchemaConfigInfoProvider; +import org.apache.drill.exec.store.SchemaTreeProvider; +import org.apache.drill.exec.store.ischema.InfoSchemaConstants; +import org.apache.drill.exec.store.ischema.InfoSchemaFilter; +import org.apache.drill.exec.store.ischema.InfoSchemaFilter.ConstantExprNode; +import org.apache.drill.exec.store.ischema.InfoSchemaFilter.ExprNode; +import org.apache.drill.exec.store.ischema.InfoSchemaFilter.FieldExprNode; +import org.apache.drill.exec.store.ischema.InfoSchemaFilter.FunctionExprNode; +import org.apache.drill.exec.store.ischema.InfoSchemaTableType; +import org.apache.drill.exec.store.ischema.Records.Catalog; +import org.apache.drill.exec.store.ischema.Records.Column; +import org.apache.drill.exec.store.ischema.Records.Schema; +import org.apache.drill.exec.store.ischema.Records.Table; +import org.apache.drill.exec.store.pojo.PojoRecordReader; + +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableList;
[jira] [Commented] (DRILL-4728) Add support for new metadata fetch APIs
[ https://issues.apache.org/jira/browse/DRILL-4728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15353953#comment-15353953 ] ASF GitHub Bot commented on DRILL-4728: --- Github user sudheeshkatkam commented on a diff in the pull request: https://github.com/apache/drill/pull/527#discussion_r68865539 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/store/SchemaTreeProvider.java --- @@ -0,0 +1,105 @@ +/** + * 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.drill.exec.store; + +import org.apache.calcite.jdbc.SimpleCalciteSchema; +import org.apache.calcite.schema.SchemaPlus; +import org.apache.drill.common.AutoCloseables; +import org.apache.drill.common.exceptions.DrillRuntimeException; +import org.apache.drill.exec.ExecConstants; +import org.apache.drill.exec.server.DrillbitContext; +import org.apache.drill.exec.store.SchemaConfig.SchemaConfigInfoProvider; +import org.apache.drill.exec.util.ImpersonationUtil; + +import com.google.common.collect.Lists; + +import java.io.IOException; +import java.util.List; + +/** + * Class which creates new schema trees. It keeps track of newly created schema trees and closes them safely as + * part of {@link #close()}. + */ +public class SchemaTreeProvider implements AutoCloseable { + private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(SchemaTreeProvider.class); + + private final DrillbitContext dContext; + private final List schemaTreesToClose; + private final boolean isImpersonationEnabled; + + public SchemaTreeProvider(final DrillbitContext dContext) { +this.dContext = dContext; +schemaTreesToClose = Lists.newArrayList(); +isImpersonationEnabled = dContext.getConfig().getBoolean(ExecConstants.IMPERSONATION_ENABLED); + } + + /** + * Return root schema with schema owner as the given user. + * + * @param userName Name of the user who is accessing the storage sources. + * @param provider {@link SchemaConfigInfoProvider} instance + * @return Root of the schema tree. + */ + public SchemaPlus getRootSchema(final String userName, final SchemaConfigInfoProvider provider) { +final String schemaUser = isImpersonationEnabled ? userName : ImpersonationUtil.getProcessUserName(); +final SchemaConfig schemaConfig = SchemaConfig.newBuilder(schemaUser, provider).build(); +return getRootSchema(schemaConfig); + } + + /** + * Create and return a SchemaTree with given schemaConfig. + * @param schemaConfig + * @return + */ + public SchemaPlus getRootSchema(SchemaConfig schemaConfig) { --- End diff -- createRootSchema(...)? > Add support for new metadata fetch APIs > --- > > Key: DRILL-4728 > URL: https://issues.apache.org/jira/browse/DRILL-4728 > Project: Apache Drill > Issue Type: Sub-task > Components: Metadata >Reporter: Venki Korukanti >Assignee: Venki Korukanti > Fix For: 1.8.0 > > > Please see the doc attached to the parent JIRA DRILL-4714 for details on APIs. > Add support for following APIs (including {{protobuf}} messages, server > handling code and Java client APIs) > {code} >List getCatalogs(Filter catalogNameFilter) >List getSchemas( > Filter catalogNameFilter, > Filter schemaNameFilter >) >List getTables( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter >) >List getColumns( > Filter catalogNameFilter, > Filter schemaNameFilter, > Filter tableNameFilter, > Filter columnNameFilter >) > {code} > Note: native client changes are not going to be included in this patch. Will > file a separate JIRA. -- This message was sent by Atlassian JIRA (v6.3.4#6332)