CData Cloud offers access to Apache Impala across several standard services and protocols, in a cloud-hosted solution. Any application that can connect to a MySQL or SQL Server database can connect to Apache Impala through CData Cloud.
CData Cloud allows you to standardize and configure connections to Apache Impala as though it were any other OData endpoint, or standard SQL Server/MySQL database.
This page provides a guide to 接続の確立 to Apache Impala in CData Cloud, as well as information on the available resources, and a reference to the available connection properties.
接続の確立 shows how to authenticate to Apache Impala and configure any necessary connection properties to create a database in CData Cloud
Accessing data from Apache Impala through the available standard services and CData Cloud administration is documented in further details in the CData Cloud Documentation.
Connect to Apache Impala by selecting the corresponding icon in the Database tab. Required properties are listed under Settings. The Advanced tab lists connection properties that are not typically required.
Apache Impala に接続するには、Server、Port、およびProtocolVersion を設定します。オプションでデフォルトのDatabase を指定できます。
NOSASL、LDAP、KERBEROS など、Apache Impala を認証する方法はいくつかあります。次のセクションでは、それぞれの接続方法について説明します。
NOSASL を使用する場合、認証は行われません。ローカルネットワーク上のテストマシンなどの信頼できる場所からサーバーに接続する場合に使用されます。 デフォルトでは、NOSASL はデフォルトのAuthScheme であるため、追加の接続プロパティを設定する必要はありません。
LDAP で認証するには、次の接続プロパティを設定します。
Kerberosで認証する方法についての詳細は、Kerberos の使用 を参照してください。
To enable TLS/SSL in the Cloud, set UseSSL to True.
QueryPassthrough がfalse(デフォルト)に設定されている場合、CData Cloud はImpala が必要とする形式に適合するようにクエリを変更しようとします。
このセクションでは、Cloud を使ってKerberos でApache Impala に認証する方法を説明します。
Kerberos を使用してApache Impala に認証するには、次のプロパティを設定します。
次のオプションのいずれかを使用して、必要なKerberos チケットを取得できます。
このオプションを使用すると、MIT Kerberos チケットマネージャーまたはkinit コマンドを使ってチケットを取得できます。このオプションでは、User またはPassword 接続プロパティを設定する必要はないことに注意してください。
KRB5CCNAME 環境変数を設定する代わりに、KerberosTicketCache プロパティを使用してファイルパスを直接設定できます。 設定すると、Cloud は指定されたキャッシュファイルを使用してApache Impala に接続するためのkerberos チケットを取得します。
KRB5CCNAME 環境変数が設定されていない場合、Keytab ファイルを使用してKerberos チケットを取得できます。これを行うには、User プロパティを目的のユーザー名に設定し、KerberosKeytabFile プロパティをユーザーに関連付けられたキータブファイルを指すファイルパスに設定します。
KRB5CCNAME 環境変数およびKerberosKeytabFile プロパティの両方が設定されていない場合、User とPassword の組み合わせ を使用してチケットを取得できます。これを行うには、User およびPassword プロパティを、Apache Impala での認証に使用するユーザー / パスワードの組み合わせに設定します。
より複雑なKerberos 環境では、複数のレルムおよびKDC サーバーが使用されるクロスレルム認証が必要になる場合があります(例えば、1つのレルム/KDC がユーザー認証に使用され、別のレルム/KDC がサービスチケットの取得に使用される場合)。
このような環境では、KerberosRealm およびKerberosKDC プロパティをユーザー認証に必要な値に設定できます。KerberosServiceRealm およびKerberosServiceKDC プロパティは、サービスチケットの取得に必要な値に設定できます。
Date | Build Number | Change Type | Description |
08/17/2022 | 8264 | General | Changed
|
09/16/2021 | 7929 | Apache Impala | Added
|
09/02/2021 | 7915 | General | Added
|
08/07/2021 | 7889 | General | Changed
|
08/06/2021 | 7888 | General | Changed
|
07/23/2021 | 7874 | General | Changed
|
07/08/2021 | 7859 | General | Added
|
04/23/2021 | 7785 | General | Added
|
04/23/2021 | 7783 | General | Changed
|
04/16/2021 | 7776 | General | Added
Changed
|
04/15 /2021 | 7775 | General | Changed
|
このセクションでは、Apache Impala Cloud の高度な機能を厳選して説明します。
Cloud を使用すると、事前設定されたクエリによって内容が決定されるユーザー定義ビューと呼ばれる仮想テーブルを定義できます。 このビューは、ドライバーに発行されるクエリを直接制御できない場合に有効です。 カスタムビューの作成と設定の概要については、ユーザー定義ビュー を参照してください。
SSL の設定 を使用して、Cloud が証明書のネゴシエーションをどのように扱うかを調整します。さまざまな証明書形式を選択できます。 詳しくは、接続文字列オプションにあるSSLServerCert プロパティを参照してください。
Windows プロキシとHTTP プロキシを含むファイアウォールとプロキシ に合致するようCloud を設定します。トンネル接続を設定することもできます。
Cloud は、Apache Impala にできるだけ多くのSELECT ステートメント処理をオフロードし、残りのクエリをクライアント側のインメモリで処理します。
CData ログを調整するために使用可能な設定の概要については、ログ を参照してください。基本的なロギングでは、 次の2つの接続プロパティを設定するだけです。LogModules 接続プロパティを使用してログに記録する情報のサブセットを選択できる、 より洗練されたロギングをサポートする多数の機能があります。
CData Cloud を使用すると、事前設定されたクエリによって内容が決定される仮想テーブルを定義できます。これらはユーザー定義ビューと呼ばれ、ツール からドライバーを使用する場合など、ドライバーに発行されるクエリを直接制御できない場合に役立ちます。 ユーザー定義ビューを使用して、常に適用されるプレディケートを定義することができます。ビューへのクエリで追加のプレディケートを指定すると、それらはビューの一部としてすでに定義されているクエリと結合されます。
ユーザー定義ビューを作成する方法は2つあります。
また、複数のビュー定義を持ち、UserDefinedViews 接続プロパティを使用して制御することも可能です。このプロパティを使用すると、指定されたビューのみがCloud によって検知されます。
このユーザー定義ビューのコンフィギュレーションファイルは、次のようにフォーマットされています。
次に例を示します。
{ "MyView": { "query": "SELECT * FROM [CData].[Default].Customers WHERE MyColumn = 'value'" }, "MyView2": { "query": "SELECT * FROM MyTable WHERE Id IN (1,2,3)" } }UserDefinedViews 接続プロパティを使用して、JSON コンフィギュレーションファイルの場所を指定します。次に例を示します。
"UserDefinedViews", "C:\\Users\\yourusername\\Desktop\\tmp\\UserDefinedViews.json"
SELECT * FROM Customers WHERE City = 'Raleigh';ドライバーへのクエリは次のようになります。
SELECT * FROM UserViews.RCustomers WHERE Status = 'Active';ソースへの効果的なクエリは次のようになります。
SELECT * FROM Customers WHERE City = 'Raleigh' AND Status = 'Active';これは、ビュークエリとビュー定義を効果的に組み合わせた、ユーザー定義ビューへのクエリの非常にシンプルな例です。これらのクエリをはるかに複雑なパターンで構成することが可能です。すべてのSQL 操作は両方のクエリでサポートされ、必要に応じて組み合わされます。
デフォルトでは、Cloud はサーバーの証明書をシステムの信頼できる証明書ストアと照合してSSL / TLS のネゴシエーションを試みます。
別の証明書を指定するには、利用可能なフォーマットについてSSLServerCert プロパティを参照してください。
Windows のシステムプロキシ経由の接続では、接続プロパティを追加で設定する必要はありません。他のプロキシに接続するには、ProxyAutoDetect をfalse に設定します。
さらにHTTP プロキシへの認証には、ProxyServer とProxyPort に加えてProxyAuthScheme、ProxyUser、およびProxyPassword を設定します。
次のプロパティを設定します。
SQL-92をサポートしないソースに対しては、Cloud はApache Impala にSQLステートメントの処理を可能な限りオフロードし、残りのクエリをクライアントサイドのインメモリで処理します。その結果、最適なパフォーマンスを得ることができます。
限られたクエリ能力のデータソースに対しては、Cloud はSQL クエリの変換をおこない、Cloud がより単純になるよう処理します。 目標はデータソースのクエリ能力に基づいて賢く判断し可能な限り計算を抑えることです。Apache Impala のクエリ評価コンポーネントはSQL クエリを検証し、Cloud がネイティブに実行できないクエリ部分を示す情報を返します。
Apache Impala のクエリスライサーコンポーネントはより具体的なケースにおいて1つのクエリを複数の独立したクエリに分割するために使用されます。クライアントサイドのクエリエンジンはクエリの簡素化、複数のクエリへの分割、結果セットのサイズを最小化しながらクライアントサイドで集約のプッシュダウンや計算をするなどの決定を行います。
クエリを部分的にでもクライアントサイドで評価するということには大きなトレードオフがあります。このモデルでは効果的に実行することが不可能なクエリは常に存在し、この方法で計算すると特にコストが高くなるものもあります。CData は可能な限り効率的なクエリを生成し、最も柔軟なクエリ機能を提供するために常にデータソースに対して実行可能な限りのクエリをプッシュダウンしています。
Cloud のログを取得しておくことで、エラーメッセージや想定外の振る舞いを診断する際に役立ちます。
2つの接続プロパティを設定するだけで、Cloud のログを取得できます。
このプロパティを設定すると、認証が実行されたときやクエリが実行されたときなど、さまざまなタスクを実行する際に、Cloud がログファイルを生成します。指定したファイルが存在しない場合は作成されます。
Verbosity レベルは、Cloud がLogfile にどの程度の詳細さで記載するかを決定します。1 から5 までのVerbosity レベルがサポートされています。次のリストで、これらについて説明します。
1 | Verbosity を1に設定すると、クエリ、返された行数、実行開始とかかった時間、エラーが記録されます。 |
2 | Verbosity を2に設定すると、Verbosity 1に含まれるすべておよびリクエストに関する追加の情報が記録されます。 |
3 | Verbosity を3に設定すると、2 に加えてHTTP ヘッダーおよびリクエストとレスポンスの本文が記録されます。 |
4 | Verbosity を4に設定すると、3 に加えてデータソースとのトランスポートレベルの通信が記録されます。これには、SSL ネゴシエーションが含まれます。 |
5 | Verbosity を5に設定すると、データソースとのやり取りおよび問題のトラブルシューティングに役立つ追加情報も記録されます。これには、インターフェースコマンドが含まれます。 |
通常の実行では、Verbosity を2以上に設定しないでください。高い詳細レベルでは、大量のデータが記録されて、実行に遅れが生じる恐れがあります。
特定の情報に関するカテゴリを表示または非表示にしてログ内容を調整するには、LogModules を参照してください。
データセキュリティのベストプラクティス
パスワードなどのセンシティブデータは、接続文字列やログ内のすべてのリクエストでマスクされますが、組織外で共有する前に機密情報がないかログを確認することをお勧めします。
ログファイルに記録される情報を、正確に絞り込みたい場合があるかもしれません。これは、LogModules プロパティを使用することで可能です。
このプロパティを使えば、セミコロン区切りでリスト化されたログモジュールを使用してログ内容をフィルタできます。
すべてのモジュール名は4文字です。注意点として、3文字のモジュール名は、必ず最後に空白文字を含みます。利用可能なモジュールは次のとおりです。
LogModules=INFO;EXEC;SSL ;SQL ;META;
これらのモジュールはVerbosity を考慮して、取得中の情報の詳細レベルを変更します。
CData Cloud はクエリ、削除、編集、および挿入を含む、データに対する複数の処理をサポートします。
構文のリファレンスと例については、SELECT ステートメント を参照してください。
Apache Impala API 機能の詳細については、データモデル を参照してください。
構文のリファレンスと例については、INSERT ステートメント を参照してください。
EXECUTE またはEXEC ステートメントを使用して、ストアドプロシージャを実行します。構文のリファレンスと例については、EXECUTE ステートメント を参照してください。
SELECT ステートメントは次の基本的な句で構成できます。
次の構文ダイアグラムは、Cloud のSQL エンジン:
SELECT {
[ TOP <numeric_literal> | DISTINCT ]
{
*
| {
<expression> [ [ AS ] <column_reference> ]
| { <table_name> | <correlation_name> } .*
} [ , ... ]
}
[ INTO csv:// [ filename= ] <file_path> [ ;delimiter=tab ] ]
{
FROM <table_reference> [ [ AS ] <identifier> ]
} [ , ... ]
[ [
INNER | { { LEFT | RIGHT | FULL } [ OUTER ] }
] JOIN <table_reference> [ ON <search_condition> ] [ [ AS ] <identifier> ]
] [ ... ]
[ WHERE <search_condition> ]
[ GROUP BY <column_reference> [ , ... ]
[ HAVING <search_condition> ]
[ UNION [ ALL ] <select_statement> ]
[
ORDER BY
<column_reference> [ ASC | DESC ] [ NULLS FIRST | NULLS LAST ]
]
[
LIMIT <expression>
[
{ OFFSET | , }
<expression>
]
]
} | SCOPE_IDENTITY()
<expression> ::=
| <column_reference>
| @ <parameter>
| ?
| COUNT( * | { [ DISTINCT ] <expression> } )
| { AVG | MAX | MIN | SUM | COUNT } ( <expression> )
| NULLIF ( <expression> , <expression> )
| COALESCE ( <expression> , ... )
| CASE <expression>
WHEN { <expression> | <search_condition> } THEN { <expression> | NULL } [ ... ]
[ ELSE { <expression> | NULL } ]
END
| <literal>
| <sql_function>
<search_condition> ::=
{
<expression> { = | > | < | >= | <= | <> | != | LIKE | NOT LIKE | IN | NOT IN | IS NULL | IS NOT NULL | AND | OR | CONTAINS | BETWEEN } [ <expression> ]
} [ { AND | OR } ... ]
でサポートされている構文の概要を示します。
SELECT * FROM [CData].[Default].Customers
SELECT [CompanyName] AS MY_CompanyName FROM [CData].[Default].Customers
SELECT CAST(Balance AS VARCHAR) AS Str_Balance FROM [CData].[Default].Customers
SELECT * FROM [CData].[Default].Customers WHERE Country = 'US'
SELECT COUNT(*) AS MyCount FROM [CData].[Default].Customers
SELECT COUNT(DISTINCT CompanyName) FROM [CData].[Default].Customers
SELECT DISTINCT CompanyName FROM [CData].[Default].Customers
SELECT CompanyName, MAX(Balance) FROM [CData].[Default].Customers GROUP BY CompanyName詳しくは、集計関数 を参照してください。
SELECT Customers.ContactName, Orders.OrderDate FROM Customers, Orders WHERE Customers.CustomerId=Orders.CustomerId詳しくは、JOIN クエリ を参照してください。
SELECT City, CompanyName FROM [CData].[Default].Customers ORDER BY CompanyName ASC
SELECT City, CompanyName FROM [CData].[Default].Customers LIMIT 10
SELECT * FROM [CData].[Default].Customers WHERE Country = @param
SELECT ステートメントで入力専用フィールドを使用できます。これらのフィールド(疑似カラム)は、結果には
通常のカラムとして表示されることはありませんが、WHERE 句の一部として指定できます。疑似カラムを使用して、Apache Impala から追加機能にアクセスできます。
SELECT * FROM [CData].[Default].Customers WHERE MyPseudocolumn = 'MyValue'
クエリ条件に一致する行の数を返します。
SELECT COUNT(*) FROM [CData].[Default].Customers WHERE Country = 'US'
クエリ条件に一致する、null 以外の個別のフィールド値の数を返します。
SELECT COUNT(DISTINCT City) AS DistinctValues FROM [CData].[Default].Customers WHERE Country = 'US'
カラムの値の平均を返します。
SELECT CompanyName, AVG(Balance) FROM [CData].[Default].Customers WHERE Country = 'US' GROUP BY CompanyName
カラムの値の最小値を返します。
SELECT MIN(Balance), CompanyName FROM [CData].[Default].Customers WHERE Country = 'US' GROUP BY CompanyName
カラムの値の最大値を返します。
SELECT CompanyName, MAX(Balance) FROM [CData].[Default].Customers WHERE Country = 'US' GROUP BY CompanyName
カラムの値の合計を返します。
SELECT SUM(Balance) FROM [CData].[Default].Customers WHERE Country = 'US'
CData Cloud は次の例のような標準SQL の結合をサポートします。
内部結合は、結合条件に合う行のみを両テーブルから選択します。
SELECT Customers.ContactName, Orders.OrderDate FROM Customers, Orders WHERE Customers.CustomerId=Orders.CustomerId
左結合は、FROM テーブルのすべての行とJOIN テーブルの条件に合う行のみを選択します。
SELECT Customers.ContactName, Orders.OrderDate FROM Customers LEFT OUTER JOIN Orders ON Customers.CustomerId=Orders.CustomerId
次の日付リテラル関数を使用して、相対間隔を使って日付フィールドをフィルタできます。これらの関数では、<、>、および = 演算子がサポートされていますが、<= および >= はサポートされていないことに注意してください。
現在の日。
SELECT * FROM MyTable WHERE MyDateField = L_TODAY()
前の日。
SELECT * FROM MyTable WHERE MyDateField = L_YESTERDAY()
次の日。
SELECT * FROM MyTable WHERE MyDateField = L_TOMORROW()
前の週のすべての日。
SELECT * FROM MyTable WHERE MyDateField = L_LAST_WEEK()
現在の週のすべての日。
SELECT * FROM MyTable WHERE MyDateField = L_THIS_WEEK()
次の週のすべての日。
SELECT * FROM MyTable WHERE MyDateField = L_NEXT_WEEK()以下も利用可能です:
現在の日を除く過去n 日。
SELECT * FROM MyTable WHERE MyDateField = L_LAST_N_DAYS(3)
現在の日を含む次のn 日。
SELECT * FROM MyTable WHERE MyDateField = L_NEXT_N_DAYS(3)以下も利用可能です:
現在の週のn 週前から始まり、前の週で終わる、すべての週のすべての日。
SELECT * FROM MyTable WHERE MyDateField = L_LAST_N_WEEKS(3)
次の週から始まり、n 週後に終わる、すべての週のすべての日。
SELECT * FROM MyTable WHERE MyDateField = L_NEXT_N_WEEKS(3)以下も利用可能です:
Returns expr rounded to d decimal places using HALF_UP rounding mode.
Returns expr rounded to d decimal places using HALF_EVEN rounding mode.
Returns the largest integer not greater than expr.
Returns the smallest integer not smaller than expr.
Returns a random value with independent and identically distributed (i.i.d.) uniformly distributed values in [0, 1).
Returns e to the power of expr.
Returns the natural logarithm (base e) of expr.
Returns the logarithm of expr with base 10.
Returns the logarithm of expr with base 2.
Returns the logarithm of expr with base.
Raises expr1 to the power of expr2.
Returns the square root of expr.
Returns the string representation of the long value expr represented in binary.
Converts expr to hexadecimal.
Converts hexadecimal expr to binary.
Convert num from from_base to to_base.
Returns the absolute value of the numeric value.
Returns the positive value of expr1 mod expr2.
Returns the sine of expr, as if computed by java.lang.Math.sin.
Returns the inverse sine (a.k.a. arc sine) the arc sin of expr, as if computed by java.lang.Math.asin.
Returns the cosine of expr, as if computed by java.lang.Math.cos.
Returns the inverse cosine (a.k.a. arc cosine) of expr, as if computed by java.lang.Math.acos.
Returns the tangent of expr, as if computed by java.lang.Math.tan.
Returns the inverse tangent (a.k.a. arc tangent) of expr, as if computed by java.lang.Math.atan
Converts radians to degrees.
Converts degrees to radians.
Returns the postive value of expr.
Returns the negated value of expr.
Returns -1.0, 0.0 or 1.0 as expr is negative, 0 or positive.
Returns Euler's number, e.
Returns pi.
Returns the factorial of expr. expr is [0..20]. Otherwise, null.
Returns the cube root of expr.
Bitwise left shift.
Bitwise right shift.
Bitwise unsigned right shift.
Returns the greatest value of all parameters, skipping null values.
Returns the least value of all parameters, skipping null values.
Returns an integer between 0 and num_buckets+1 by mapping expr into the ith equally sized bucket. Buckets are made by dividing [min_value, max_value] into equally sized regions. If expr < min_value, return 1, if expr > max_value return num_buckets+1.
Returns the size of an array or a map. Returns -1 if null.
Returns an unordered array containing the keys of the map.
Returns an unordered array containing the values of the map.
Returns true if the array contains the value.
Sorts the input array in ascending or descending order according to the natural ordering of the array elements.
Casts the value expr to the target data type binary.
Casts the value expr to the target data type type.
Returns the UNIX timestamp of the given time.
Parses the date_str expression with the fmt expression to a date. Returns null with invalid input. By default, it follows casting rules to a date if the fmt is omitted.
Returns the year component of the date/timestamp.
Returns the quarter of the year for date, in the range 1 to 4.
Returns the month component of the date/timestamp.
Returns the day of month of the date/timestamp.
Returns the hour component of the string/timestamp.
Returns the minute component of the string/timestamp.
Returns the second component of the string/timestamp.
Returns the week of the year of the given date. A week is considered to start on a Monday and week 1 is the first week with >3 days.
Returns the number of days from startDate to endDate.
Returns the date that is num_days after start_date.
Returns the date that is num_days before start_date.
Given a timestamp like '2017-07-14 02:40:00.0', interprets it as a time in UTC, and renders that time as a timestamp in the given time zone. For example, 'GMT+1' would yield '2017-07-14 03:40:00.0'.
Given a timestamp like '2017-07-14 02:40:00.0', interprets it as a time in the given time zone, and renders that time as a timestamp in UTC. For example, 'GMT+1' would yield '2017-07-14 01:40:00.0'.
Returns the current date at the start of query evaluation.
Returns the current timestamp at the start of query evaluation.
Returns the date that is num_months after start_date.
Returns the last day of the month which the date belongs to.
Returns the first date which is later than start_date and named as indicated.
Returns date with the time portion of the day truncated to the unit specified by the format model fmt. fmt should be one of ["year", "yyyy", "yy", "mon", "month", "mm"]
Returns number of months between timestamp1 and timestamp2.
Converts timestamp to a value of string in the format specified by the date format fmt.
If expr1 evaluates to true, then returns expr2; otherwise returns expr3.
Returns true if expr is null, or false otherwise.
Returns true if expr is not null, or false otherwise.
Returns expr1 if it's not NaN, or expr2 otherwise.
Returns the first non-null argument if exists. Otherwise, null.
Returns null if expr1 equals to expr2, or expr1 otherwise.
Throws an exception if expr is not true.
Returns the numeric value of the first character of str.
Converts the argument from a binary bin to a base 64 string.
Returns the character length of string data or number of bytes of binary data. The length of string data includes the trailing spaces. The length of binary data includes binary zeros.
Returns the ASCII character having the binary equivalent to expr. If n is larger than 256 the result is equivalent to chr(n % 256)
Returns the concatenation of the strings separated by sep.
Decodes the first argument using the second argument character set.
Returns the n-th input, e.g., returns input2 when n is 2.
Encodes the first argument using the second argument character set.
Returns the index of val in the val1,val2,val3,... list or 0 if not found. For example field('world','say','hello','world') returns 3. All primitive types are supported, arguments are compared using str.equals(x). If val is NULL, the return value is 0.
Returns the index (1-based) of the given string (str) in the comma-delimited list (str_array). Returns 0, if the string was not found or if the given string (str) contains a comma.
Formats the number expr1 like '#,###,###.##', rounded to expr2 decimal places. If expr2 is 0, the result has no decimal point or fractional part. This is supposed to function like MySQL's FORMAT.
Extracts a json object from path.
Returns true if the string str appears as an entire line in filename.
Returns the (1-based) index of the first occurrence of substr in str.
Returns the character length of string data or number of bytes of binary data. The length of string data includes the trailing spaces. The length of binary data includes binary zeros.
Returns the position of the first occurrence of substr in str after position pos. The given pos and return value are 1-based.
Returns str with all characters changed to lowercase.
Returns str, left-padded with pad to a length of len. If str is longer than len, the return value is shortened to len characters.
Removes the leading space characters from str.
Returns the byte length of expr or number of bytes in binary data.
Returns the specified part from the URL. For example, parse_url('http://facebook.com/path1/p.php?k1=v1#Ref1', 'HOST') returns 'facebook.com'. Also a value of a particular key in QUERY can be extracted by providing the key as the third argument, for example, parse_url('http://facebook.com/path1/p.php?k1=v1#Ref1', 'QUERY', 'k1') returns 'v1'.
Returns a formatted string from printf-style format strings.
Extracts a group that matches regexp.
Replaces all substring of str that match regexp with rep.
Returns the string which repeats the given string value n times.
Replaces all occurrences of search with replace. If search is not found in str, str is returned unchanged. If replace is not specified or is an empty string, nothing replaces the string that is removed from str.
Returns the reversed given string.
Returns str, right-padded with pad to a length of len. If str is longer than len, the return value is shortened to len characters.
Removes the trailing space characters from str.
Splits str into an array of array of words.
Returns a string consisting of n spaces.
Splits str around occurrences that match regex.
Creates a map after splitting the text into key/value pairs using delimiters. Default delimiters are ',' for pairDelim and ':' for keyValueDelim.
Returns the substring of str that starts at pos and is of length len, or the slice of byte array that starts at pos and is of length len.
Returns the substring from str before count occurrences of the delimiter delim. If count is positive, everything to the left of the final delimiter (counting from the left) is returned. If count is negative, everything to the right of the final delimiter (counting from the right) is returned. The function substring_index performs a case-sensitive match when searching for delim.
Translates the input string by replacing the characters present in the from string with the corresponding characters in the to string.
Removes the leading and trailing space characters from str.
Converts the argument from a base 64 string str to a binary.
Returns str with all characters changed to uppercase.
Returns str with the first letter of each word in uppercase. All other letters are in lowercase. Words are delimited by white space.
Returns the Levenshtein distance between the two given strings.
Returns Soundex code of the string.
Returns a masked version of str. By default, upper case letters are converted to "X", lower case letters are converted to "x" and numbers are converted to "n". For example mask("abcd-EFGH-8765-4321") results in xxxx-XXXX-nnnn-nnnn. You can override the characters used in the mask by supplying additional arguments: the second argument controls the mask character for upper case letters, the third argument for lower case letters and the fourth argument for numbers. For example, mask("abcd-EFGH-8765-4321", "U", "l", "#") results in llll-UUUU-####-####.
Returns a masked version of str with the first n values masked. Upper case letters are converted to "X", lower case letters are converted to "x" and numbers are converted to "n". For example, mask_first_n("1234-5678-8765-4321", 4) results in nnnn-5678-8765-4321.
Returns a masked version of str with the last n values masked. Upper case letters are converted to "X", lower case letters are converted to "x" and numbers are converted to "n". For example, mask_last_n("1234-5678-8765-4321", 4) results in 1234-5678-8765-nnnn.
Returns a masked version of str, showing the first n characters unmasked. Upper case letters are converted to "X", lower case letters are converted to "x" and numbers are converted to "n". For example, mask_show_first_n("1234-5678-8765-4321", 4) results in 1234-nnnn-nnnn-nnnn.
Returns a masked version of str, showing the last n characters unmasked. Upper case letters are converted to "X", lower case letters are converted to "x" and numbers are converted to "n". For example, mask_show_last_n("1234-5678-8765-4321", 4) results in nnnn-nnnn-nnnn-4321.
Returns a hashed value based on str. The hash is consistent and can be used to join masked values together across tables. This function returns null for non-string types.
Calls a method with reflection.
Calls a method with reflection.
Returns a hash value of the arguments.
Returns current user name from the configured authenticator manager. Could be the same as the user provided when connecting, but with some authentication managers (for example HadoopDefaultAuthenticator) it could be different.
Returns current user name from the session state. This is the username provided when connecting to Impala.
Returns current database name.
Returns an MD5 128-bit checksum as a hex string of expr.
Returns a sha1 hash value as a hex string of the expr.
Returns a cyclic redundancy check value of the expr as a bigint.
Returns a checksum of SHA-2 family as a hex string of expr. SHA-224, SHA-256, SHA-384, and SHA-512 are supported. Bit length of 0 is equivalent to 256.
Encrypt input using AES. Key lengths of 128, 192 or 256 bits can be used. 192 and 256 bits keys can be used if Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files are installed. If either argument is NULL or the key length is not one of the permitted values, the return value is NULL. Example: base64(aes_encrypt('ABC', '1234567890123456')) = 'y6Ss+zCYObpCbgfWfyNWTw=='.
Returns the Impala version. The string contains 2 fields, the first being a build number and the second being a build hash. Example: "select version();" might return "2.1.0.2.5.0.0-1245 r027527b9c5ce1a3d7d0b6d2e6de2378fb0c39232". Actual results will depend on your build.
Returns the number of rows for which the supplied expression(s) are unique and non-null.
Returns the sum calculated from values of a group.
Returns the sum calculated from distinct values of a group.
Returns the mean calculated from values of a group.
Returns the mean calculated from distinct values of a group.
Returns the minimum value of expr.
Returns the maximum value of expr.
Returns the sample variance calculated from values of a group.
Returns the population standard deviation calculated from values of a group.
Returns the sample standard deviation calculated from values of a group.
Returns the population covariance of a set of number pairs.
Returns the sample covariance of a set of number pairs.
Returns Pearson coefficient of correlation between a set of number pairs.
Returns the exact percentile value of numeric column col at the given percentage. The value of percentage must be between 0.0 and 1.0. The value of frequency should be positive integral
Returns the approximate percentile value of numeric column col at the given percentage. The value of percentage must be between 0.0 and 1.0. The accuracy parameter (default: 10000) is a positive numeric literal which controls approximation accuracy at the cost of memory. Higher value of accuracy yields better accuracy, 1.0/accuracy is the relative error of the approximation. When percentage is an array, each value of the percentage array must be between 0.0 and 1.0. In this case, returns the approximate percentile array of column col at the given percentage array.
Collects and returns a set of unique elements.
Collects and returns a set of unique elements.
Divides the rows for each window partition into n buckets ranging from 1 to at most n.
Separates the elements of array expr into multiple rows, or the elements of map expr into multiple rows and columns.
Separates the elements of array expr into multiple rows with positions, or the elements of map expr into multiple rows and columns with positions.
Explodes an array of structs into a table.
Separates expr1, ..., exprk into n rows.
Takes URL string and a set of n URL parts, and returns a tuple of n values. This is similar to the parse_url() UDF but can extract multiple parts at once out of a URL. Valid part names are: HOST, PATH, QUERY, REF, PROTOCOL, AUTHORITY, FILE, USERINFO, QUERY:[KEY].
Returns expr rounded to d decimal places using HALF_UP rounding mode.
Returns expr rounded to d decimal places using HALF_EVEN rounding mode.
Returns the largest integer not greater than expr.
Returns the smallest integer not smaller than expr.
Returns a random value with independent and identically distributed (i.i.d.) uniformly distributed values in [0, 1).
Returns e to the power of expr.
Returns the natural logarithm (base e) of expr.
Returns the logarithm of expr with base 10.
Returns the logarithm of expr with base 2.
Returns the logarithm of expr with base.
Raises expr1 to the power of expr2.
Returns the square root of expr.
Returns the string representation of the long value expr represented in binary.
Converts expr to hexadecimal.
Converts hexadecimal expr to binary.
Convert num from from_base to to_base.
Returns the absolute value of the numeric value.
Returns the positive value of expr1 mod expr2.
Returns the sine of expr, as if computed by java.lang.Math.sin.
Returns the inverse sine (a.k.a. arc sine) the arc sin of expr, as if computed by java.lang.Math.asin.
Returns the cosine of expr, as if computed by java.lang.Math.cos.
Returns the inverse cosine (a.k.a. arc cosine) of expr, as if computed by java.lang.Math.acos.
Returns the tangent of expr, as if computed by java.lang.Math.tan.
Returns the inverse tangent (a.k.a. arc tangent) of expr, as if computed by java.lang.Math.atan
Converts radians to degrees.
Converts degrees to radians.
Returns the postive value of expr.
Returns the negated value of expr.
Returns -1.0, 0.0 or 1.0 as expr is negative, 0 or positive.
Returns Euler's number, e.
Returns pi.
Returns the factorial of expr. expr is [0..20]. Otherwise, null.
Returns the cube root of expr.
Bitwise left shift.
Bitwise right shift.
Bitwise unsigned right shift.
Returns the greatest value of all parameters, skipping null values.
Returns the least value of all parameters, skipping null values.
Returns an integer between 0 and num_buckets+1 by mapping expr into the ith equally sized bucket. Buckets are made by dividing [min_value, max_value] into equally sized regions. If expr < min_value, return 1, if expr > max_value return num_buckets+1.
Returns the size of an array or a map. Returns -1 if null.
Returns an unordered array containing the keys of the map.
Returns an unordered array containing the values of the map.
Returns true if the array contains the value.
Sorts the input array in ascending or descending order according to the natural ordering of the array elements.
Casts the value expr to the target data type binary.
Casts the value expr to the target data type type.
Returns the UNIX timestamp of the given time.
Parses the date_str expression with the fmt expression to a date. Returns null with invalid input. By default, it follows casting rules to a date if the fmt is omitted.
Returns the year component of the date/timestamp.
Returns the quarter of the year for date, in the range 1 to 4.
Returns the month component of the date/timestamp.
Returns the day of month of the date/timestamp.
Returns the hour component of the string/timestamp.
Returns the minute component of the string/timestamp.
Returns the second component of the string/timestamp.
Returns the week of the year of the given date. A week is considered to start on a Monday and week 1 is the first week with >3 days.
Returns the number of days from startDate to endDate.
Returns the date that is num_days after start_date.
Returns the date that is num_days before start_date.
Given a timestamp like '2017-07-14 02:40:00.0', interprets it as a time in UTC, and renders that time as a timestamp in the given time zone. For example, 'GMT+1' would yield '2017-07-14 03:40:00.0'.
Given a timestamp like '2017-07-14 02:40:00.0', interprets it as a time in the given time zone, and renders that time as a timestamp in UTC. For example, 'GMT+1' would yield '2017-07-14 01:40:00.0'.
Returns the current date at the start of query evaluation.
Returns the current timestamp at the start of query evaluation.
Returns the date that is num_months after start_date.
Returns the last day of the month which the date belongs to.
Returns the first date which is later than start_date and named as indicated.
Returns date with the time portion of the day truncated to the unit specified by the format model fmt. fmt should be one of ["year", "yyyy", "yy", "mon", "month", "mm"]
Returns number of months between timestamp1 and timestamp2.
Converts timestamp to a value of string in the format specified by the date format fmt.
If expr1 evaluates to true, then returns expr2; otherwise returns expr3.
Returns true if expr is null, or false otherwise.
Returns true if expr is not null, or false otherwise.
Returns expr1 if it's not NaN, or expr2 otherwise.
Returns the first non-null argument if exists. Otherwise, null.
Returns null if expr1 equals to expr2, or expr1 otherwise.
Throws an exception if expr is not true.
Returns the numeric value of the first character of str.
Converts the argument from a binary bin to a base 64 string.
Returns the character length of string data or number of bytes of binary data. The length of string data includes the trailing spaces. The length of binary data includes binary zeros.
Returns the ASCII character having the binary equivalent to expr. If n is larger than 256 the result is equivalent to chr(n % 256)
Returns the concatenation of the strings separated by sep.
Decodes the first argument using the second argument character set.
Returns the n-th input, e.g., returns input2 when n is 2.
Encodes the first argument using the second argument character set.
Returns the index of val in the val1,val2,val3,... list or 0 if not found. For example field('world','say','hello','world') returns 3. All primitive types are supported, arguments are compared using str.equals(x). If val is NULL, the return value is 0.
Returns the index (1-based) of the given string (str) in the comma-delimited list (str_array). Returns 0, if the string was not found or if the given string (str) contains a comma.
Formats the number expr1 like '#,###,###.##', rounded to expr2 decimal places. If expr2 is 0, the result has no decimal point or fractional part. This is supposed to function like MySQL's FORMAT.
Extracts a json object from path.
Returns true if the string str appears as an entire line in filename.
Returns the (1-based) index of the first occurrence of substr in str.
Returns the character length of string data or number of bytes of binary data. The length of string data includes the trailing spaces. The length of binary data includes binary zeros.
Returns the position of the first occurrence of substr in str after position pos. The given pos and return value are 1-based.
Returns str with all characters changed to lowercase.
Returns str, left-padded with pad to a length of len. If str is longer than len, the return value is shortened to len characters.
Removes the leading space characters from str.
Returns the byte length of expr or number of bytes in binary data.
Returns the specified part from the URL. For example, parse_url('http://facebook.com/path1/p.php?k1=v1#Ref1', 'HOST') returns 'facebook.com'. Also a value of a particular key in QUERY can be extracted by providing the key as the third argument, for example, parse_url('http://facebook.com/path1/p.php?k1=v1#Ref1', 'QUERY', 'k1') returns 'v1'.
Returns a formatted string from printf-style format strings.
Extracts a group that matches regexp.
Replaces all substring of str that match regexp with rep.
Returns the string which repeats the given string value n times.
Replaces all occurrences of search with replace. If search is not found in str, str is returned unchanged. If replace is not specified or is an empty string, nothing replaces the string that is removed from str.
Returns the reversed given string.
Returns str, right-padded with pad to a length of len. If str is longer than len, the return value is shortened to len characters.
Removes the trailing space characters from str.
Splits str into an array of array of words.
Returns a string consisting of n spaces.
Splits str around occurrences that match regex.
Creates a map after splitting the text into key/value pairs using delimiters. Default delimiters are ',' for pairDelim and ':' for keyValueDelim.
Returns the substring of str that starts at pos and is of length len, or the slice of byte array that starts at pos and is of length len.
Returns the substring from str before count occurrences of the delimiter delim. If count is positive, everything to the left of the final delimiter (counting from the left) is returned. If count is negative, everything to the right of the final delimiter (counting from the right) is returned. The function substring_index performs a case-sensitive match when searching for delim.
Translates the input string by replacing the characters present in the from string with the corresponding characters in the to string.
Removes the leading and trailing space characters from str.
Converts the argument from a base 64 string str to a binary.
Returns str with all characters changed to uppercase.
Returns str with the first letter of each word in uppercase. All other letters are in lowercase. Words are delimited by white space.
Returns the Levenshtein distance between the two given strings.
Returns Soundex code of the string.
Returns a masked version of str. By default, upper case letters are converted to "X", lower case letters are converted to "x" and numbers are converted to "n". For example mask("abcd-EFGH-8765-4321") results in xxxx-XXXX-nnnn-nnnn. You can override the characters used in the mask by supplying additional arguments: the second argument controls the mask character for upper case letters, the third argument for lower case letters and the fourth argument for numbers. For example, mask("abcd-EFGH-8765-4321", "U", "l", "#") results in llll-UUUU-####-####.
Returns a masked version of str with the first n values masked. Upper case letters are converted to "X", lower case letters are converted to "x" and numbers are converted to "n". For example, mask_first_n("1234-5678-8765-4321", 4) results in nnnn-5678-8765-4321.
Returns a masked version of str with the last n values masked. Upper case letters are converted to "X", lower case letters are converted to "x" and numbers are converted to "n". For example, mask_last_n("1234-5678-8765-4321", 4) results in 1234-5678-8765-nnnn.
Returns a masked version of str, showing the first n characters unmasked. Upper case letters are converted to "X", lower case letters are converted to "x" and numbers are converted to "n". For example, mask_show_first_n("1234-5678-8765-4321", 4) results in 1234-nnnn-nnnn-nnnn.
Returns a masked version of str, showing the last n characters unmasked. Upper case letters are converted to "X", lower case letters are converted to "x" and numbers are converted to "n". For example, mask_show_last_n("1234-5678-8765-4321", 4) results in nnnn-nnnn-nnnn-4321.
Returns a hashed value based on str. The hash is consistent and can be used to join masked values together across tables. This function returns null for non-string types.
Calls a method with reflection.
Calls a method with reflection.
Returns a hash value of the arguments.
Returns current user name from the configured authenticator manager. Could be the same as the user provided when connecting, but with some authentication managers (for example HadoopDefaultAuthenticator) it could be different.
Returns current user name from the session state. This is the username provided when connecting to Impala.
Returns current database name.
Returns an MD5 128-bit checksum as a hex string of expr.
Returns a sha1 hash value as a hex string of the expr.
Returns a cyclic redundancy check value of the expr as a bigint.
Returns a checksum of SHA-2 family as a hex string of expr. SHA-224, SHA-256, SHA-384, and SHA-512 are supported. Bit length of 0 is equivalent to 256.
Encrypt input using AES. Key lengths of 128, 192 or 256 bits can be used. 192 and 256 bits keys can be used if Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files are installed. If either argument is NULL or the key length is not one of the permitted values, the return value is NULL. Example: base64(aes_encrypt('ABC', '1234567890123456')) = 'y6Ss+zCYObpCbgfWfyNWTw=='.
Returns the Impala version. The string contains 2 fields, the first being a build number and the second being a build hash. Example: "select version();" might return "2.1.0.2.5.0.0-1245 r027527b9c5ce1a3d7d0b6d2e6de2378fb0c39232". Actual results will depend on your build.
Returns the number of rows for which the supplied expression(s) are unique and non-null.
Returns the sum calculated from values of a group.
Returns the sum calculated from distinct values of a group.
Returns the mean calculated from values of a group.
Returns the mean calculated from distinct values of a group.
Returns the minimum value of expr.
Returns the maximum value of expr.
Returns the sample variance calculated from values of a group.
Returns the population standard deviation calculated from values of a group.
Returns the sample standard deviation calculated from values of a group.
Returns the population covariance of a set of number pairs.
Returns the sample covariance of a set of number pairs.
Returns Pearson coefficient of correlation between a set of number pairs.
Returns the exact percentile value of numeric column col at the given percentage. The value of percentage must be between 0.0 and 1.0. The value of frequency should be positive integral
Returns the approximate percentile value of numeric column col at the given percentage. The value of percentage must be between 0.0 and 1.0. The accuracy parameter (default: 10000) is a positive numeric literal which controls approximation accuracy at the cost of memory. Higher value of accuracy yields better accuracy, 1.0/accuracy is the relative error of the approximation. When percentage is an array, each value of the percentage array must be between 0.0 and 1.0. In this case, returns the approximate percentile array of column col at the given percentage array.
Collects and returns a set of unique elements.
Collects and returns a set of unique elements.
Divides the rows for each window partition into n buckets ranging from 1 to at most n.
Separates the elements of array expr into multiple rows, or the elements of map expr into multiple rows and columns.
Separates the elements of array expr into multiple rows with positions, or the elements of map expr into multiple rows and columns with positions.
Explodes an array of structs into a table.
Separates expr1, ..., exprk into n rows.
Takes URL string and a set of n URL parts, and returns a tuple of n values. This is similar to the parse_url() UDF but can extract multiple parts at once out of a URL. Valid part names are: HOST, PATH, QUERY, REF, PROTOCOL, AUTHORITY, FILE, USERINFO, QUERY:[KEY].
SELECT INTO ステートメントを使って、書式付きデータをファイルにエクスポートできます。
次のクエリは、comma-separated values(CSV)ファイルフォーマットにデータをエクスポートします。
SELECT City, CompanyName INTO [csv://[CData].[Default].Customers.txt] FROM [[CData].[Default].Customers] WHERE Country = 'US'ファイルURI で他のフォーマットを指定できます。利用可能な区切り文字はタブ、セミコロン、カンマです。デフォルトはカンマです。次の例は、tab-separated values(TSV)にエクスポートします。
SELECT City, CompanyName INTO [csv://[CData].[Default].Customers.txt;delimiter=tab] FROM [[CData].[Default].Customers] WHERE Country = 'US'URI で他のファイルフォーマットを指定できます。以下の例は、tab-separated values(TSV)にエクスポートします。
Cloud には、ほとんどの標準的なデータベースで使用できる関数と同様の関数が用意されています。これらの関数は、CData プロバイダーエンジンで実装されるため、同じ一貫したAPI を使用してすべてのデータソースに渡って使用できます。関数にはstring、date、math の3つのカテゴリがあります。
Cloud はすべてのSQL 関数入力を文字列またはカラム識別子のいずれかとして解釈するため、すべてのリテラルを単一引用符で文字列としてエスケープする必要があります。例えば、DATENAME 関数のSQL Server 構文とCloud 構文を比較すると次のようになります。
SELECT DATENAME(yy,GETDATE())
SELECT DATENAME('yy',GETDATE())
これらの関数は、文字列操作を実行し、文字列値を返します。詳しくは、文字列関数 を参照してください。
SELECT CONCAT(firstname, space(4), lastname) FROM [CData].[Default].Customers WHERE Country = 'US'
これらの関数は、日付および日時操作を実行します。詳しくは、日付関数 を参照してください。
SELECT CURRENT_TIMESTAMP() FROM [CData].[Default].Customers
これらの関数は、数値演算を提供します。詳しくは、算術関数 を参照してください。
SELECT RAND() FROM [CData].[Default].Customers
SELECT CONCAT('Mr.', SPACE(2), firstname, SPACE(4), lastname) FROM [CData].[Default].Customers
この関数はSQL クエリのWHERE 句でクライテリアを特定するために使われます。詳しくは、叙述関数 を参照してください。
* FROM [CData].[Default].Customers WHERE CreatedDate = NOW()
文字式の左端の文字のASCII コード値を返します。
SELECT ASCII('0'); -- Result: 48
整数のASCII コードを対応する文字に変換します。
SELECT CHAR(48); -- Result: '0'
指定した文字列式の開始位置を返します。
SELECT CHARINDEX('456', '0123456'); -- Result: 4 SELECT CHARINDEX('456', '0123456', 5); -- Result: -1
式内にあるUTF-8 文字の数を返します。
SELECT CHAR_LENGTH('sample text') FROM Account LIMIT 1 -- Result: 11
2つ以上の文字列値を連結した文字列を返します。
SELECT CONCAT('Hello, ', 'world!'); -- Result: 'Hello, world!'
expressionToSearch 中にexpressionToFind が見つかった場合は1を、それ以外は0を返します。
SELECT CONTAINS('0123456', '456'); -- Result: 1 SELECT CONTAINS('0123456', 'Not a number'); -- Result: 0
character_expression がcharacter_suffix で終わる場合は1を、それ以外は0を返します。
SELECT ENDSWITH('0123456', '456'); -- Result: 1 SELECT ENDSWITH('0123456', '012'); -- Result: 0
指定されたファイルパスのファイルに存在するバイト数を返します。
SELECT FILESIZE('C:/Users/User1/Desktop/myfile.txt'); -- Result: 23684
指定された書式で値をフォーマットして返します。
SELECT FORMAT(12.34, '#'); -- Result: 12 SELECT FORMAT(12.34, '#.###'); -- Result: 12.34 SELECT FORMAT(1234, '0.000E0'); -- Result: 1.234E3 SELECT FORMAT('2019/01/01', 'yyyy-MM-dd'); -- Result: 2019-01-01 SELECT FORMAT('20190101', 'yyyyMMdd', 'yyyy-MM-dd'); -- Result: '2019-01-01'
unix_timestamp 引数を、現在のタイムゾーンで表されたYYYY-MM-DD HH:MM:SS の値で返します。
SELECT FROM_UNIXTIME(1540495231, 1); -- Result: 2018-10-25 19:20:31 SELECT FROM_UNIXTIME(1540495357385, 0); -- Result: 2018-10-25 19:22:37
指定されたアルゴリズムを使用して、入力値のハッシュをバイト配列として返します。サポートされているアルゴリズムはMD5、SHA1、SHA2_256、SHA2_512、SHA3_224、SHA3_256、SHA3_384、およびSHA3_512 です。
SELECT HASHBYTES('MD5', 'Test'); -- Result (byte array): 0x0CBC6611F5540BD0809A388DC95A615B
指定した文字列式の開始位置を返します。
SELECT INDEXOF('0123456', '456'); -- Result: 4 SELECT INDEXOF('0123456', '456', 5); -- Result: -1
null を指定した置換値に置き換えます。
SELECT ISNULL(42, 'Was NULL'); -- Result: 42 SELECT ISNULL(NULL, 'Was NULL'); -- Result: 'Was NULL'
JSON オブジェクト内のJSON 配列の平均値を計算します。配列へのパスはjsonpath 引数で指定します。戻り値は数値またはnull です。
SELECT JSON_AVG('[1,2,3,4,5]', '$[x]'); -- Result: 3 SELECT JSON_AVG('{"test": {"data": [1,2,3,4,5]}}', '$.test.data[x]'); -- Result: 3 SELECT JSON_AVG('{"test": {"data": [1,2,3,4,5]}}', '$.test.data[3..]'); -- Result: 4.5
JSON オブジェクト内のJSON 配列のエレメント数を返します。配列へのパスはjsonpath 引数で指定します。戻り値は数値またはnull です。
SELECT JSON_COUNT('[1,2,3,4,5]', '$[x]'); -- Result: 5 SELECT JSON_COUNT('{"test": {"data": [1,2,3,4,5]}}', '$.test.data[x]'); -- Result: 5 SELECT JSON_COUNT('{"test": {"data": [1,2,3,4,5]}}', '$.test.data[3..]'); -- Result: 2
JSON 配列またはオブジェクトのあらゆる値を選択します。配列へのパスはjsonpath 引数で指定します。戻り値は数値またはnull です。
SELECT JSON_EXTRACT('{"test": {"data": 1}}', '$.test'); -- Result: '{"data":1}' SELECT JSON_EXTRACT('{"test": {"data": 1}}', '$.test.data'); -- Result: 1 SELECT JSON_EXTRACT('{"test": {"data": [1, 2, 3]}}', '$.test.data[1]'); -- Result: 2
JSON オブジェクト内のJSON 配列の最大値を取得します。配列へのパスはjsonpath 引数で指定します。戻り値は数値またはnull です。
SELECT JSON_MAX('[1,2,3,4,5]', '$[x]'); -- Result: 5 SELECT JSON_MAX('{"test": {"data": [1,2,3,4,5]}}', '$.test.data[x]'); -- Result: 5 SELECT JSON_MAX('{"test": {"data": [1,2,3,4,5]}}', '$.test.data[..3]'); -- Result: 4
JSON オブジェクト内のJSON 配列の最小値を取得します。配列へのパスはjsonpath 引数で指定します。戻り値は数値またはnull です。
SELECT JSON_MIN('[1,2,3,4,5]', '$[x]'); -- Result: 1 SELECT JSON_MIN('{"test": {"data": [1,2,3,4,5]}}', '$.test.data[x]'); -- Result: 1 SELECT JSON_MIN('{"test": {"data": [1,2,3,4,5]}}', '$.test.data[3..]'); -- Result: 4
JSONPath 式に応じたJSON のサマリー値を計算します。戻り値は数値またはnull です。
SELECT JSON_SUM('[1,2,3,4,5]', '$[x]'); -- Result: 15 SELECT JSON_SUM('{"test": {"data": [1,2,3,4,5]}}', '$.test.data[x]'); -- Result: 15 SELECT JSON_SUM('{"test": {"data": [1,2,3,4,5]}}', '$.test.data[3..]'); -- Result: 9
指定された文字列の左端から指定された数の文字を返します。
SELECT LEFT('1234567890', 3); -- Result: '123'
指定された文字列式の文字数を返します。
SELECT LEN('12345'); -- Result: 5
部分文字列が表示される文字列の文字数を表す整数を返します。
SELECT LOCATE('sample','XXXXXsampleXXXXX'); -- Result: 6
大文字データを小文字に変換した文字式を返します。
SELECT LOWER('MIXED case'); -- Result: 'mixed case'
先頭の空白を除いた文字式を返します。
SELECT LTRIM(' trimmed'); -- Result: 'trimmed'
start_index とend_index の間の文字を文字列内のmask_character に置き換えます。
SELECT MASK('1234567890','*',); -- Result: '**********' SELECT MASK('1234567890','*', 4); -- Result: '1234******' SELECT MASK('1234567890','*', 4, 2); -- Result: '1234****90'
Unicode 標準の定義に従って、指定された整数コードのUnicode 文字を返します。
式内にあるバイト数を返します。
SELECT OCTET_LENGTH('text') FROM Account LIMIT 1 -- Result: 4
式内に最初に見つかったパターンの開始位置を返します。パターンが見つからなかった場合は0を返します。
SELECT PATINDEX('123%', '1234567890'); -- Result: 1 SELECT PATINDEX('%890', '1234567890'); -- Result: 8 SELECT PATINDEX('%456%', '1234567890'); -- Result: 4
指定した文字列式の開始位置を返します。
SELECT POSITION('456' IN '123456'); -- Result: 4 SELECT POSITION('x' IN '123456'); -- Result: 0
指定されたUnicode 文字列に必要な区切り記号を追加することで、有効なSQL Server の区切り付き識別子を返します。
SELECT QUOTENAME('table_name'); -- Result: '[table_name]' SELECT QUOTENAME('table_name', '"'); -- Result: '"table_name"' SELECT QUOTENAME('table_name', '['); -- Result: '[table_name]'
見つかった文字列をすべて別の文字列に置換します。
SELECT REPLACE('1234567890', '456', '|'); -- Result: '123|7890' SELECT REPLACE('123123123', '123', '.'); -- Result: '...' SELECT REPLACE('1234567890', 'a', 'b'); -- Result: '1234567890'
文字列値を指定された回数だけ繰り返します。
SELECT REPLACE('x', 5); -- Result: 'xxxxx'
文字列式を逆順序で返します。
SELECT REVERSE('1234567890'); -- Result: '0987654321'
文字列の右側から指定された数の文字を返します。
SELECT RIGHT('1234567890', 3); -- Result: '890'
末尾の空白を削除した後の文字式を返します。
SELECT RTRIM('trimmed '); -- Result: 'trimmed'
文字列の音声表現に基づいて、4文字のSoundex コードを返します。
SELECT SOUNDEX('smith'); -- Result: 'S530'
空白の繰り返しで構成される文字列を返します。
SELECT SPACE(5); -- Result: ' '
区切り文字の間の文字列のセクションを返します。
SELECT SPLIT('a/b/c/d', '/', 1); -- Result: 'a' SELECT SPLIT('a/b/c/d', '/', -2); -- Result: 'c'
character_expression がcharacter_prefix で始まる場合は1を、それ以外は0を返します。
SELECT STARTSWITH('0123456', '012'); -- Result: 1 SELECT STARTSWITH('0123456', '456'); -- Result: 0
数値データから変換された文字データを返します。例えば、STR(123.45, 6, 1) は123.5 を返します。
SELECT STR('123.456'); -- Result: '123' SELECT STR('123.456', 2); -- Result: '**' SELECT STR('123.456', 10, 2); -- Result: '123.46'
文字列を別の文字列内に挿入します。まず、最初の文字列の指定された開始位置から指定された長さの文字を削除し、次に、2番目の文字列を最初の文字列の指定された開始位置に挿入します。
SELECT STUFF('1234567890', 3, 2, 'xx'); -- Result: '12xx567890'
文字列のうち、指定されたインデックスから始まる指定された長さの部分を返します。
SELECT SUBSTRING('1234567890' FROM 3 FOR 2); -- Result: '34' SELECT SUBSTRING('1234567890' FROM 3); -- Result: '34567890'
インスタンスの値を同様の文字列表現に変換します。
SELECT TOSTRING(123); -- Result: '123' SELECT TOSTRING(123.456); -- Result: '123.456' SELECT TOSTRING(null); -- Result: ''
左および/または右の空白を除いた文字式を返します。
SELECT TRIM(' trimmed '); -- Result: 'trimmed' SELECT TRIM(LEADING FROM ' trimmed '); -- Result: 'trimmed ' SELECT TRIM('-' FROM '-----trimmed-----'); -- Result: 'trimmed' SELECT TRIM(BOTH '-' FROM '-----trimmed-----'); -- Result: 'trimmed' SELECT TRIM(TRAILING '-' FROM '-----trimmed-----'); -- Result: '-----trimmed'
インプット式の最初の文字のUnicode 標準で定義された整数の値を返します。
文字式の小文字データを大文字に変換して返します。
SELECT UPPER('MIXED case'); -- Result: 'MIXED CASE'
指定されたXPath を使ってXML ドキュメントを抽出して、XML をフラット化します。デフォルトでは、出力の区切りにはカンマが使用されますが、これは3番目のパラメータを指定することで変更できます。
SELECT XML_EXTRACT('<vowels><ch>a</ch><ch>e</ch><ch>i</ch><ch>o</ch><ch>u</ch></vowels>', '/vowels/ch'); -- Result: 'a,e,i,o,u' SELECT XML_EXTRACT('<vowels><ch>a</ch><ch>e</ch><ch>i</ch><ch>o</ch><ch>u</ch></vowels>', '/vowels/ch', ';'); -- Result: 'a;e;i;o;u'
現在のdate 値を返します。
SELECT CURRENT_DATE(); -- Result: 2018-02-01
現在のデータベースシステムのタイムスタンプをdatetime 値で返します。この値はGETDATE およびSYSDATETIME と等しく、常にローカルタイムゾーンになります。
SELECT CURRENT_TIMESTAMP(); -- Result: 2018-02-01 03:04:05
date の指定されたdatepart に、指定されたnumber(符号付き整数)を加算したdatetime 値を返します。
SELECT DATEADD('d', 5, '2018-02-01'); -- Result: 2018-02-06 SELECT DATEADD('hh', 5, '2018-02-01 00:00:00'); -- Result: 2018-02-01 05:00:00
指定されたstartdate とenddate の差(符号付き整数)を返します。
SELECT DATEDIFF('d', '2018-02-01', '2018-02-10'); -- Result: 9 SELECT DATEDIFF('hh', '2018-02-01 00:00:00', '2018-02-01 12:00:00'); -- Result: 12
指定された年、月、および日のdatetime 値を返します。
SELECT DATEFROMPARTS(2018, 2, 1); -- Result: 2018-02-01
指定されたdate の指定されたdatepart を表す文字列を返します。
SELECT DATENAME('yy', '2018-02-01'); -- Result: '2018' SELECT DATENAME('dw', '2018-02-01'); -- Result: 'Thursday'
指定されたdate の指定されたdatepart を表す文字列を返します。
SELECT DATEPART('yy', '2018-02-01'); -- Result: 2018 SELECT DATEPART('dw', '2018-02-01'); -- Result: 5
指定されたdatepart のdatetime 値を返します。
SELECT DATETIME2FROMPARTS(2018, 2, 1, 1, 2, 3, 456, 3); -- Result: 2018-02-01 01:02:03.456
指定されたdatepart のdatetime 値を返します。
SELECT DATETIMEFROMPARTS(2018, 2, 1, 1, 2, 3, 456); -- Result: 2018-02-01 01:02:03.456
指定されたdatepart の精度に日付を切り捨てます。Oracle TRUNC 関数をモデルにしています。
SELECT DATE_TRUNC('05-04-2005', 'YY'); -- Result: '1/1/2005' SELECT DATE_TRUNC('05-04-2005', 'MM'); -- Result: '5/1/2005'
指定されたdatepart の精度に日付を切り捨てます。PostgreSQL date_trunc 関数をモデルにしています。
SELECT DATE_TRUNC2('year', '2020-02-04'); -- Result: '2020-01-01' SELECT DATE_TRUNC2('week', '2020-02-04', 'monday'); -- Result: '2020-02-02', which is the previous Monday
指定されたdate の日コンポーネントを指定する整数を返します。
SELECT DAY('2018-02-01'); -- Result: 1
SELECT DAYOFMONTH('04/15/2000'); -- Result: 15
SELECT DAYOFWEEK('04/15/2000'); -- Result: 7
SELECT DAYOFYEAR('04/15/2000'); -- Result: 106
指定されたdate を含む月、またはオプションでその月からオフセットされた月の最終日を返します。
SELECT EOMONTH('2018-02-01'); -- Result: 2018-02-28 SELECT LAST_DAY('2018-02-01'); -- Result: 2018-02-28 SELECT EOMONTH('2018-02-01', 2); -- Result: 2018-04-30
SELECT FDWEEK('02-08-2018'); -- Result: 2/4/2018
SELECT FDMONTH('02-08-2018'); -- Result: 2/1/2018
SELECT FDQUARTER('05-08-2018'); -- Result: 4/1/2018
関連ファイルの変更日に関連付けられたタイムスタンプを返します。
SELECT FILEMODIFIEDTIME('C:/Documents/myfile.txt'); -- Result: 6/25/2019 10:06:58 AM
1582-10-15以降の日数から派生した日付を返します(グレゴリオ暦に基づく)。これはMYSQL FROM_DAYS 関数と同等です。
SELECT FROM_DAYS(736000); -- Result: 2/6/2015
現在のデータベースシステムのタイムスタンプをdatetime 値で返します。この値はCURRENT_TIMESTAMP およびSYSDATETIME と等しく、常にローカルタイムゾーンになります。
SELECT GETDATE(); -- Result: 2018-02-01 03:04:05
UTC datetime 値としてフォーマットされた現在のデータベースシステムのタイムスタンプを返します。SYSUTCDATETIME と同じです。
SELECT GETUTCDATE(); -- For example, if the local timezone is Eastern European Time (GMT+2) -- Result: 2018-02-01 05:04:05
指定されたdatetime から時間コンポーネントを返します。
SELECT HOUR('02-02-2020 11:30:00'); -- Result: 11
この値が有効なdate、time、またはdatetime 値である場合は1を返します。それ以外の場合は0を返します。
SELECT ISDATE('2018-02-01', 'yyyy-MM-dd'); -- Result: 1 SELECT ISDATE('Not a date'); -- Result: 0
現在の日付のちょうど一週間前のタイムスタンプを返します。
SELECT LAST_WEEK(); //Assume the date is 3/17/2020 -- Result: 3/10/2020
現在の日付のちょうど一ヶ月前のタイムスタンプを返します。
SELECT LAST_MONTH(); //Assume the date is 3/17/2020 -- Result: 2/17/2020
現在の日付のちょうど一年前のタイムスタンプを返します。
SELECT LAST_YEAR(); //Assume the date is 3/17/2020 -- Result: 3/10/2019
指定された週の最終日を返します。
SELECT LDWEEK('02-02-2020'); -- Result: 2/8/2020
指定された月の最終日を返します。
SELECT LDMONTH('02-02-2020'); -- Result: 2/29/2020
指定された四半期の最終日を返します。
SELECT LDQUARTER('02-02-2020'); -- Result: 3/31/2020
年と日数から日付値を返します。
SELECT MAKEDATE(2020, 1); -- Result: 2020-01-01
指定されたdatetime から分コンポーネントを返します。
SELECT MINUTE('02-02-2020 11:15:00'); -- Result: 15
指定されたdatetime から月コンポーネントを返します。
SELECT MONTH('02-02-2020'); -- Result: 2
指定されたdatetime に関連付けられた四半期を返します。
SELECT QUARTER('02-02-2020'); -- Result: 1
指定されたdatetime から秒コンポーネントを返します。
SELECT SECOND('02-02-2020 11:15:23'); -- Result: 23
指定された日時のdatetime 値を返します。
SELECT SMALLDATETIMEFROMPARTS(2018, 2, 1, 1, 2); -- Result: 2018-02-01 01:02:00
指定された文字列値をパースし、対応する日時を返します。
SELECT STRTODATE('03*04*2020','dd*MM*yyyy'); -- Result: 4/3/2020
現在のタイムスタンプをデータベースシステムのdatetime 値として返します。この値はGETDATE およびCURRENT_TIMESTAMP と等しく、常にローカルタイムゾーンになります。
SELECT SYSDATETIME(); -- Result: 2018-02-01 03:04:05
現在のシステム日時をUTC datetime 値として返します。GETUTCDATE と同じです。
SELECT SYSUTCDATETIME(); -- For example, if the local timezone is Eastern European Time (GMT+2) -- Result: 2018-02-01 05:04:05
指定されたhour、minute、およびsecond のtime 値を指定した有効桁数で返します。
SELECT TIMEFROMPARTS(1, 2, 3, 456, 3); -- Result: 01:02:03.456
0000-00-01以降の日数を返します。1582-10-15以降の日付に対してのみ値を返します(グレゴリオ暦に基づく)。これはMYSQL TO_DAYS 関数と同等です。
SELECT TO_DAYS('02-06-2015'); -- Result: 736000
指定されたdatetime に関連付けられた(その年の)週を返します。
SELECT WEEK('02-17-2020 11:15:23'); -- Result: 8
指定されたdate の年を表す整数を返します。
SELECT YEAR('2018-02-01'); -- Result: 2018
指定された数値の絶対値(正の値)を返します。
SELECT ABS(15); -- Result: 15 SELECT ABS(-15); -- Result: 15
指定された浮動小数点式がコサインの値となる角度をラジアン単位で返します。これは、アークコサインとも呼ばれます。
SELECT ACOS(0.5); -- Result: 1.0471975511966
指定された浮動小数点式がサインの値となる角度をラジアン単位で返します。これは、アークサインとも呼ばれます。
SELECT ASIN(0.5); -- Result: 0.523598775598299
指定された浮動小数点式がタンジェントの値となる角度をラジアン単位で返します。これは、アークタンジェントとも呼ばれます。
SELECT ATAN(10); -- Result: 1.47112767430373
正のx 軸と原点から点(y, x) までの線との間の角度をラジアン単位で返します。x とy は、指定された2つの浮動小数点式です。
SELECT ATN2(1, 1); -- Result: 0.785398163397448
指定された数値式以上で最小の整数を返します。
SELECT CEILING(1.3); -- Result: 2 SELECT CEILING(1.5); -- Result: 2 SELECT CEILING(1.7); -- Result: 2
指定された式で示されるラジアン単位の角度の三角関数コサインを返します。
SELECT COS(1); -- Result: 0.54030230586814
指定された浮動小数点式で示されるラジアン単位の角度の三角関数コタンジェントを返します。
SELECT COT(1); -- Result: 0.642092615934331
ラジアン単位で指定された角度に相当する度単位の角度を返します。
SELECT DEGREES(3.1415926); -- Result: 179.999996929531
指定された浮動小数点値の指数値を返します。例えば、EXP(LOG(20)) は20です。
SELECT EXP(2); -- Result: 7.38905609893065
式を評価します。
SELECT EXPR('1 + 2 * 3'); -- Result: 7 SELECT EXPR('1 + 2 * 3 == 7'); -- Result: true
指定された数値式以下で最大の整数を返します。
SELECT FLOOR(1.3); -- Result: 1 SELECT FLOOR(1.5); -- Result: 1 SELECT FLOOR(1.7); -- Result: 1
指定された整数の最大値を返します。
SELECT GREATEST(3,5,8,10,1) -- Result: 10
入力値に相当する16進数を返します。
SELECT HEX(866849198); -- Result: 33AB11AE SELECT HEX('Sample Text'); -- Result: 53616D706C652054657874
指定された整数の最小値を返します。
SELECT LEAST(3,5,8,10,1) -- Result: 1
指定された浮動小数点式の自然対数を返します。
SELECT LOG(7.3890560); -- Result: 1.99999998661119
指定された浮動小数点式の10を底とする対数を返します。
SELECT LOG10(10000); -- Result: 4
被除数を除数で除算したときの余剰に関連付けられた整数値を返します。
SELECT MOD(10,3); -- Result: 1
実数入力のopposite を返します。
SELECT NEGATE(10); -- Result: -10 SELECT NEGATE(-12.4) --Result: 12.4
PI の定数値を返します。
SELECT PI() -- Result: 3.14159265358979
指定された式の指定されたべき乗値を返します。
SELECT POWER(2, 10); -- Result: 1024 SELECT POWER(2, -2); -- Result: 0.25
数値式が度単位で入力されたときのラジアン値を返します。
SELECT RADIANS(180); -- Result: 3.14159265358979
0と1の間の(0と1は除く)の疑似乱数(浮動小数点値)を返します。
SELECT RAND(); -- This result may be different, since the seed is randomized -- Result: 0.873159630165044 SELECT RAND(1); -- This result will always be the same, since the seed is constant -- Result: 0.248668584157093
指定された長さまたは有効桁数に丸められた数値を返します。
SELECT ROUND(1.3, 0); -- Result: 1 SELECT ROUND(1.55, 1); -- Result: 1.6 SELECT ROUND(1.7, 0, 0); -- Result: 2 SELECT ROUND(1.7, 0, 1); -- Result: 1 SELECT ROUND (1.24); -- Result: 1.0
指定された式の符号を、正(+1)、ゼロ(0)、または負(-1)で返します。
SELECT SIGN(0); -- Result: 0 SELECT SIGN(10); -- Result: 1 SELECT SIGN(-10); -- Result: -1
指定された角度の三角関数のサイン値をラジアン単位で返します。
SELECT SIN(1); -- Result: 0.841470984807897
指定された浮動小数点値の平方根を返します。
SELECT SQRT(100); -- Result: 10
指定された浮動小数点値の2乗を返します。
SELECT SQUARE(10); -- Result: 100 SELECT SQUARE(-10); -- Result: 100
入力式のタンジェントを返します。
SELECT TAN(1); -- Result: 1.5574077246549
指定された小数精度に切り捨てられた、指定された10進数を返します。
SELECT TRUNC(10.3423,2); -- Result: 10.34
新しいレコードを作成するには、INSERT ステートメントを使用します。
INSERT ステートメントは、挿入するカラムと新しいカラム値を指定します。複数のカラム値は、次の例に示すように、VALUES 句のカンマ区切りリストで指定できます。
INSERT INTO <table_name>
( <column_reference> [ , ... ] )
VALUES
( { <expression> | NULL } [ , ... ] )
<expression> ::=
| @ <parameter>
| ?
| <literal>
次にクエリの例を示します。
INSERT INTO [CData].[Default].Customers (CompanyName) VALUES ('RSSBus Inc.')
ストアドプロシージャを実行するには、EXECUTE またはEXEC ステートメントを使用できます。
EXEC およびEXECUTE は、名前で参照されたストアドプロシージャのインプットを値またはパラメータ名に割当てます。
ストアドプロシージャをSQL ステートメントとして実行するには、次の構文を使用します。
{ EXECUTE | EXEC } <stored_proc_name>
{
[ @ ] <input_name> = <expression>
} [ , ... ]
<expression> ::=
| @ <parameter>
| ?
| <literal>
名前によるストアドプロシージャのインプットの参照:
EXECUTE my_proc @second = 2, @first = 1, @third = 3;
パラメータ化されたストアドプロシージャ構文の実行:
EXECUTE my_proc second = @p1, first = @p2, third = @p3;
PIVOT and UNPIVOT can be used to change a table-valued expression into another table.
"SELECT 'AverageCost' AS Cost_Sorted_By_Production_Days, [0], [1], [2], [3], [4]
FROM
(
SELECT DaysToManufacture, StandardCost
FROM Production.Product
) AS SourceTable
PIVOT
(
AVG(StandardCost)
FOR DaysToManufacture IN ([0], [1], [2], [3], [4])
) AS PivotTable;"
"SELECT VendorID, Employee, Orders
FROM
(SELECT VendorID, Emp1, Emp2, Emp3, Emp4, Emp5
FROM pvt) p
UNPIVOT
(Orders FOR Employee IN
(Emp1, Emp2, Emp3, Emp4, Emp5)
)AS unpvt;"
For further information on PIVOT and UNPIVOT, see FROM clause plus JOIN, APPLY, PIVOT (Transact-SQL)
Apache Impala への1回の要求で複数の削除処理を実行するには、まずINSERT INTO 構文を使用して、削除するデータのインメモリ一時テーブルを作成します。削除するデータがすべて一時テーブルに入力されたら、DELETE FROM 構文を使用してApache Impala のライブテーブルからデータを削除します。この機能は、JDBC で利用可能な標準バッチ処理API 経由でも利用できます。
入力先の一時テーブルは動的なテーブルで、実行時に最初のデータをテーブルに入力するときに作成されます。一時テーブルは、その名前に「#」を付加して示されます。一時テーブルを使用してデータを削除する場合、その一時テーブルには「[TableName]#TEMP」という形式で名前を付ける必要があります。「TableName」は、データを挿入するテーブルの名前です。
次に例を示します。
INSERT INTO [CData].[Default].Customers#TEMP (_id) VALUES ('AX1000001'); INSERT INTO [CData].[Default].Customers#TEMP (_id) VALUES ('AX1000002'); INSERT INTO [CData].[Default].Customers#TEMP (_id) VALUES ('AX1000003');
このコードでは、1つのデータカラムと3つのデータ行を含む「[CData].[Default].Customers#TEMP」という名前の一時テーブルが作成されます。一時テーブルでは型を指定できないため、すべての値が文字列としてメモリに保存されます。これらの値の型は、[CData].[Default].Customers テーブルに送信された後で正しい型に変換されます。
一時テーブルにデータが入力されたら、Apache Impala の実際のテーブルに対して挿入を実行します。そのためには、実際のテーブルからの削除(DELETE)を実行し、一時テーブルから入力データを選択します。次に例を示します。
DELETE FROM [CData].[Default].Customers WHERE EXISTS SELECT _id FROM [CData].[Default].Customers#TEMP
この例では、[CData].[Default].Customers#TEMP テーブルのすべての内容が[CData].[Default].Customers テーブルに渡されます。この結果、各要求で複数の削除を送信できるため、Apache Impala に送信される要求の数が少なくて済み、多くのレコードを削除する場合のパフォーマンスが向上します。
クエリの結果は、一時テーブルLastResultInfo#TEMP に保存されます。次に一時テーブルが渡されてデータが変更されると、このテーブルはクリアされて、データが再挿入されます。LastResultInfo#TEMP テーブルはスキーマが事前定義されていないことに注意してください。データを読み取る前に、実行時にそのメタデータを確認する必要があります。
一時テーブルは、接続が開いている間だけ存続します。Apache Impala への接続が閉じられると、LastResultInfo#TEMP テーブルを含むすべての一時テーブルがクリアされます。
Cloud はApache Impala インスタンスをリレーショナルデータベースとしてモデル化します。Cloud はImpala Server Thrift API を使用して、SQL を介したApache Impala データへの双方向アクセスを実現します。Impala Server 2.2.0 以降がサポートされています。
このセクションで説明されているシステムテーブルをクエリして、スキーマ情報、データソース機能に関する情報、およびバッチ操作の統計にアクセスできます。
以下のテーブルは、Apache Impala のデータベースメタデータを返します。
以下のテーブルは、データソースへの接続方法およびクエリ方法についての情報を返します。
次のテーブルは、データ変更クエリ(バッチ処理を含む)のクエリ統計を返します。
利用可能なデータベースをリストします。
次のクエリは、接続文字列で決定されるすべてのデータベースを取得します。
SELECT * FROM sys_catalogs
Name | Type | Description |
CatalogName | String | データベース名。 |
利用可能なスキーマをリストします。
次のクエリは、すべての利用可能なスキーマを取得します。
SELECT * FROM sys_schemas
Name | Type | Description |
CatalogName | String | データベース名。 |
SchemaName | String | スキーマ名。 |
利用可能なテーブルをリストします。
次のクエリは、利用可能なテーブルおよびビューを取得します。
SELECT * FROM sys_tables
Name | Type | Description |
CatalogName | String | テーブルまたはビューを含むデータベース。 |
SchemaName | String | テーブルまたはビューを含むスキーマ。 |
TableName | String | テーブル名またはビュー名。 |
TableType | String | テーブルの種類(テーブルまたはビュー)。 |
Description | String | テーブルまたはビューの説明。 |
IsUpdateable | Boolean | テーブルが更新可能かどうか。 |
利用可能なテーブルのカラムについて説明します。
次のクエリは、[CData].[Default].Customers テーブルのカラムとデータ型を返します。
SELECT ColumnName, DataTypeName FROM sys_tablecolumns WHERE TableName='Customers' AND CatalogName='CData' AND SchemaName='Default'
Name | Type | Description |
CatalogName | String | テーブルまたはビューを含むデータベースの名前。 |
SchemaName | String | テーブルまたはビューを含むスキーマ。 |
TableName | String | カラムを含むテーブルまたはビューの名前。 |
ColumnName | String | カラム名。 |
DataTypeName | String | データ型の名前。 |
DataType | Int32 | データ型を示す整数値。この値は、実行時に環境に基づいて決定されます。 |
Length | Int32 | カラムのストレージサイズ。 |
DisplaySize | Int32 | 指定されたカラムの通常の最大幅(文字数)。 |
NumericPrecision | Int32 | 数値データの最大桁数。文字データおよび日時データの場合は、カラムの長さ(文字数)。 |
NumericScale | Int32 | カラムのスケール(小数点以下の桁数)。 |
IsNullable | Boolean | カラムがNull を含められるかどうか。 |
Description | String | カラムの簡単な説明。 |
Ordinal | Int32 | カラムのシーケンスナンバー。 |
IsAutoIncrement | String | カラムに固定増分値が割り当てられるかどうか。 |
IsGeneratedColumn | String | 生成されたカラムであるかどうか。 |
IsHidden | Boolean | カラムが非表示かどうか。 |
IsArray | Boolean | カラムが配列かどうか。 |
利用可能なストアドプロシージャをリストします。
次のクエリは、利用可能なストアドプロシージャを取得します。
SELECT * FROM sys_procedures
Name | Type | Description |
CatalogName | String | ストアドプロシージャを含むデータベース。 |
SchemaName | String | ストアドプロシージャを含むスキーマ。 |
ProcedureName | String | ストアドプロシージャの名前。 |
Description | String | ストアドプロシージャの説明。 |
ProcedureType | String | PROCEDURE やFUNCTION などのプロシージャのタイプ。 |
ストアドプロシージャパラメータについて説明します。
次のクエリは、SearchSuppliers ストアドプロシージャのすべての入力パラメータについての情報を返します。
SELECT * FROM sys_procedureparameters WHERE ProcedureName='SearchSuppliers' AND Direction=1 OR Direction=2
Name | Type | Description |
CatalogName | String | ストアドプロシージャを含むデータベースの名前。 |
SchemaName | String | ストアドプロシージャを含むスキーマの名前。 |
ProcedureName | String | パラメータを含むストアドプロシージャの名前。 |
ColumnName | String | ストアドプロシージャパラメータの名前。 |
Direction | Int32 | パラメータのタイプに対応する整数値:input (1)。input/output (2)、またはoutput(4)。input/output タイプパラメータは、入力パラメータと出力パラメータの両方になれます。 |
DataTypeName | String | データ型の名前。 |
DataType | Int32 | データ型を示す整数値。この値は、実行時に環境に基づいて決定されます。 |
Length | Int32 | 文字データの場合は、許可される文字数。数値データの場合は、許可される桁数。 |
NumericPrecision | Int32 | 数値データの場合は最大精度。文字データおよび日時データの場合は、カラムの長さ(文字数)。 |
NumericScale | Int32 | 数値データの小数点以下の桁数。 |
IsNullable | Boolean | パラメータがNull を含められるかどうか。 |
IsRequired | Boolean | プロシージャの実行にパラメータが必要かどうか。 |
IsArray | Boolean | パラメータが配列かどうか。 |
Description | String | パラメータの説明。 |
Ordinal | Int32 | パラメータのインデックス。 |
主キーおよび外部キーについて説明します。
次のクエリは、[CData].[Default].Customers テーブルの主キーを取得します。
SELECT * FROM sys_keycolumns WHERE IsKey='True' AND TableName='Customers' AND CatalogName='CData' AND SchemaName='Default'
Name | Type | Description |
CatalogName | String | キーを含むデータベースの名前。 |
SchemaName | String | キーを含むスキーマの名前。 |
TableName | String | キーを含むテーブルの名前。 |
ColumnName | String | キーカラムの名前 |
IsKey | Boolean | カラムがTableName フィールドで参照されるテーブル内の主キーかどうか。 |
IsForeignKey | Boolean | カラムがTableName フィールドで参照される外部キーかどうか。 |
PrimaryKeyName | String | 主キーの名前。 |
ForeignKeyName | String | 外部キーの名前。 |
ReferencedCatalogName | String | 主キーを含むデータベース。 |
ReferencedSchemaName | String | 主キーを含むスキーマ。 |
ReferencedTableName | String | 主キーを含むテーブル。 |
ReferencedColumnName | String | 主キーのカラム名。 |
外部キーについて説明します。
次のクエリは、他のテーブルを参照するすべての外部キーを取得します。
SELECT * FROM sys_foreignkeys WHERE ForeignKeyType = 'FOREIGNKEY_TYPE_IMPORT'
名前 | タイプ | 説明 |
CatalogName | String | キーを含むデータベースの名前。 |
SchemaName | String | キーを含むスキーマの名前。 |
TableName | String | キーを含むテーブルの名前。 |
ColumnName | String | キーカラムの名前 |
PrimaryKeyName | String | 主キーの名前。 |
ForeignKeyName | String | 外部キーの名前。 |
ReferencedCatalogName | String | 主キーを含むデータベース。 |
ReferencedSchemaName | String | 主キーを含むスキーマ。 |
ReferencedTableName | String | 主キーを含むテーブル。 |
ReferencedColumnName | String | 主キーのカラム名。 |
ForeignKeyType | String | 外部キーがインポート(他のテーブルを指す)キーかエクスポート(他のテーブルから参照される)キーかを指定します。 |
利用可能なインデックスについて説明します。インデックスをフィルタリングすることで、より高速なクエリ応答時間でセレクティブクエリを記述できます。
次のクエリは、主キーでないすべてのインデックスを取得します。
SELECT * FROM sys_indexes WHERE IsPrimary='false'
Name | Type | Description |
CatalogName | String | インデックスを含むデータベースの名前。 |
SchemaName | String | インデックスを含むスキーマの名前。 |
TableName | String | インデックスを含むテーブルの名前。 |
IndexName | String | インデックス名。 |
ColumnName | String | インデックスに関連付けられたカラムの名前。 |
IsUnique | Boolean | インデックスが固有の場合はTrue。そうでない場合はFalse。 |
IsPrimary | Boolean | インデックスが主キーの場合はTrue。そうでない場合はFalse。 |
Type | Int16 | インデックスタイプに対応する整数値:statistic (0)、clustered (1)、hashed (2)、またはother (3)。 |
SortOrder | String | 並べ替え順序:A が昇順、D が降順。 |
OrdinalPosition | Int16 | インデックスのカラムのシーケンスナンバー。 |
利用可能な接続プロパティと、接続文字列に設定されている接続プロパティに関する情報を返します。
このテーブルをクエリする際は、config 接続文字列を使用する必要があります。
jdbc:cdata:apacheimpala:config:
この接続文字列を使用すると、有効な接続がなくてもこのテーブルをクエリできます。
次のクエリは、接続文字列に設定されている、あるいはデフォルト値で設定されているすべての接続プロパティを取得します。
SELECT * FROM sys_connection_props WHERE Value <> ''
Name | Type | Description |
Name | String | 接続プロパティ名。 |
ShortDescription | String | 簡単な説明。 |
Type | String | 接続プロパティのデータ型。 |
Default | String | 明示的に設定されていない場合のデフォルト値。 |
Values | String | 可能な値のカンマ区切りリスト。別な値が指定されていると、検証エラーがスローされます。 |
Value | String | 設定した値またはあらかじめ設定されたデフォルト。 |
Required | Boolean | プロパティが接続に必要かどうか。 |
Category | String | 接続プロパティのカテゴリ。 |
IsSessionProperty | String | プロパティが、現在の接続に関する情報を保存するために使用されるセッションプロパティかどうか。 |
Sensitivity | String | プロパティの機密度。これは、プロパティがロギングおよび認証フォームで難読化されているかどうかを通知します。 |
PropertyName | String | キャメルケースの短縮形の接続プロパティ名。 |
Ordinal | Int32 | パラメータのインデックス。 |
CatOrdinal | Int32 | パラメータカテゴリのインデックス。 |
Hierarchy | String | このプロパティと一緒に設定する必要がある、関連のある依存プロパティを表示します。 |
Visible | Boolean | プロパティが接続UI に表示されるかどうかを通知します。 |
ETC | String | プロパティに関するその他のさまざまな情報。 |
Cloud がデータソースにオフロードできるSELECT クエリ処理について説明します。
SQL 構文の詳細については、SQL 準拠 を参照してください。
以下はSQL 機能のサンプルデータセットです。 次の結果セットは、Cloud がデータソースにオフロードできる、またはクライアントサイドで処理できるSELECT 機能を示します。データソースは追加のSQL 構文をサポートすることがあります。 SELECT 機能のいくつかの側面がサポートされている場合には、カンマ区切りのリストで返されます。サポートされていない場合、カラムにはNO が入ります。
名前 | 説明 | 有効な値 |
AGGREGATE_FUNCTIONS | サポートされている集計関数。 | AVG, COUNT, MAX, MIN, SUM, DISTINCT |
COUNT | COUNT 関数がサポートされているかどうか。 | YES, NO |
IDENTIFIER_QUOTE_OPEN_CHAR | 識別子をエスケープするための開始文字。 | [ |
IDENTIFIER_QUOTE_CLOSE_CHAR | 識別子をエスケープするための終了文字。 | ] |
SUPPORTED_OPERATORS | サポートされているSQL 演算子。 | =, >, <, >=, <=, <>, !=, LIKE, NOT LIKE, IN, NOT IN, IS NULL, IS NOT NULL, AND, OR |
GROUP_BY | GROUP BY がサポートされているかどうか。サポートされている場合、どのレベルでサポートされているか。 | NO, NO_RELATION, EQUALS_SELECT, SQL_GB_COLLATE |
OJ_CAPABILITIES | サポートされている外部結合の種類。 | NO, LEFT, RIGHT, FULL, INNER, NOT_ORDERED, ALL_COMPARISON_OPS |
OUTER_JOINS | 外部結合がサポートされているかどうか。 | YES, NO |
SUBQUERIES | サブクエリがサポートされているかどうか。サポートされていれば、どのレベルでサポートされているか。 | NO, COMPARISON, EXISTS, IN, CORRELATED_SUBQUERIES, QUANTIFIED |
STRING_FUNCTIONS | サポートされている文字列関数。 | LENGTH, CHAR, LOCATE, REPLACE, SUBSTRING, RTRIM, LTRIM, RIGHT, LEFT, UCASE, SPACE, SOUNDEX, LCASE, CONCAT, ASCII, REPEAT, OCTET, BIT, POSITION, INSERT, TRIM, UPPER, REGEXP, LOWER, DIFFERENCE, CHARACTER, SUBSTR, STR, REVERSE, PLAN, UUIDTOSTR, TRANSLATE, TRAILING, TO, STUFF, STRTOUUID, STRING, SPLIT, SORTKEY, SIMILAR, REPLICATE, PATINDEX, LPAD, LEN, LEADING, KEY, INSTR, INSERTSTR, HTML, GRAPHICAL, CONVERT, COLLATION, CHARINDEX, BYTE |
NUMERIC_FUNCTIONS | サポートされている数値関数。 | ABS, ACOS, ASIN, ATAN, ATAN2, CEILING, COS, COT, EXP, FLOOR, LOG, MOD, SIGN, SIN, SQRT, TAN, PI, RAND, DEGREES, LOG10, POWER, RADIANS, ROUND, TRUNCATE |
TIMEDATE_FUNCTIONS | サポートされている日付および時刻関数。 | NOW, CURDATE, DAYOFMONTH, DAYOFWEEK, DAYOFYEAR, MONTH, QUARTER, WEEK, YEAR, CURTIME, HOUR, MINUTE, SECOND, TIMESTAMPADD, TIMESTAMPDIFF, DAYNAME, MONTHNAME, CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP, EXTRACT |
REPLICATION_SKIP_TABLES | レプリケーション中にスキップされたテーブルを示します。 | |
REPLICATION_TIMECHECK_COLUMNS | レプリケーション中に更新判断のカラムとして使用するかどうかを、(指定された順に)チェックするカラムのリストを含む文字列の配列。 | |
IDENTIFIER_PATTERN | 識別子としてどの文字列が有効かを示す文字列値。 | |
SUPPORT_TRANSACTION | プロバイダーが、コミットやロールバックなどのトランザクションをサポートしているかどうかを示します。 | YES, NO |
DIALECT | 使用するSQL ダイアレクトを示します。 | |
KEY_PROPERTIES | Uniform データベースを特定するプロパティを示します。 | |
SUPPORTS_MULTIPLE_SCHEMAS | プロバイダー用に複数のスキームが存在するかどうかを示します。 | YES, NO |
SUPPORTS_MULTIPLE_CATALOGS | プロバイダー用に複数のカタログが存在するかどうかを示します。 | YES, NO |
DATASYNCVERSION | このドライバーにアクセスするために必要な、CData Sync のバージョン。 | Standard, Starter, Professional, Enterprise |
DATASYNCCATEGORY | このドライバーのCData Sync カテゴリ。 | Source, Destination, Cloud Destination |
SUPPORTSENHANCEDSQL | API で提供されている以上の、追加SQL 機能がサポートされているかどうか。 | TRUE, FALSE |
SUPPORTS_BATCH_OPERATIONS | バッチ操作がサポートされているかどうか。 | YES, NO |
SQL_CAP | このドライバーでサポートされているすべてのSQL 機能。 | SELECT, INSERT, DELETE, UPDATE, TRANSACTIONS, ORDERBY, OAUTH, ASSIGNEDID, LIMIT, LIKE, BULKINSERT, COUNT, BULKDELETE, BULKUPDATE, GROUPBY, HAVING, AGGS, OFFSET, REPLICATE, COUNTDISTINCT, JOINS, DROP, CREATE, DISTINCT, INNERJOINS, SUBQUERIES, ALTER, MULTIPLESCHEMAS, GROUPBYNORELATION, OUTERJOINS, UNIONALL, UNION, UPSERT, GETDELETED, CROSSJOINS, GROUPBYCOLLATE, MULTIPLECATS, FULLOUTERJOIN, MERGE, JSONEXTRACT, BULKUPSERT, SUM, SUBQUERIESFULL, MIN, MAX, JOINSFULL, XMLEXTRACT, AVG, MULTISTATEMENTS, FOREIGNKEYS, CASE, LEFTJOINS, COMMAJOINS, WITH, LITERALS, RENAME, NESTEDTABLES, EXECUTE, BATCH, BASIC, INDEX |
PREFERRED_CACHE_OPTIONS | 使用したいcacheOptions を指定する文字列値。 | |
ENABLE_EF_ADVANCED_QUERY | ドライバーがEntity Framework の高度なクエリをサポートしているかどうかを示します。サポートしていなければ、クエリはクライアントサイドで処理されます。 | YES, NO |
PSEUDO_COLUMNS | 利用可能な疑似カラムを示す文字列の配列。 | |
MERGE_ALWAYS | 値がtrue であれば、CData Sync 内でMerge Model が強制的に実行されます。 | TRUE, FALSE |
REPLICATION_MIN_DATE_QUERY | レプリケート開始日時を返すSELECT クエリ。 | |
REPLICATION_MIN_FUNCTION | サーバーサイドでmin を実行するために使用する式名を、プロバイダーが指定できるようになります。 | |
REPLICATION_START_DATE | レプリケート開始日を、プロバイダーが指定できるようになります。 | |
REPLICATION_MAX_DATE_QUERY | レプリケート終了日時を返すSELECT クエリ。 | |
REPLICATION_MAX_FUNCTION | サーバーサイドでmax を実行するために使用する式名を、プロバイダーが指定できるようになります。 | |
IGNORE_INTERVALS_ON_INITIAL_REPLICATE | 初回のレプリケートで、レプリケートをチャンクに分割しないテーブルのリスト。 | |
CHECKCACHE_USE_PARENTID | CheckCache 構文を親キーカラムに対して実行するかどうかを示します。 | TRUE, FALSE |
CREATE_SCHEMA_PROCEDURES | スキーマファイルの生成に使用できる、ストアドプロシージャを示します。 |
次のクエリは、WHERE 句で使用できる演算子を取得します。
SELECT * FROM sys_sqlinfo WHERE Name='SUPPORTED_OPERATORS'
WHERE 句では、個々のテーブルの制限や要件が異なる場合がありますので注意してください。詳しくは、データモデル セクションを参照してください。
Name | Type | Description |
NAME | String | SQL 構文のコンポーネント、またはサーバー上で処理できる機能。 |
VALUE | String | サポートされるSQL またはSQL 構文の詳細。 |
試行された変更に関する情報を返します。
次のクエリは、バッチ処理で変更された行のId を取得します。
SELECT * FROM sys_identity
Name | Type | Description |
Id | String | データ変更処理から返された、データベース生成Id。 |
Batch | String | バッチの識別子。1 は単一処理。 |
Operation | String | バッチ内の処理の結果:INSERTED、UPDATED、またはDELETED。 |
Message | String | SUCCESS、またはバッチ内の更新が失敗した場合のエラーメッセージ。 |
プロパティ | 説明 |
AuthScheme | The authentication scheme used. Accepted entries are NoSasl, LDAP and Kerberos. |
Server | The name of the server running SQL Server. |
Port | The port for the connection to the Impala Server instance. |
User | The username used to authenticate with Impala. |
Password | The password used to authenticate with Impala. |
ProtocolVersion | The Thrift protocol version to use when connecting to the Impala server. |
Database | The name of the Impala database to use by default. |
TransportMode | The transport mode to use to communicate with the Impala server. Accepted entries are BINARY and HTTP. |
プロパティ | 説明 |
KerberosKDC | ユーザーの認証で使用されるKerberos キー配布センター(KDC)サービス。 |
KerberosRealm | ユーザーの認証で使用されるKerberos 領域。 |
KerberosSPN | Kerberos ドメインコントローラーのサービスプリンシパル名(SPN)。 |
KerberosKeytabFile | Kerberos プリンシパルと暗号化されたキーのペアを含むKeytab ファイル。 |
KerberosServiceRealm | サービスのKerberos レルム。 |
KerberosServiceKDC | サービスのKerberos KDC。 |
KerberosTicketCache | MIT Kerberos 資格情報キャッシュファイルへのフルパス。 |
プロパティ | 説明 |
SSLClientCert | SSL クライアント認証(2-way SSL)のためのTLS/SSL クライアント証明書ストア。 |
SSLClientCertType | TLS/SSL クライアント証明書を格納するキーストアの種類。 |
SSLClientCertPassword | TLS/SSL クライアント証明書のパスワード。 |
SSLClientCertSubject | TLS/SSL クライアント証明書の件名。 |
SSLServerCert | TLS/SSL を使用して接続するときに、サーバーが受け入れ可能な証明書。 |
プロパティ | 説明 |
FirewallType | プロキシベースのファイアウォールで使われるプロトコル。 |
FirewallServer | プロキシベースのファイアウォールの名前もしくはIP アドレス。 |
FirewallPort | プロキシベースのファイアウォールのTCP ポート。 |
FirewallUser | プロキシベースのファイアウォールに認証するために使うユーザー名。 |
FirewallPassword | プロキシベースのファイアウォールへの認証に使われるパスワード。 |
プロパティ | 説明 |
ProxyAutoDetect | これは、システムプロキシ設定を使用するかどうかを示します。これは他のプロキシ設定よりも優先されるため、カスタムプロキシ設定を使用するにはProxyAutoDetect をFALSE に設定する必要があります。 |
ProxyServer | HTTP トラフィックをルートするためのプロキシのホストネームもしくはIP アドレス。 |
ProxyPort | ProxyServer プロキシが起動しているTCP ポート。 |
ProxyAuthScheme | ProxyServer プロキシへの認証で使われる認証タイプ。 |
ProxyUser | ProxyServer プロキシへの認証に使われるユーザー名。 |
ProxyPassword | ProxyServer プロキシへの認証に使われるパスワード。 |
ProxySSLType | ProxyServer プロキシへの接続時に使用するSSL タイプ。 |
ProxyExceptions | ProxyServer 経由での接続が免除される宛先ホスト名またはIP のセミコロン区切りのリスト。 |
プロパティ | 説明 |
Logfile | ログファイルの名前と場所を指定するファイルパス。 |
Verbosity | ログファイルの記述をどの程度の詳細さで記載するかを決定するverbosity レベル。 |
LogModules | ログファイルに含めるコアモジュール。 |
MaxLogFileSize | ログファイルの最大バイトサイズ(例えば、10MB)を指定する文字列。 |
MaxLogFileCount | ログファイルの最大ファイル数を指定する文字列。 |
プロパティ | 説明 |
Location | テーブル、ビュー、およびストアドプロシージャを定義するスキーマファイルを格納するディレクトリへのパス。 |
BrowsableSchemas | このプロパティは、使用可能なスキーマのサブセットにレポートされるスキーマを制限します。例えば、BrowsableSchemas=SchemaA,SchemaB,SchemaC です。 |
Tables | このプロパティは、使用可能なテーブルのサブセットにレポートされるテーブルを制限します。例えば、Tables=TableA,TableB,TableC です。 |
Views | 使用可能なテーブルのサブセットにレポートされるビューを制限します。例えば、Views=ViewA,ViewB,ViewC です。 |
プロパティ | 説明 |
AutoCache | SELECT クエリの結果を、 CacheLocation 、または CacheConnection と CacheProvider の両方で指定されたキャッシュデータベースに自動的にキャッシュします。 |
CacheLocation | キャッシュデータベースへのパスとファイル名を指定します。 |
CacheTolerance | AutoCache 使用時のキャッシュ内の失効データに対する許容範囲の秒数。 |
Offline | オフラインモードを使用して、ライブソースではなくキャッシュからデータを取得します。 |
CacheMetadata | このプロパティは、テーブルメタデータをファイルストアにキャッシュするかどうかを決定します。 |
プロパティ | 説明 |
HTTPPath | The path component of the URL endpoint when using HTTP TransportMode. |
MaxRows | クエリで集計またはグループ化を使用しない場合に返される行数を制限します。これにより、設計時にパフォーマンスの問題を回避できます。 |
Other | これらの隠しプロパティは特定のユースケースでのみ使用されます。 |
Pagesize | Apache Impala から返されるページあたりの結果の最大数。 |
PseudoColumns | このプロパティは、テーブルのカラムとして疑似カラムが含まれているかどうかを示します。 |
QueryPassthrough | このオプションは、クエリをApache Impala サーバーにas-is で渡します。 |
Readonly | このプロパティを使用して、provider からApache Impala へのアクセスを読み取り専用に設定できます。 |
RTK | ライセンス供与で使用されるランタイムキー。 |
Timeout | タイムアウトエラーがスローされ、処理をキャンセルするまでの秒数。 |
UserDefinedViews | A filepath pointing to the JSON configuration file containing your custom views. |
UseSSL | Specifies whether to use SSL Encryption when connecting to Impala. |
このセクションでは、本プロバイダーの接続文字列で設定可能なAuthentication プロパティの全リストを提供します。
プロパティ | 説明 |
AuthScheme | The authentication scheme used. Accepted entries are NoSasl, LDAP and Kerberos. |
Server | The name of the server running SQL Server. |
Port | The port for the connection to the Impala Server instance. |
User | The username used to authenticate with Impala. |
Password | The password used to authenticate with Impala. |
ProtocolVersion | The Thrift protocol version to use when connecting to the Impala server. |
Database | The name of the Impala database to use by default. |
TransportMode | The transport mode to use to communicate with the Impala server. Accepted entries are BINARY and HTTP. |
The authentication scheme used. Accepted entries are NoSasl, LDAP and Kerberos.
string
"NoSasl"
The AuthScheme used to authenticate with Impala.
NoSasl(default) | default |
LDAP | Used when the enable_ldap_auth property is set to true and ldap_uri property is not empty. |
Kerberos | Used when the keytab_file property is is not empty. |
The name of the server running SQL Server.
string
""
Set this property to the name or network address of the SQL Server instance.
The port for the connection to the Impala Server instance.
string
"21050"
TBD:
When using BINARY TransportMode, this property should be set to the value in the 'hs2_port'(default 21050) property of the impala configuration (http://host:25000/varz).
When using HTTP TransportMode, this property should be set to the value in the 'hs2_http_port'(default 28000) property of the impala configuration (http://host:25000/varz).
The username used to authenticate with Impala.
string
""
The username used to authenticate with Impala.
The password used to authenticate with Impala.
string
""
The password used to authenticate with Impala.
The Thrift protocol version to use when connecting to the Impala server.
string
"7"
The most efficient protocol version will be determined automatically by the CData Cloud upon connecting to Impala. This property allows you to explicitly specify the version to use and overrides the version determined by the CData Cloud.
The name of the Impala database to use by default.
string
""
When specified, the CData Cloud will issue a 'USE [Database]' command upon connecting to Impala. This will be the database schema used when executing queries that do not have a schema explicitly specified.
To execute queries on other schemas, the schema can be explicitly specified in the statement.
When Database is not set, the 'default' database schema will be used (no 'USE' statement is issued to Impala in this case).
The transport mode to use to communicate with the Impala server. Accepted entries are BINARY and HTTP.
string
"BINARY"
The transport mode used to communicate with the Impala server.
このセクションでは、本プロバイダーの接続文字列で設定可能なKerberos プロパティの全リストを提供します。
プロパティ | 説明 |
KerberosKDC | ユーザーの認証で使用されるKerberos キー配布センター(KDC)サービス。 |
KerberosRealm | ユーザーの認証で使用されるKerberos 領域。 |
KerberosSPN | Kerberos ドメインコントローラーのサービスプリンシパル名(SPN)。 |
KerberosKeytabFile | Kerberos プリンシパルと暗号化されたキーのペアを含むKeytab ファイル。 |
KerberosServiceRealm | サービスのKerberos レルム。 |
KerberosServiceKDC | サービスのKerberos KDC。 |
KerberosTicketCache | MIT Kerberos 資格情報キャッシュファイルへのフルパス。 |
ユーザーの認証で使用されるKerberos キー配布センター(KDC)サービス。
string
""
Kerberos のプロパティは、SPNEGO またはWindows 認証を使用する場合に使用されます。Cloud は、Kerberos KDC サービスにセッションチケットと一時セッションキーを要求します。Kerberos KDC サービスは、通常、ドメインコントローラーと同じコンピュータに置かれています。
Kerberos KDC が指定されていない場合、Cloud は、これらのプロパティを自動的に次の場所から検出しようとします。
ユーザーの認証で使用されるKerberos 領域。
string
""
Kerberos のプロパティは、SPNEGO またはWindows 認証を使用する場合に使用されます。Kerberos 領域は、Kerberos キー配布センター(KDC)サービスを使用してユーザーを認証するために使用されます。Kerberos 領域は、管理者が任意の文字列に設定できますが、通常はドメイン名に基づいて設定されます。
Kerberos 領域が指定されていない場合、Cloud は、これらのプロパティを自動的に次の場所から検出しようとします。
Kerberos ドメインコントローラーのサービスプリンシパル名(SPN)。
string
""
Kerberos ドメインコントローラーのSPN が認証先のURL と異なる場合は、このプロパティを使用してSPN を設定します。
Kerberos プリンシパルと暗号化されたキーのペアを含むKeytab ファイル。
string
""
Kerberos のプリンシパルと暗号化されたキーのペアを含むKeytab ファイル。
サービスのKerberos レルム。
string
""
KerberosServiceRealm は、クロスレルムKerberos 認証を使用するときにサービスKerberos レルムを指定するために使われます。
ほとんどの場合、単一のレルムとKDC マシンがKerberos 認証を実行するために使用され、このプロパティは必要ありません。
このプロパティは、異なるレルムとKDC マシンを使用して認証チケット(AS リクエスト)およびサービスチケット(TGS リクエスト)を取得する、より複雑な設定で使用できます。
サービスのKerberos KDC。
string
""
KerberosServiceKDC は、クロスレルムKerberos 認証を使用するときにサービスKerberos KDC を指定するために使われます。
ほとんどの場合、単一のレルムとKDC マシンがKerberos 認証を実行するために使用され、このプロパティは必要ありません。
このプロパティは、異なるレルムとKDC マシンを使用して認証チケット(AS リクエスト)およびサービスチケット(TGS リクエスト)を取得する、より複雑な設定で使用できます。
MIT Kerberos 資格情報キャッシュファイルへのフルパス。
string
""
このプロパティは、MIT Kerberos チケットマネージャーまたはkinit コマンドを使用して作成された資格情報キャッシュファイルを使用する場合に設定できます。
このセクションでは、本プロバイダーの接続文字列で設定可能なSSL プロパティの全リストを提供します。
プロパティ | 説明 |
SSLClientCert | SSL クライアント認証(2-way SSL)のためのTLS/SSL クライアント証明書ストア。 |
SSLClientCertType | TLS/SSL クライアント証明書を格納するキーストアの種類。 |
SSLClientCertPassword | TLS/SSL クライアント証明書のパスワード。 |
SSLClientCertSubject | TLS/SSL クライアント証明書の件名。 |
SSLServerCert | TLS/SSL を使用して接続するときに、サーバーが受け入れ可能な証明書。 |
SSL クライアント認証(2-way SSL)のためのTLS/SSL クライアント証明書ストア。
string
""
クライアント証明書のための証明書ストア名。
SSLClientCertType フィールドは、SSLClientCert により指定された証明書ストアの種類を指定します。ストアがパスワードで保護されている場合は、SSLClientCertPassword でパスワードを指定します。
SSLClientCert は、SSLClientCertSubject フィールドとともにクライアント証明書を指定するために使われます。SSLClientCert に値がある場合で、SSLClientCertSubject が設定されている場合は、証明書の検索が始まります。詳しくは、SSLClientCertSubject を参照してください。
証明書ストアの指定はプラットフォームに依存します。
Windows の共通のユーザとシステム証明書ストアの指定は以下のとおりです。
MY | 個人証明書と関連付けられた秘密キーを格納している証明書ストア。 |
CA | 証明機関の証明書。 |
ROOT | ルート証明書。 |
SPC | ソフトウェア発行元証明書。 |
Javaでは、証明書ストアは通常、証明書および任意の秘密キーを含むファイルです。
証明書ストアの種類がPFXFile の場合は、このプロパティにファイル名を設定します。PFXBlob の場合は、このプロパティをPFX ファイルのバイナリコンテンツ(例えば、PKCS12証明書ストア)に設定する必要があります。
TLS/SSL クライアント証明書を格納するキーストアの種類。
string
"USER"
このプロパティには次の値の一つを設定できます。
USER - デフォルト | Windows の場合、現在のユーザーにより所有された証明書ストアであることを指定します。この種類はJava では利用できませんので注意してください。 |
MACHINE | Windows の場合、この証明書ストアがシステムストアであることを指定します。この種類はJava では利用できませんので注意してください。 |
PFXFILE | この証明書ストアは、証明書を含むPFX(PKCS12)ファイルの名前です。 |
PFXBLOB | この証明書ストアは、PFX(PKCS12)形式の証明書ストアを表すBase-64でエンコードされた文字列です。 |
JKSFILE | この証明書ストアは、証明書を含むJava key store(JKS)ファイルの名前です。この種類はJava でのみ利用できますので注意してください。 |
JKSBLOB | この証明書ストアは、Java key store(JKS)形式の証明書ストアを表すBase-64でエンコードされた文字列です。この種類はJava でのみ利用できますので注意してください。 |
PEMKEY_FILE | この証明書ストアは、秘密キーと任意の証明書を含むPEM でエンコードされたファイルの名前です。 |
PEMKEY_BLOB | この証明書ストアは、秘密キーと任意の証明書を含むBase-64でエンコードされた文字列です。 |
PUBLIC_KEY_FILE | この証明書ストアは、PEM またはDER でエンコードされた公開キーの証明書を含むファイルの名前です。 |
PUBLIC_KEY_BLOB | この証明書ストアは、PEM またはDER でエンコードされた公開キーの証明書を含むBase-64でエンコードされた文字列です。 |
SSHPUBLIC_KEY_FILE | この証明書ストアは、SSH 公開キーを含むファイルの名前です。 |
SSHPUBLIC_KEY_BLOB | この証明書ストアは、SSH 公開キーを含むBase-64でエンコードされた文字列です。 |
P7BFILE | この証明書ストアは、証明書を含むPKCS7 ファイルの名前です。 |
PPKFILE | この証明書ストアは、PuTTY 秘密キー(PPK)を含むファイルの名前です。 |
XMLFILE | この証明書ストアは、XML 形式の証明書を含むファイルの名前です。 |
XMLBLOB | この証明書ストアは、XML 形式の証明書を含む文字列の名前です。 |
TLS/SSL クライアント証明書のパスワード。
string
""
証明書ストアでパスワードが必要である場合、このプロパティを使用してパスワードを指定し、証明書ストアにアクセスできます。
TLS/SSL クライアント証明書の件名。
string
"*"
証明書の件名は、証明書をロードするときにストア内の証明書を検索するために使用されます。
完全に一致するものが見つからない場合、ストアはプロパティの値を含む件名を検索します。それでも一致するものが見つからない場合、プロパティは空白で設定され、証明書は選択されません。
"*" に設定すると、証明書ストアの1番目の証明書が選択されます。
証明書の件名は識別の名前フィールドおよび値のカンマ区切りのリストです。例えば、"CN=www.server.com, OU=test, C=US, E=support@company.com" です。共通のフィールドとその説明は以下のとおりです。
フィールド | 説明 |
CN | 共通名。一般的には、www.server.com のようなホスト名です。 |
O | 法人名 |
OU | 法人の部署名 |
L | 法人の住所(市町村名) |
S | 法人の住所(都道府県) |
C | 国名 |
E | Eメールアドレス |
フィールド値にカンマが含まれている場合は、それを引用符で囲む必要があります。
TLS/SSL を使用して接続するときに、サーバーが受け入れ可能な証明書。
string
""
TLS/SSL 接続を使用する場合は、このプロパティを使用して、サーバーが受け入れるTLS/SSL 証明書を指定できます。コンピュータによって信頼されていない他の証明書はすべて拒否されます。
このプロパティは、次のフォームを取ります:
説明 | 例 |
フルPEM 証明書(例では省略されています) | -----BEGIN CERTIFICATE----- MIIChTCCAe4CAQAwDQYJKoZIhv......Qw== -----END CERTIFICATE----- |
証明書を保有するローカルファイルへのパス。 | C:\cert.cer |
公開鍵(例では省略されています) | -----BEGIN RSA PUBLIC KEY----- MIGfMA0GCSq......AQAB -----END RSA PUBLIC KEY----- |
MD5 Thumbprint (hex 値はスペースおよびコロン区切り) | ecadbdda5a1529c58a1e9e09828d70e4 |
SHA1 Thumbprint (hex 値はスペースおよびコロン区切り) | 34a929226ae0819f2ec14b4a3d904f801cbb150d |
これを指定しない場合は、マシンが信用するすべての証明書が受け入れられます。
すべての証明書の受け入れを示すには、'*'を使用します。セキュリティ上の理由から、これはお勧めできません。
このセクションでは、本プロバイダーの接続文字列で設定可能なFirewall プロパティの全リストを提供します。
プロパティ | 説明 |
FirewallType | プロキシベースのファイアウォールで使われるプロトコル。 |
FirewallServer | プロキシベースのファイアウォールの名前もしくはIP アドレス。 |
FirewallPort | プロキシベースのファイアウォールのTCP ポート。 |
FirewallUser | プロキシベースのファイアウォールに認証するために使うユーザー名。 |
FirewallPassword | プロキシベースのファイアウォールへの認証に使われるパスワード。 |
プロキシベースのファイアウォールで使われるプロトコル。
string
"NONE"
このプロパティは、Cloud がFirewallServer プロキシ経由でトンネルトラフィックを使うためのプロトコルを指定します。デフォルトでは、Cloud はシステムプロキシに接続します。この動作を無効化し次のプロキシタイプのどれかで接続するには、ProxyAutoDetect をfalse に設定します。
タイプ | デフォルトポート | 説明 |
TUNNEL | 80 | これが設定されている場合、Cloud はApache Impala への接続を開き、プロキシを経由して通信が行われます。 |
SOCKS4 | 1080 | これが設定されている場合、Cloud はデータをFirewallServer およびFirewallPort で指定されたSOCS 4 プロキシ経由で送信し、接続リクエストが許容されるかどうかを決定します。 |
SOCKS5 | 1080 | これが設定されている場合、Cloud はデータをFirewallServer およびFirewallPort で指定されたSOCS 5 プロキシ経由で送信します。プロキシに認証が必要な場合には、FirewallUser およびFirewallPassword をプロキシが認識する認証情報に設定します。 |
HTTP プロキシへの接続には、ProxyServer およびProxyPort ポートを使ってください。HTTP プロキシへの認証には、ProxyAuthScheme、ProxyUser、およびProxyPassword を使ってください。
プロキシベースのファイアウォールの名前もしくはIP アドレス。
string
""
ファイアウォールトラバーサルを許容するために設定するIP アドレス、DNS 名、もしくはプロキシホスト名を指定するプロパティです。プロトコルはFirewallType で指定されます。このプロパティとFirewallServer を使って、SOCKS 経由での接続、もしくはトンネリングが可能です。HTTP プロキシへの接続には、ProxyServer を使用します。
Cloud はデフォルトでシステムプロキシを使うので注意してください。他のプロキシを使う場合には、ProxyAutoDetect をfalse に設定してください。
プロキシベースのファイアウォールのTCP ポート。
int
0
ファイアウォールトラバーサルを許容するために設定するプロキシベースのファイアウォールのTCP ポート。名前もしくはIP アドレスを指定するには、FirewallServer を使います。FirewallType でプロトコルを指定します。
プロキシベースのファイアウォールに認証するために使うユーザー名。
string
""
FirewallUser およびFirewallPassword プロパティは、FirewallType により指定された認証方式に則り、FirewallServer、およびFirewallPort で指定されたプロキシに対しての認証に使われます。
プロキシベースのファイアウォールへの認証に使われるパスワード。
string
""
このプロパティは、FirewallType により指定された認証メソッドに則り、FirewallServer およびFirewallPort で指定されたプロキシに渡されます。
このセクションでは、本プロバイダーの接続文字列で設定可能なProxy プロパティの全リストを提供します。
プロパティ | 説明 |
ProxyAutoDetect | これは、システムプロキシ設定を使用するかどうかを示します。これは他のプロキシ設定よりも優先されるため、カスタムプロキシ設定を使用するにはProxyAutoDetect をFALSE に設定する必要があります。 |
ProxyServer | HTTP トラフィックをルートするためのプロキシのホストネームもしくはIP アドレス。 |
ProxyPort | ProxyServer プロキシが起動しているTCP ポート。 |
ProxyAuthScheme | ProxyServer プロキシへの認証で使われる認証タイプ。 |
ProxyUser | ProxyServer プロキシへの認証に使われるユーザー名。 |
ProxyPassword | ProxyServer プロキシへの認証に使われるパスワード。 |
ProxySSLType | ProxyServer プロキシへの接続時に使用するSSL タイプ。 |
ProxyExceptions | ProxyServer 経由での接続が免除される宛先ホスト名またはIP のセミコロン区切りのリスト。 |
これは、システムプロキシ設定を使用するかどうかを示します。これは他のプロキシ設定よりも優先されるため、カスタムプロキシ設定を使用するにはProxyAutoDetect をFALSE に設定する必要があります。
bool
true
これは他のプロキシ設定よりも優先されるため、カスタムプロキシ設定を使用するにはProxyAutoDetect をFALSE に設定する必要があります。
HTTP プロキシへの接続には、ProxyServer を参照してください。SOCKS やトンネリングなどの他のプロキシには、FirewallType を参照してください。
HTTP トラフィックをルートするためのプロキシのホストネームもしくはIP アドレス。
string
""
HTTP トラフィックをルートするためのプロキシのホストネームもしくはIP アドレス。HTTP プロキシへの認証には、Cloud はHTTP、Windows(NTLM)、もしくはKerberos 認証タイプを使用することができます。
SOCKS プロキシを経由して接続する、もしくは接続をトンネルするには、FirewallType を参照してください。
デフォルトで、Cloud はsystem プロキシを使います。他のプロキシを使う場合には、ProxyAutoDetect をfalse に設定します。
ProxyServer プロキシが起動しているTCP ポート。
int
80
HTTP トラフィックをリダイレクトするHTTP プロキシが実行されているポート。ProxyServer でHTTP プロキシを指定します。その他のプロキシタイプについては、FirewallType を参照してください。
ProxyServer プロキシへの認証で使われる認証タイプ。
string
"BASIC"
この値は、ProxyServer およびProxyPort で指定されるHTTP プロキシに認証するために使われる認証タイプを指定します。
Cloud は、デフォルトでsystem proxy settings を使い、追加での設定が不要です。他のプロキシへの接続をする場合には、ProxyServer およびProxyPort に加え、ProxyAutoDetect をfalse に設定します。認証するには、ProxyAuthScheme を設定し、必要な場合にはProxyUser およびProxyPassword を設定します。
認証タイプは、次のどれかになります。
SOCKS 5 認証のような他の認証タイプを使用するには、FirewallType を参照してください。
ProxyServer プロキシへの認証に使われるユーザー名。
string
""
ProxyUser および ProxyPassword オプションは、ProxyServer で指定されたHTTP プロキシに対して接続および認証するために使用されます。
ProxyAuthScheme で使用可能な認証タイプを選択することができます。HTTP 認証を使う場合、これをHTTP プロキシで識別可能なユーザーのユーザー名に設定します。Windows もしくはKerberos 認証を使用する場合、このプロパティを次の形式のどれかでユーザー名に設定します。
user@domain domain\user
ProxyServer プロキシへの認証に使われるパスワード。
string
""
このプロパティは、NTLM(Windows)、Kerberos、もしくはHTTP 認証をサポートするHTTP プロキシサーバーに認証するために使われます。HTTP プロキシを指定するためには、ProxyServer およびProxyPort を設定します。認証タイプを指定するためにはProxyAuthScheme を設定します。
HTTP 認証を使う場合、さらにHTTP プロキシにProxyUser およびProxyPassword を設定します。
NTLM 認証を使う場合、Windows パスワードにProxyUser およびProxyPassword を設定します。Kerberos 認証には、これらを入力する必要があります。
SOCKS 5 認証もしくは、トンネリングは、FirewallType を参照してください。
デフォルトで、Cloud はsystem プロキシを使います。他のプロキシに接続する場合には、これをfalse に設定します。
ProxyServer プロキシへの接続時に使用するSSL タイプ。
string
"AUTO"
このプロパティは、ProxyServer で指定されたHTTP プロキシへの接続にSSL を使用するかどうかを決定します。この値は、AUTO、ALWAYS、NEVER、TUNNEL のいずれかです。有効な値は次のとおりです。
AUTO | デフォルト設定。URL がHTTPS URL の場合、Cloud は、TUNNEL オプションを使います。URL がHTTP URL の場合、コンポーネントはNEVER オプションを使います。 |
ALWAYS | 接続は、常にSSL 有効となります。 |
NEVER | 接続は、SSL 有効になりません。 |
TUNNEL | 接続は、トンネリングプロキシを経由します。プロキシサーバーがリモートホストへの接続を開き、プロキシを経由して通信が行われます。 |
ProxyServer 経由での接続が免除される宛先ホスト名またはIP のセミコロン区切りのリスト。
string
""
ProxyServer は、このプロパティで定義されたアドレスを除くすべてのアドレスに使用されます。セミコロンを使用してエントリを区切ります。
Cloud は、追加設定なしにデフォルトでシステムのプロキシ設定を使います。この接続のプロキシ例外を明示的に構成するには、ProxyAutoDetect をfalse に設定して、ProxyServer およびProxyPort を設定する必要があります。認証するには、ProxyAuthScheme を設定し、必要な場合にはProxyUser およびProxyPassword を設定します。
このセクションでは、本プロバイダーの接続文字列で設定可能なLogging プロパティの全リストを提供します。
プロパティ | 説明 |
Logfile | ログファイルの名前と場所を指定するファイルパス。 |
Verbosity | ログファイルの記述をどの程度の詳細さで記載するかを決定するverbosity レベル。 |
LogModules | ログファイルに含めるコアモジュール。 |
MaxLogFileSize | ログファイルの最大バイトサイズ(例えば、10MB)を指定する文字列。 |
MaxLogFileCount | ログファイルの最大ファイル数を指定する文字列。 |
ログファイルの名前と場所を指定するファイルパス。
string
""
このプロパティを設定すると、認証が実行されたときやクエリが実行されたときなど、さまざまなタスクを実行する際に、Cloud がログファイルを生成します。指定したファイルが存在しない場合は作成されます。
接続文字列およびバージョン情報も記録されますが、機密情報を含む接続プロパティは自動的にマスクされます。
相対ファイルパスが指定された場合、ログファイルの場所は、Location 接続プロパティにあるパスに基づいて解決されます。
ログファイルに記録される内容をより細かく制御するには、Verbosity プロパティを調整してください。
ログ内容はいくつかのモジュールに分類されます。LogModules プロパティを使うことで、個々のモジュールを表示または非表示にすることができます。
新しいログファイルの作成前にログファイル1つの最大サイズを変更する方法については、MaxLogFileSize を参照してください。
生成されるログファイル数に上限を設定したい場合は、MaxLogFileCount を使用してください。
ログファイルに含めるコアモジュール。
string
""
指定された(';' で区切られた)モジュールのみがログファイルに含まれます。デフォルトではすべてのモジュールが含まれます。
概要はログ ページを参照してください。
ログファイルの最大バイトサイズ(例えば、10MB)を指定する文字列。
string
"100MB"
サイズリミットを超えると、日付と時刻が末尾に追加された新しいログが同じフォルダ内に作成されます。リミットのデフォルトは100 MB です。100 kB より小さい値を設定した場合、100 kB がリミットとなります。
生成されるログファイルの最大数は、MaxLogFileCount で調整できます。
ログファイルの最大ファイル数を指定する文字列。
int
-1
サイズリミットを超えると、日付と時刻が末尾に追加された新しいログが同じフォルダ内に作成され、最も古いログファイルが削除されます。
サポートされている最小値は2です。0や負の値は、数に制限がないことを示します。
生成されるログファイルの最大サイズは、MaxLogFileSize で調整できます。
このセクションでは、本プロバイダーの接続文字列で設定可能なSchema プロパティの全リストを提供します。
プロパティ | 説明 |
Location | テーブル、ビュー、およびストアドプロシージャを定義するスキーマファイルを格納するディレクトリへのパス。 |
BrowsableSchemas | このプロパティは、使用可能なスキーマのサブセットにレポートされるスキーマを制限します。例えば、BrowsableSchemas=SchemaA,SchemaB,SchemaC です。 |
Tables | このプロパティは、使用可能なテーブルのサブセットにレポートされるテーブルを制限します。例えば、Tables=TableA,TableB,TableC です。 |
Views | 使用可能なテーブルのサブセットにレポートされるビューを制限します。例えば、Views=ViewA,ViewB,ViewC です。 |
テーブル、ビュー、およびストアドプロシージャを定義するスキーマファイルを格納するディレクトリへのパス。
string
"%APPDATA%\\CData\\ApacheImpala Data Provider\\Schema"
Cloud のスキーマファイル(テーブルとビューの場合は.rsd ファイル、ストアドプロシージャの場合は.rsb ファイル)を含むディレクトリへのパス。このフォルダの場所は、実行ファイルの場所からの相対パスにすることができます。Location プロパティは、定義をカスタマイズしたり(例えば、カラム名を変更する、カラムを無視するなど)、新しいテーブル、ビュー、またはストアドプロシージャでデータモデルを拡張する場合にのみ必要です。
指定しない場合、デフォルトの場所は"%APPDATA%\\CData\\ApacheImpala Data Provider\\Schema" となり、%APPDATA% はユーザーのコンフィギュレーションディレクトリに設定されます:
このプロパティは、使用可能なスキーマのサブセットにレポートされるスキーマを制限します。例えば、BrowsableSchemas=SchemaA,SchemaB,SchemaC です。
string
""
スキーマをデータベースからリストすると、負荷がかかる可能性があります。接続文字列でスキーマのリストを提供すると、 パフォーマンスが向上します。
このプロパティは、使用可能なテーブルのサブセットにレポートされるテーブルを制限します。例えば、Tables=TableA,TableB,TableC です。
string
""
テーブルを複数のデータベースからリストすると、負荷がかかる可能性があります。接続文字列でテーブルのリストを提供すると、Cloud のパフォーマンスが向上します。
このプロパティは、作業したいビューがすでにわかっていて、ビューが多すぎる場合に、ビューを自動的にリストする代わりに使用することもできます。
カンマ区切りのリストで使用したいテーブルを指定します。各テーブルは、角かっこ、二重引用符、またはバッククオートを使用してエスケープされた特殊文字列を含む有効なSQL 識別子である必要があります。 例えば、Tables=TableA,[TableB/WithSlash],WithCatalog.WithSchema.`TableC With Space` です。
複数のスキーマまたはカタログを持つデータソースに接続する場合は、複数のカタログやスキーマに存在するテーブル間の曖昧さを避けるため、最後の例のように、このプロパティにテーブルの完全修飾名を指定する必要があることに注意してください。
使用可能なテーブルのサブセットにレポートされるビューを制限します。例えば、Views=ViewA,ViewB,ViewC です。
string
""
ビューを複数のデータベースからリストすると、負荷がかかる可能性があります。接続文字列でビューのリストを提供すると、Cloud のパフォーマンスが向上します。
このプロパティは、作業したいビューがすでにわかっていて、ビューが多すぎる場合に、ビューを自動的にリストする代わりに使用することもできます。
カンマ区切りのリストで使用したいビューを指定します。各ビューは、角かっこ、二重引用符、またはバッククオートを使用してエスケープされた特殊文字列を含む有効なSQL 識別子である必要があります。 例えば、Views=ViewA,[ViewB/WithSlash],WithCatalog.WithSchema.`ViewC With Space` です。
複数のスキーマまたはカタログを持つデータソースに接続する場合は、複数のカタログやスキーマに存在するテーブル間の曖昧さを避けるため、最後の例のように、このプロパティにテーブルの完全修飾名を指定する必要があることに注意してください。
このセクションでは、本プロバイダーの接続文字列で設定可能なCaching プロパティの全リストを提供します。
プロパティ | 説明 |
AutoCache | SELECT クエリの結果を、 CacheLocation 、または CacheConnection と CacheProvider の両方で指定されたキャッシュデータベースに自動的にキャッシュします。 |
CacheLocation | キャッシュデータベースへのパスとファイル名を指定します。 |
CacheTolerance | AutoCache 使用時のキャッシュ内の失効データに対する許容範囲の秒数。 |
Offline | オフラインモードを使用して、ライブソースではなくキャッシュからデータを取得します。 |
CacheMetadata | このプロパティは、テーブルメタデータをファイルストアにキャッシュするかどうかを決定します。 |
SELECT クエリの結果を、 CacheLocation 、または CacheConnection と CacheProvider の両方で指定されたキャッシュデータベースに自動的にキャッシュします。
bool
false
AutoCache がtrue に設定されていると、Cloud はテーブルデータのキャッシュを選択したデータベースに自動的に保存します。
AutoCache がtrue の場合、Cloud はシンプルなファイルベースストアにキャッシュします。次のプロパティを使って、場所またはキャッシュを別のデータベースに構成できます。
キャッシュデータベースへのパスとファイル名を指定します。
string
"%APPDATA%\\CData\\ApacheImpala Data Provider"
CacheLocation は単純なファイルベースキャッシュです。
指定しない場合、デフォルトの場所は"%APPDATA%\\CData\\ApacheImpala Data Provider" となり、%APPDATA%はユーザーのコンフィギュレーションディレクトリに設定されます:
AutoCache 使用時のキャッシュ内の失効データに対する許容範囲の秒数。
int
600
キャッシュ内の失効データに対する許容範囲の秒数。これは、AutoCache が使用されている場合のみ有効です。Cloud は、許容インターバルが過ぎると、新しいレコードがないかデータソースをチェックしに行きます。それ以外は、キャッシュから直接データを返します。
オフラインモードを使用して、ライブソースではなくキャッシュからデータを取得します。
bool
false
Offline がtrue に設定されている場合、すべてのクエリは、ライブデータソースではなくキャッシュに対して実行されます。このモードでは、INSERT、UPDATE、DELETE、CACHE などのクエリは許可されません。
このプロパティは、テーブルメタデータをファイルストアにキャッシュするかどうかを決定します。
bool
false
このプロパティを設定してクエリを実行すると、Apache Impala カタログのテーブルメタデータが設定されている場合にはCacheLocation で指定されたファイルストアに、設定されていない場合にはホームディレクトリにキャッシュされます。テーブルのメタデータの取得は、テーブルがはじめてクエリされた際に一度だけ行われます。
Cloud は、はじめてテーブルやビューを発見したときから2時間の間、メタデータをインメモリに自動的に保管します。そのため、CacheMetadata は一般的には必要ありません。CacheMetadata は、大量のメタデータを扱う場合でメタデータオペレーションのコストが高い場合や、短い接続を大量に行う場合などに役立ちます。
このセクションでは、本プロバイダーの接続文字列で設定可能なMiscellaneous プロパティの全リストを提供します。
プロパティ | 説明 |
HTTPPath | The path component of the URL endpoint when using HTTP TransportMode. |
MaxRows | クエリで集計またはグループ化を使用しない場合に返される行数を制限します。これにより、設計時にパフォーマンスの問題を回避できます。 |
Other | これらの隠しプロパティは特定のユースケースでのみ使用されます。 |
Pagesize | Apache Impala から返されるページあたりの結果の最大数。 |
PseudoColumns | このプロパティは、テーブルのカラムとして疑似カラムが含まれているかどうかを示します。 |
QueryPassthrough | このオプションは、クエリをApache Impala サーバーにas-is で渡します。 |
Readonly | このプロパティを使用して、provider からApache Impala へのアクセスを読み取り専用に設定できます。 |
RTK | ライセンス供与で使用されるランタイムキー。 |
Timeout | タイムアウトエラーがスローされ、処理をキャンセルするまでの秒数。 |
UserDefinedViews | A filepath pointing to the JSON configuration file containing your custom views. |
UseSSL | Specifies whether to use SSL Encryption when connecting to Impala. |
The path component of the URL endpoint when using HTTP TransportMode.
string
"cliservice"
This property is used to specify the path component of the URL endpoint when using HTTP TransportMode.
クエリで集計またはグループ化を使用しない場合に返される行数を制限します。これにより、設計時にパフォーマンスの問題を回避できます。
int
-1
クエリで集計またはグループ化を使用しない場合に返される行数を制限します。これにより、設計時にパフォーマンスの問題を回避できます。
これらの隠しプロパティは特定のユースケースでのみ使用されます。
string
""
以下にリストされているプロパティは、特定のユースケースで使用可能です。通常のドライバーのユースケースおよび機能では、これらのプロパティは必要ありません。
複数のプロパティをセミコロン区切りリストで指定します。
DefaultColumnSize | データソースがメタデータにカラムの長さを提供しない場合に、文字列フィールドのデフォルトの長さを設定します。デフォルト値は2000です。 |
ConvertDateTimeToGMT | 日時の値を、マシンのローカルタイムではなくGMT グリニッジ標準時に変換するかどうかを決定します。 |
RecordToFile=filename | 基底のソケットデータ転送を指定のファイルに記録します。 |
Apache Impala から返されるページあたりの結果の最大数。
int
10000
Pagesize プロパティは、Apache Impala から返されるページあたりの結果の最大数に影響を与えます。より大きい値を設定すると、1ページあたりの消費メモリが増える代わりに、パフォーマンスが向上する場合があります。
このプロパティは、テーブルのカラムとして疑似カラムが含まれているかどうかを示します。
string
""
Entity Framework ではテーブルカラムでない疑似カラムに値を設定できないため、この設定はEntity Framework で特に便利です。この接続設定の値は、"Table1=Column1, Table1=Column2, Table2=Column3" の形式です。"*=*" のように"*" 文字を使用して、すべてのテーブルとすべてのカラムを含めることができます。
このオプションは、クエリをApache Impala サーバーにas-is で渡します。
bool
false
これが設定されていると、クエリはApache Impala に直接渡されます。
このプロパティを使用して、provider からApache Impala へのアクセスを読み取り専用に設定できます。
bool
false
このプロパティがtrue に設定されている場合、Cloud はSELECT クエリのみ許可します。INSERT、UPDATE、DELETE、およびストアドプロシージャクエリではエラーが返されます。
ライセンス供与で使用されるランタイムキー。
string
""
RTK プロパティは、ビルドにライセンスを供与するために使用されます。
タイムアウトエラーがスローされ、処理をキャンセルするまでの秒数。
int
60
Timeout が0に設定されている場合は、操作がタイムアウトしません。処理が正常に完了するか、エラー状態になるまで実行されます。
Timeout の有効期限が切れても処理が完了していない場合は、Cloud は例外をスローします。
A filepath pointing to the JSON configuration file containing your custom views.
string
""
User Defined Views are defined in a JSON-formatted configuration file called UserDefinedViews.json. The Cloud automatically detects the views specified in this file.
You can also have multiple view definitions and control them using the UserDefinedViews connection property. When you use this property, only the specified views are seen by the Cloud.
This User Defined View configuration file is formatted as follows:
For example:
{ "MyView": { "query": "SELECT * FROM [CData].[Default].Customers WHERE MyColumn = 'value'" }, "MyView2": { "query": "SELECT * FROM MyTable WHERE Id IN (1,2,3)" } }Use the UserDefinedViews connection property to specify the location of your JSON configuration file. For example:
"UserDefinedViews", "C:\\Users\\yourusername\\Desktop\\tmp\\UserDefinedViews.json"
Specifies whether to use SSL Encryption when connecting to Impala.
bool
false
Specifies whether to use SSL Encryption when connecting to Impala.