You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/12/20 19:11:50 UTC

[GitHub] [arrow] jcralmeida opened a new pull request #12002: [CPP] Add missing metadata on Arrow schemas returned by Flight SQL #11999

jcralmeida opened a new pull request #12002:
URL: https://github.com/apache/arrow/pull/12002


   This add an auxiliary class FlightSqlColumnMetadata meant to read and write known metadata for Arrow schema fields, such as CATALOG_NAME, SCHEMA_NAME, TABLE_NAME, PRECISION, SCALE, IS_AUTO_INCREMENT, IS_CASE_SENSITIVE, IS_READ_ONLY and IS_SEARCHABLE.


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

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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



[GitHub] [arrow] jcralmeida commented on pull request #12002: [CPP] Add missing metadata on Arrow schemas returned by Flight SQL #11999

Posted by GitBox <gi...@apache.org>.
jcralmeida commented on pull request #12002:
URL: https://github.com/apache/arrow/pull/12002#issuecomment-1009290367


   Closed this pull request because both implementation JAVA and C++ are now in the same Pull Request
   
   https://github.com/apache/arrow/pull/11999


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

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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



[GitHub] [arrow] jcralmeida closed pull request #12002: [CPP] Add missing metadata on Arrow schemas returned by Flight SQL #11999

Posted by GitBox <gi...@apache.org>.
jcralmeida closed pull request #12002:
URL: https://github.com/apache/arrow/pull/12002


   


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

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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



