2016-08-26 19 views
-2

intからbigint、realからfloat、varcharからtextなど、SQLサーバーからcassandraにいくつかのデータ型をマッピングします。 SQL Serverからcassandraへのマッピングはどこで入手できますか?SQLとCassandraのデータ型のマッピング

+0

使用するデータ型を決定する必要があります。この種のものには標準がない。 –

答えて

1

の説明と比較すると、ここにはいくつかのマッピングがありますが、CQLデータ型リファレンスの誤植を過度に自信しているわけではありません。

比較では、文字データ型の照合セットやこのデータを変換してSQL Serverに渡す方法など、データ型の表現を変更するSQL Serverの設定は考慮されていません。

に基づいて比較を行っていますが、これは両方のタイプで表すことができます。コメントに細心の注意を払う。

 
CQL Data Type | Match? | SQL Server Data Type | Comment 
------------------------------------------------------------------------------------- 
list    N  none     A collection; no native SQL equivalent. Perhaps sql_variant or XML could be used but operations on list in CQL wouldn't apply in SQL Server. Custom data types and CLR integrations would most likely be required 
map    N  none     Similar to above except as of SQL Server 2016, [JSON Data](https://msdn.microsoft.com/en-gb/library/dn921897.aspx) handling has been introduced so it's possible it could parse CQL maps 
set    N  none     " 

int    Y  int     Both represent 32-bit signed integers 
bigint    Y  bigint     Both represent 64-bit signed integers 
varint    ?  smallint    Not clear if varint storage size will change, so if precision was -32768 to 32767, would it take 2 bytes? Also, if varint has values outside of smallint range, you may run into overflow errors. From smallint to varint, there's no indication in the above links 
varint    ?  tinyint    Similar to above except if precision was 0 to 255, would it take 1 bytes? 

float    Y  float 

decimal   ?  decimal    Not clear of the precision and scaling limits of CQL decimal 

ascii    ?  char, varchar   Not clear this mapping is accurate, more an assumption. Limits and conversion behaviour are not known 
text    ?  ntext     Based on UTF-8 encoding and that CQL seems to have varchar/text as does SQL. So it's likely text represents larger length text strings 
varchar   ?  nchar, nvarchar  Based on UTF-8 encoding supported by both. Not clear what varchar limits are or the conversion behaviour 

timestamp   ?  datetime    Not clear what timestamp limits are or the conversion behaviour 

boolean   ?  bit     Not clear on conversion behaviour 

blob    ?  binary, varbinary  Not clear what the limits are on length of a CQL blob 

uuid    ?  uniqueidentifier  uuid follows standard UUID format, most likely 128 bits (16 bytes) which is the same storage size as uniqueidentifier. Not clear on the conversion behaviour 
関連する問題