Skip to content

[BUG] Presto方言下SQL格式化错误 #6631

@nixaxayox11-wq

Description

@nixaxayox11-wq

Database Type

Presto

Database Version

0.283

Druid Version

1.2.28

JDK Version

OpenJDK 21.0.7

Error SQL

select ext['c1'] from test.test_table

Testcase Code

import com.alibaba.druid.DbType;
import com.alibaba.druid.sql.SQLUtils;

public class DruidPrestoFormatBug {

@Test
void testDruidPrestoFormatBug() {
	String sql = "select ext['c1'] from test.test_table";
	String formatSQL = SQLUtils.format(sql, DbType.presto);
	System.out.println(formatSQL);
}

}

Stacktrace Info

No response

Error Info

Expected behavior
格式化后的 SQL 应该保持原始语义:
SELECT ext['c1'] FROM test.test_table

Actual behavior
底层表达式名丢失,变成了 ARRAY 关键字:
SELECT ARRAY['c1'] FROM test.test_table

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions