2017-05-26 65 views
1

我試圖按照這裏說明添加從Scala代碼排序關鍵字:https://github.com/databricks/spark-redshiftDatabricks星火紅移:SORTKEYS不工作

df.write 
    .format(formatRS) 
    .option("url", connString) 
    .option("jdbcdriver", jdbcDriverRS) 
    .option("dbtable", table) 
    .option("tempdir", tempDirRS + table) 
    .option("usestagingtable", "true") 
    .option("diststyle", "KEY") 
    .option("distkey", "id") 
    .option("sortkeyspec", "INTERLEAVED SORTKEY (id,timestamp)") 
    .mode(mode) 
    .save() 
,因爲當我檢查表信息

排序關鍵字正在實施錯:

排序鍵=交錯

我需要以正確的方式來添加排序鍵。

回答

0

沒有錯誤的執行,錯誤的是從「檢查查詢」返回

排序鍵=交錯

這足以迷惑相信有什麼不對發生。

所以如果你需要檢查交錯排序鍵,你應該運行此查詢:

select tbl as tbl_id, stv_tbl_perm.name as table_name, 
col, interleaved_skew, last_reindex 
from svv_interleaved_columns, stv_tbl_perm 
where svv_interleaved_columns.tbl = stv_tbl_perm.id 
and interleaved_skew is not null;