[GitHub] [arrow] github-actions[bot] commented on pull request #12002: [CPP] Add missing metadata on Arrow schemas returned by Flight SQL #11999

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #12002:
URL: https://github.com/apache/arrow/pull/12002#issuecomment-998198655


   <!--
     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.
   -->
   
   Thanks for opening a pull request!
   
   If this is not a [minor PR](https://github.com/apache/arrow/blob/master/CONTRIBUTING.md#Minor-Fixes). Could you open an issue for this pull request on JIRA? https://issues.apache.org/jira/browse/ARROW
   
   Opening JIRAs ahead of time contributes to the [Openness](http://theapacheway.com/open/#:~:text=Openness%20allows%20new%20users%20the,must%20happen%20in%20the%20open.) of the Apache Arrow project.
   
   Then could you also rename pull request title in the following format?
   
       ARROW-${JIRA_ID}: [${COMPONENT}] ${SUMMARY}
   
   or
   
       MINOR: [${COMPONENT}] ${SUMMARY}
   
   See also:
   
     * [Other pull requests](https://github.com/apache/arrow/pulls/)
     * [Contribution Guidelines - How to contribute patches](https://arrow.apache.org/docs/developers/contributing.html#how-to-contribute-patches)
   


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

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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



[GitHub] [arrow] jcralmeida commented on a change in pull request #12002: [CPP] Add missing metadata on Arrow schemas returned by Flight SQL #11999

Posted by GitBox <gi...@apache.org>.
jcralmeida commented on a change in pull request #12002:
URL: https://github.com/apache/arrow/pull/12002#discussion_r781493700



##########
File path: cpp/src/arrow/flight/sql/column_metadata.cc
##########
@@ -0,0 +1,188 @@
+// 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.
+
+#include "arrow/flight/sql/column_metadata.h"
+
+#include <utility>
+
+namespace {

Review comment:
       Fixed

##########
File path: cpp/src/arrow/flight/sql/column_metadata.h
##########
@@ -0,0 +1,168 @@
+// 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.
+
+#pragma once
+
+#include <string>
+
+#include "arrow/util/key_value_metadata.h"
+
+namespace arrow {
+namespace flight {
+namespace sql {
+
+/// \brief Helper class to set column metadata.
+class ColumnMetadata {
+ private:
+  std::shared_ptr<arrow::KeyValueMetadata> metadata_map_;
+  explicit ColumnMetadata(std::shared_ptr<arrow::KeyValueMetadata> metadata_map);
+
+ public:
+  class ColumnMetadataBuilder;
+
+  /// \brief Constant variable to hold the value of the key that
+  ///        will be used in the KeyValueMetadata class.
+  static const char* CATALOG_NAME;
+  /// \brief Constant variable to hold the value of the key that
+  ///        will be used in the KeyValueMetadata class.
+  static const char* SCHEMA_NAME;
+  /// \brief Constant variable to hold the value of the key that
+  ///        will be used in the KeyValueMetadata class.
+  static const char* TABLE_NAME;
+  /// \brief Constant variable to hold the value of the key that
+  ///        will be used in the KeyValueMetadata class.
+  static const char* PRECISION;
+  /// \brief Constant variable to hold the value of the key that
+  ///        will be used in the KeyValueMetadata class.
+  static const char* SCALE;
+  /// \brief Constant variable to hold the value of the key that
+  ///        will be used in the KeyValueMetadata class.
+  static const char* IS_AUTO_INCREMENT;
+  /// \brief Constant variable to hold the value of the key that
+  ///        will be used in the KeyValueMetadata class.
+  static const char* IS_CASE_SENSITIVE;
+  /// \brief Constant variable to hold the value of the key that
+  ///        will be used in the KeyValueMetadata class.
+  static const char* IS_READ_ONLY;
+  /// \brief Constant variable to hold the value of the key that
+  ///        will be used in the KeyValueMetadata class.
+  static const char* IS_SEARCHABLE;
+
+  /// \brief Static initializer.
+  static ColumnMetadataBuilder Builder();
+
+  /// \brief  Return the catalog name set in the KeyValueMetadata.
+  /// \return The catalog name.
+  arrow::Result<std::string> GetCatalogName();

Review comment:
       Fixed




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

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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



[GitHub] [arrow] jcralmeida commented on a change in pull request #12002: [CPP] Add missing metadata on Arrow schemas returned by Flight SQL #11999

Posted by GitBox <gi...@apache.org>.
jcralmeida commented on a change in pull request #12002:
URL: https://github.com/apache/arrow/pull/12002#discussion_r781488196



##########
File path: cpp/src/arrow/flight/sql/column_metadata.h
##########
@@ -0,0 +1,168 @@
+// 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.
+
+#pragma once
+
+#include <string>
+
+#include "arrow/util/key_value_metadata.h"
+
+namespace arrow {
+namespace flight {
+namespace sql {
+
+/// \brief Helper class to set column metadata.
+class ColumnMetadata {
+ private:
+  std::shared_ptr<arrow::KeyValueMetadata> metadata_map_;
+  explicit ColumnMetadata(std::shared_ptr<arrow::KeyValueMetadata> metadata_map);
+
+ public:
+  class ColumnMetadataBuilder;
+
+  /// \brief Constant variable to hold the value of the key that
+  ///        will be used in the KeyValueMetadata class.
+  static const char* CATALOG_NAME;

Review comment:
       Fixed




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

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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



[GitHub] [arrow] lidavidm commented on a change in pull request #12002: [CPP] Add missing metadata on Arrow schemas returned by Flight SQL #11999

Posted by GitBox <gi...@apache.org>.
lidavidm commented on a change in pull request #12002:
URL: https://github.com/apache/arrow/pull/12002#discussion_r775553323



##########
File path: cpp/src/arrow/flight/sql/column_metadata.h
##########
@@ -0,0 +1,168 @@
+// 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.
+
+#pragma once
+
+#include <string>
+
+#include "arrow/util/key_value_metadata.h"
+
+namespace arrow {
+namespace flight {
+namespace sql {
+
+/// \brief Helper class to set column metadata.
+class ColumnMetadata {
+ private:
+  std::shared_ptr<arrow::KeyValueMetadata> metadata_map_;
+  explicit ColumnMetadata(std::shared_ptr<arrow::KeyValueMetadata> metadata_map);
+
+ public:
+  class ColumnMetadataBuilder;
+
+  /// \brief Constant variable to hold the value of the key that
+  ///        will be used in the KeyValueMetadata class.
+  static const char* CATALOG_NAME;
+  /// \brief Constant variable to hold the value of the key that
+  ///        will be used in the KeyValueMetadata class.
+  static const char* SCHEMA_NAME;
+  /// \brief Constant variable to hold the value of the key that
+  ///        will be used in the KeyValueMetadata class.
+  static const char* TABLE_NAME;
+  /// \brief Constant variable to hold the value of the key that
+  ///        will be used in the KeyValueMetadata class.
+  static const char* PRECISION;
+  /// \brief Constant variable to hold the value of the key that
+  ///        will be used in the KeyValueMetadata class.
+  static const char* SCALE;
+  /// \brief Constant variable to hold the value of the key that
+  ///        will be used in the KeyValueMetadata class.
+  static const char* IS_AUTO_INCREMENT;
+  /// \brief Constant variable to hold the value of the key that
+  ///        will be used in the KeyValueMetadata class.
+  static const char* IS_CASE_SENSITIVE;
+  /// \brief Constant variable to hold the value of the key that
+  ///        will be used in the KeyValueMetadata class.
+  static const char* IS_READ_ONLY;
+  /// \brief Constant variable to hold the value of the key that
+  ///        will be used in the KeyValueMetadata class.
+  static const char* IS_SEARCHABLE;
+
+  /// \brief Static initializer.
+  static ColumnMetadataBuilder Builder();
+
+  /// \brief  Return the catalog name set in the KeyValueMetadata.
+  /// \return The catalog name.
+  arrow::Result<std::string> GetCatalogName();

Review comment:
       Can these be declared `const`?

##########
File path: cpp/src/arrow/flight/sql/column_metadata.cc
##########
@@ -0,0 +1,188 @@
+// 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.
+
+#include "arrow/flight/sql/column_metadata.h"
+
+#include <utility>
+
+namespace {

Review comment:
       nit: the anonymous namespace could probably be nested into the arrow::flight::sql namespace below

##########
File path: cpp/src/arrow/flight/sql/column_metadata.h
##########
@@ -0,0 +1,168 @@
+// 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.
+
+#pragma once
+
+#include <string>
+
+#include "arrow/util/key_value_metadata.h"
+
+namespace arrow {
+namespace flight {
+namespace sql {
+
+/// \brief Helper class to set column metadata.
+class ColumnMetadata {
+ private:
+  std::shared_ptr<arrow::KeyValueMetadata> metadata_map_;
+  explicit ColumnMetadata(std::shared_ptr<arrow::KeyValueMetadata> metadata_map);
+
+ public:
+  class ColumnMetadataBuilder;
+
+  /// \brief Constant variable to hold the value of the key that
+  ///        will be used in the KeyValueMetadata class.
+  static const char* CATALOG_NAME;

Review comment:
       nit: constants should be named `kCatalogName` according to the [style guide](https://google.github.io/styleguide/cppguide.html#Constant_Names)




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

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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