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 2022/02/08 18:41:38 UTC

[GitHub] [arrow] jcralmeida commented on a change in pull request #11982: ARROW-15313: [C++][Java][FlightRPC] Implement type info method to flight-sql

jcralmeida commented on a change in pull request #11982:
URL: https://github.com/apache/arrow/pull/11982#discussion_r801949555



##########
File path: format/FlightSql.proto
##########
@@ -867,6 +867,167 @@ enum SqlSupportsConvert {
   SQL_CONVERT_VARCHAR = 19;
 }
 
+enum SqlDataType {
+  SQL_TYPE_UNKNOWN_TYPE = 0;
+  SQL_TYPE_CHAR = 1;
+  SQL_TYPE_NUMERIC = 2;
+  SQL_TYPE_DECIMAL = 3;
+  SQL_TYPE_INTEGER = 4;
+  SQL_TYPE_SMALLINT = 5;
+  SQL_TYPE_FLOAT = 6;
+  SQL_TYPE_REAL = 7;
+  SQL_TYPE_DOUBLE = 8;
+  SQL_TYPE_DATETIME = 9;
+  SQL_TYPE_INTERVAL = 10;
+  SQL_TYPE_VARCHAR = 12;
+}
+
+enum SqlDatetimeSubcode {
+  option allow_alias = true;
+  SQL_SUBCODE_UNKNOWN = 0;
+  SQL_SUBCODE_YEAR = 1;
+  SQL_SUBCODE_DATE = 1;
+  SQL_SUBCODE_TIME = 2;
+  SQL_SUBCODE_MONTH = 2;
+  SQL_SUBCODE_TIMESTAMP = 3;
+  SQL_SUBCODE_DAY = 3;
+  SQL_SUBCODE_TIME_WITH_TIMEZONE = 4;
+  SQL_SUBCODE_HOUR = 4;
+  SQL_SUBCODE_TIMESTAMP_WITH_TIMEZONE = 5;
+  SQL_SUBCODE_MINUTE = 5;
+  SQL_SUBCODE_SECOND = 6;
+  SQL_SUBCODE_YEAR_TO_MONTH = 7;
+  SQL_SUBCODE_DAY_TO_HOUR = 8;
+  SQL_SUBCODE_DAY_TO_MINUTE = 9;
+  SQL_SUBCODE_DAY_TO_SECOND = 10;
+  SQL_SUBCODE_HOUR_TO_MINUTE = 11;
+  SQL_SUBCODE_HOUR_TO_SECOND = 12;
+  SQL_SUBCODE_MINUTE_TO_SECOND = 13;
+  SQL_SUBCODE_INTERVAL_YEAR = 101;
+  SQL_SUBCODE_INTERVAL_MONTH = 102;
+  SQL_SUBCODE_INTERVAL_DAY = 103;
+  SQL_SUBCODE_INTERVAL_HOUR = 104;
+  SQL_SUBCODE_INTERVAL_MINUTE = 105;
+  SQL_SUBCODE_INTERVAL_SECOND = 106;
+  SQL_SUBCODE_INTERVAL_YEAR_TO_MONTH = 107;
+  SQL_SUBCODE_INTERVAL_DAY_TO_HOUR = 108;
+  SQL_SUBCODE_INTERVAL_DAY_TO_MINUTE = 109;
+  SQL_SUBCODE_INTERVAL_DAY_TO_SECOND = 110;
+  SQL_SUBCODE_INTERVAL_HOUR_TO_MINUTE = 111;
+  SQL_SUBCODE_INTERVAL_HOUR_TO_SECOND = 112;
+  SQL_SUBCODE_INTERVAL_MINUTE_TO_SECOND = 113;
+}
+
+enum Nullable {
+  /**
+   * Indicates that the fields does not allow the use of null values.
+   */
+  NULLABILITY_NO_NULLS = 0;
+
+  /**
+   * Indicates that the fields allow the use of null values.
+   */
+  NULLABILITY_NULLABLE = 1;
+
+  /**
+   * Indicates that nullability of the fields can not be determined.
+   */
+  NULLABILITY_UNKNOWN = 2;
+}
+
+enum Searchable {
+  /**
+   * Indicates that column can not be used in a WHERE clause.
+   */
+  SEARCHABLE_NONE = 0;
+
+  /**
+   * Indicates that the column can be used in a WHERE clause if it is using a
+   * LIKE predicate.
+   */
+  SEARCHABLE_CHAR = 1;
+
+  /**
+   * Indicates that the column can be used in a WHERE clause using other predicates
+   * except for LIKE.
+   *
+   * - Allowed operators: comparison, quantified comparison, BETWEEN,
+   *                      DISTINCT, IN, MATCH, and UNIQUE.
+   */
+  SEARCHABLE_BASIC = 2;
+
+  /**
+   * Indicates that the column can be used in a WHERE clause using any operator.
+   */
+  SEARCHABLE_FULL = 3;
+}
+
+/*
+ * Represents a request to retrieve information about data type supported on a Flight SQL enabled backend.
+ * Used in the command member of FlightDescriptor for the following RPC calls:
+ *  - GetSchema: return the schema of the query.
+ *  - GetFlightInfo: execute the catalog metadata request.
+ *
+ * The returned schema will be:
+ * <
+ *   type_name: utf8 not null (The name of the data type, for example: VARCHAR, INTEGER, etc),
+ *   data_type: int not null (The SQL data type),
+ *   column_size: int (The maximum size supported by that column.
+ *                     In case of numeric types, this represents the maximum precision.
+ *                     In case of string types, this represents the character length.
+ *                     In case of datetime data types, this represents the length in characters of the string representation.
+ *                     NULL is returned for data types where column size is not applicable.),
+ *   literal_prefix: utf8 (Character or characters used to prefix a literal, NULL is returned for
+ *                         data types where a literal prefix is not applicable.),
+ *   literal_suffix: utf8 (Character or characters used to terminate a literal,
+ *                         NULL is returned for data types where a literal suffix is not applicable.),
+ *   create_params: list<utf8 not null>
+ *                        (A list of keywords corresponding to which parameters can be used when creating
+ *                         a column for that specific type.
+ *                         NULL is returned if there are no parameters for the data type definition.),
+ *   nullable: int not null (Shows if the data type accepts a NULL value. The possible values can be seen in the
+ *                           Nullable enum.),
+ *   case_sensitive: bool not null (Shows if a character data type is case-sensitive in collations and comparisons),
+ *   searchable: int not null (Shows how the data type is used in a WHERE clause. The possible values can be seen in the
+ *                             Searchable enum.),
+ *   unsigned_attribute: bool (Shows if the data type is unsigned. NULL is returned if the attribute is
+ *                             not applicable to the data type or the data type is not numeric.),
+ *   fixed_prec_scale: bool not null (Shows if the data type has predefined fixed precision and scale.),
+ *   auto_increment: bool (Shows if the data type is auto incremental. NULL is returned if the attribute
+ *                         is not applicable to the data type or the data type is not numeric.),
+ *   local_type_name: utf8 (Localized version of the data source-dependent name of the data type. NULL
+ *                          is returned if a localized name is not supported by the data source),
+ *   minimum_scale: int (The minimum scale of the data type on the data source.
+ *                       If a data type has a fixed scale, the MINIMUM_SCALE and MAXIMUM_SCALE
+ *                       columns both contain this value. NULL is returned if scale is not applicable.),
+ *   maximum_scale: int (The maximum scale of the data type on the data source.
+ *                       NULL is returned if scale is not applicable.),
+ *   sql_data_type: int not null (The value of the SQL DATA TYPE which has the same values
+ *                                as date_type value. Except for interval and datetime, which
+ *                                uses generic values. More info about those types can be
+ *                                obtained through datetime_subcode. The possible values can be seen
+ *                                in the SqlDataType enum.),
+ *   datetime_subcode: int (Only used when the SQL DATA TYPE is interval or datetime. It contains
+ *                          its sub types. For type different from interval and datetime, this value
+ *                          is NULL. The possible values can be seen in the DateSubcode enum.),

Review comment:
       In terms of organizing the response it makes sense, But since this will be used by the JDBC and ODBC, we decided the fields based on the responses that these technologies returns, therefore we will have some extra work to deal with these complex type to the actual response those applications need




-- 
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