druid hive 视图 sql 格式化解析错误

zd287kbt  于 2021-11-27  发布在  Java
关注(0)|答案(0)|浏览(464)

解析错误:

10:34:40.673 [main] WARN com.alibaba.druid.sql.SQLUtils - format error
com.alibaba.druid.sql.parser.ParserException: syntax error, error in :'MENT 'COMMENT' AS EVIDENCE_TIME,
', expect ON, actual LITERAL_CHARS pos 155, line 3, column 30, token LITERAL_CHARS COMMENT
	at com.alibaba.druid.sql.parser.SQLParser.printError(SQLParser.java:287)
	at com.alibaba.druid.sql.parser.SQLParser.accept(SQLParser.java:295)
	at com.alibaba.druid.sql.parser.SQLStatementParser.parseComment(SQLStatementParser.java:2787)
	at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:383)
	at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:171)
	at com.alibaba.druid.sql.SQLUtils.format(SQLUtils.java:286)
	at com.alibaba.druid.sql.SQLUtils.format(SQLUtils.java:272)
	at cn.tongdun.datacompute.parser.util.SqlUtils.sqlFormat(SqlUtils.kt:52)
	at cn.tongdun.datacompute.parser.util.SqlUtils.main(SqlUtils.kt:156)
10:34:40.677 [main] WARN com.alibaba.druid.sql.SQLUtils - format error
com.alibaba.druid.sql.parser.ParserException: syntax error, error in :'MENT 'COMMENT' AS EVIDENCE_TIME,
', expect ON, actual LITERAL_CHARS pos 155, line 3, column 30, token LITERAL_CHARS COMMENT
	at com.alibaba.druid.sql.parser.SQLParser.printError(SQLParser.java:287)
	at com.alibaba.druid.sql.parser.SQLParser.accept(SQLParser.java:295)
	at com.alibaba.druid.sql.parser.SQLStatementParser.parseComment(SQLStatementParser.java:2787)
	at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:383)
	at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:171)
	at com.alibaba.druid.sql.SQLUtils.format(SQLUtils.java:286)
	at com.alibaba.druid.sql.SQLUtils.format(SQLUtils.java:276)
	at cn.tongdun.datacompute.parser.util.SqlUtils.sqlFormat(SqlUtils.kt:53)
	at cn.tongdun.datacompute.parser.util.SqlUtils.main(SqlUtils.kt:156)
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 != ''

andialbrecht/sqlparse#495

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题