Skip to content

Commit

Permalink
use coralsqldialect in trino reltosql
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinGe00 committed Jul 30, 2024
1 parent af0832c commit bd35f9a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/
package com.linkedin.coral.trino.rel2trino;

import com.linkedin.coral.transformers.CoralRelToSqlNodeConverter;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
Expand Down Expand Up @@ -34,6 +35,7 @@
import com.linkedin.coral.common.functions.FunctionFieldReferenceOperator;

import static com.google.common.base.Preconditions.*;
import static com.linkedin.coral.transformers.CoralRelToSqlNodeConverter.INSTANCE;
import static com.linkedin.coral.trino.rel2trino.CoralTrinoConfigKeys.*;


Expand All @@ -60,7 +62,7 @@ public class RelToTrinoConverter extends RelToSqlConverter {
* @param mscClient client interface used to interact with the Hive Metastore service.
*/
public RelToTrinoConverter(HiveMetastoreClient mscClient) {
super(TrinoSqlDialect.INSTANCE);
super(INSTANCE);
_hiveMetastoreClient = mscClient;
}

Expand All @@ -70,7 +72,7 @@ public RelToTrinoConverter(HiveMetastoreClient mscClient) {
* @param configs configs
*/
public RelToTrinoConverter(HiveMetastoreClient mscClient, Map<String, Boolean> configs) {
super(TrinoSqlDialect.INSTANCE);
super(INSTANCE);
checkNotNull(configs);
this.configs = configs;
_hiveMetastoreClient = mscClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ public void unparseCall(SqlWriter writer, SqlCall call, int leftPrec, int rightP
unparseMapValueConstructor(writer, call, leftPrec, rightPrec);
break;
default:
super.unparseCall(writer, call, leftPrec, rightPrec);
if (call.getOperator().getName().equals("timestamp_from_unixtime")) {
TIMESTAMP_FROM_UNIXTIME.unparse(writer, call, leftPrec, rightPrec);
} else {
super.unparseCall(writer, call, leftPrec, rightPrec);
}
}
}

Expand Down

0 comments on commit bd35f9a

Please sign in to comment.