Skip to content

Commit

Permalink
Fix holo date expr support issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
lingo-xp authored and wenshao committed Jul 26, 2024
1 parent 283c34a commit c86912e
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/com/alibaba/druid/DbType.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public static DbType of(String name) {
}

public static boolean isPostgreSQLDbStyle(DbType dbType) {
return dbType == DbType.postgresql || dbType == DbType.edb || dbType == DbType.greenplum;
return dbType == DbType.postgresql || dbType == DbType.edb || dbType == DbType.greenplum || dbType == DbType.hologres;
}
public final boolean equals(String other) {
return this == of(other);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ public List<SQLObject> getChildren() {
DbType.presto,
DbType.trino,
DbType.postgresql,
DbType.hologres,
DbType.ads,
DbType.hive,
DbType.odps,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
public class HoloExprParser
extends PGExprParser {
public HoloExprParser(String sql, SQLParserFeature... features) {
super(sql, features);
super(new HoloLexer(sql, features));
this.lexer.nextToken();
dbType = DbType.hologres;
}

Expand Down
1 change: 1 addition & 0 deletions core/src/main/java/com/alibaba/druid/util/JdbcUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,7 @@ public static boolean isPgsqlDbType(DbType dbType) {
case polardb:
case greenplum:
case gaussdb:
case hologres:
return true;
default:
return false;
Expand Down
12 changes: 8 additions & 4 deletions core/src/test/resources/bvt/parser/hologres/0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ CREATE TABLE blink_demo (
id text
);
------------------------------------------------------------------------------------------------------------------------
create schema schemaname;
create schema schemaname
--------------------
CREATE SCHEMA schemaname;
CREATE SCHEMA schemaname
------------------------------------------------------------------------------------------------------------------------
set search_path to schemaname;
set search_path to schemaname
--------------------
SET search_path TO schemaname;
SET search_path TO schemaname
------------------------------------------------------------------------------------------------------------------------
select DATEADD(DATE '1970-01-01', 14238, 'dd')
--------------------
SELECT DATEADD(DATE '1970-01-01', 14238, 'dd')

0 comments on commit c86912e

Please sign in to comment.