andialbrecht / sqlparse

A non-validating SQL parser module for Python
BSD 3-Clause "New" or "Revised" License
3.77k stars 701 forks source link

hive sql indent incorrectly #495

Open melin opened 5 years ago

melin commented 5 years ago

image image


SELECT concat_ws(':', substring(md5(email), 1, 4), email, ds, evidence_time, id) AS PK,
       id AS ID,
       evidence_time COMMENT 'COMMENT' AS EVIDENCE_TIME,
                             risk_type COMMENT 'COMMENT' AS RISK_TYPE,
                                               subject_type COMMENT 'COMMENT' AS SUBJECT_TYPE,
                                                                    ROLE,
                                                                    if(industry IS NULL, 'all', industry) AS INDUSTRY,
                                                                    name COMMENT 'COMMENT' AS NAME,
                                                                                 id_number COMMENT 'COMMENT' AS ID_NUMBER,
                                                                                                   mobile COMMENT 'COMMENT' AS MOBILE,
                                                                                                                  fuzzy_id_number_type COMMENT 'COMMENT' AS FUZZY_ID_NUMBER_TYPE,
                                                                                                                                               fuzzy_mobile_type COMMENT 'COMMENT' AS FUZZY_MOBILE_TYPE,
                                                                                                                                                                         telephone AS TELEPHONE,
                                                                                                                                                                         qq_number COMMENT 'COMMENT' AS QQ_NUMBER,
                                                                                                                                                                                           card_number COMMENT 'COMMENT' AS CARD_NUMBER,
                                                                                                                                                                                                               email COMMENT 'COMMENT' AS EMAIL,
                                                                                                                                                                                                                             company COMMENT 'COMMENT' AS COMPANY,
                                                                                                                                                                                                                                             business_register_code COMMENT 'COMMENT' AS BUSINESS_REGISTER_CODE,
                                                                                                                                                                                                                                                                            org_code COMMENT 'COMMENT' AS ORG_CODE,
                                                                                                                                                                                                                                                                                             taxpayer_code COMMENT 'COMMENT' AS TAXPAYER_CODE,
                                                                                                                                                                                                                                                                                                                   tax_register_code COMMENT 'COMMENT' AS TAX_REGISTER_CODE,
                                                                                                                                                                                                                                                                                                                                             social_unified_credit_code COMMENT 'COMMENT' AS SOCIAL_UNIFIED_CREDIT_CODE,
                                                                                                                                                                                                                                                                                                                                                                                list_name COMMENT 'COMMENT' AS LIST_NAME,
                                                                                                                                                                                                                                                                                                                                                                                                  list_type COMMENT 'COMMENT' AS LIST_TYPE,
                                                                                                                                                                                                                                                                                                                                                                                                                    case_status COMMENT 'COMMENT' AS CASE_STATUS,
                                                                                                                                                                                                                                                                                                                                                                                                                                        case_character COMMENT 'COMMENT' AS CASE_CHARACTER,
                                                                                                                                                                                                                                                                                                                                                                                                                                                               case_type COMMENT 'COMMENT' AS CASE_TYPE,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 case_no COMMENT 'COMMENT' AS CASE_NO,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 exec_amount COMMENT 'COMMENT' AS EXEC_AMOUNT,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     partner_code COMMENT 'COMMENT' AS PARTNER_CODE,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          source_name COMMENT 'COMMENT' AS SOURCE_NAME,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              overdue_amount COMMENT 'COMMENT' AS OVERDUE_AMOUNT,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     overdue_days COMMENT 'COMMENT' AS OVERDUE_DAYS,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          overdue_counts COMMENT 'COMMENT' AS OVERDUE_COUNTS,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 repay_status COMMENT 'COMMENT' AS REPAY_STATUS,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      collection_risk_level COMMENT 'COMMENT' AS COLLECTION_RISK_LEVEL,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tax_type COMMENT 'COMMENT' AS TAX_TYPE,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     owe_tax_amount COMMENT 'COMMENT' AS OWE_TAX_AMOUNT,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            related_chain_score COMMENT 'COMMENT' AS RELATED_CHAIN_SCORE,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        risk_reject_counts COMMENT 'COMMENT' AS RISK_REJECT_COUNTS,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   role_in_litigation COMMENT 'COMMENT' AS ROLE_IN_LITIGATION,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              claim_in_case COMMENT 'COMMENT' AS CLAIM_IN_CASE,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    gmt_create COMMENT 'COMMENT' AS GMT_CREATE,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       gmt_modify COMMENT 'COMMENT' AS GMT_MODIFY,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          start_time COMMENT 'COMMENT' AS START_TIME,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             end_time COMMENT 'COMMENT' AS END_TIME,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              related_black_id_number COMMENT 'COMMENT' AS RELATED_BLACK_ID_NUMBER,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              related_black_mobile COMMENT 'COMMENT' AS RELATED_BLACK_MOBILE,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           tail_platform COMMENT 'COMMENT' AS TAIL_PLATFORM,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ds COMMENT 'COMMENT' AS DS
FROM eunomia_sh.dwb_cargo_index_middle_dt
WHERE ds != ''
    AND email IS NOT NULL
    AND email != ''
IterableTrucks commented 5 years ago

Some fixes needed in indentation of parenthesis .

melin commented 4 years ago

Some fixes needed in indentation of parenthesis .

is there a plan to fix the bug?