数据仓库服务 GAUSSDB(DWS)-PARTITION:RANGE_N在字符串列的分区

时间:2024-10-26 11:41:18

RANGE_N在字符串列的分区

输入

CREATE SET TABLE SC.TAB , NO FALLBACK,
NO BEFORE JOURNAL,
NO AFTER JOURNAL,
CHECKSUM=DEFAULT,
DEFAULT MERGEBLOCKRATIO
(
ACCOUNT_NUM VARCHAR(255) CHARACTER SET LATIN NOT CASESPECIFIC NOT NULL
,ACCOUNT_MODIFIER_NUM CHAR(18) CHARACTER SET LATIN NOT CASESPECIFIC NOT NULL
,DATA_SOURCE_ID CHAR(10) CHARACTER SET LATIN NOT CASESPECIFIC 
,END_DT DATE FORMAT 'YYYY-MM-DD'
,UPD_TXF_BATCHTD INTEGER COMPRESS
)
PRIMARY INDEX XPKT0300_AGREEMENT (ACCOUNT_NUM,ACCOUNT_MODIFIER_NUM)
PARTITION BY ( RANGE_N(DATA_SOURCE_ID BETWEEN 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z' AND 'ZZ', NO RANGE ,UNKNOWN) ,CASE_N(END_DT IS NULL , NO CASE , UNKNOWN))
;

输出

CREATE
     TABLE
          SC.TAB (
               ACCOUNT_NUM VARCHAR( 255 ) /* CHARACTER SET LATIN*/       /* NOT CASESPECIFIC*/               NOT NULL
               ,ACCOUNT_MODIFIER_NUM CHAR( 18 ) /* CHARACTER SET LATIN*/               /* NOT CASESPECIFIC*/               NOT NULL
               ,DATA_SOURCE_ID CHAR( 10 ) /* CHARACTER SET LATIN*/               /* NOT CASESPECIFIC*/
               ,END_DT DATE
               ,UPD_TXF_BATCHTD INTEGER /* COMPRESS */
          ) DISTRIBUTE BY HASH (
               ACCOUNT_NUM
               ,ACCOUNT_MODIFIER_NUM
          )/* PARTITION BY (
               RANGE_N (
                    DATA_SOURCE_ID BETWEEN 'A'
                    ,'B'
                    ,'C'
                    ,'D'
                    ,'E'
                    ,'F'
                    ,'G'
                    ,'H'
                    ,'I'
                    ,'J'
                    ,'K'
                    ,'L'
                    ,'M'
                    ,'N'
                    ,'O'
                    ,'P'
                    ,'Q'
                    ,'R'
                    ,'S'
                    ,'T'
                    ,'U'
                    ,'V'
                    ,'W'
                    ,'X'
                    ,'Y'
                    ,'Z' AND 'ZZ'
                    ,NO RANGE
                    ,UNKNOWN
               )
               ,*/
/* CASE_N(END_DT IS NULL , NO CASE , UNKNOWN))  */
               ;
support.huaweicloud.com/tg-dws/dws_16_0072.html