Skip to content

Commit

Permalink
support accept string/int/long Array on hqps engine,currently only fo…
Browse files Browse the repository at this point in the history
…r c++ procedure
  • Loading branch information
zhanglei1949 committed Dec 15, 2023
1 parent 975667e commit 0f36609
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
24 changes: 24 additions & 0 deletions flex/engines/graph_db/database/graph_db_session.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,30 @@ void put_argment(Encoder& encoder, const query::Argument& argment) {
case common::Value::kStr:
encoder.put_string(value.str());
break;
case common::Value::kStrArray:
encoder.put_int(value.str_array().item_size());
for (auto i = 0; i < value.str_array().item_size(); ++i) {
encoder.put_string(value.str_array().item(i));
}
break;
case common::Value::kF64Array:
encoder.put_int(value.f64_array().item_size());
for (auto i = 0; i < value.f64_array().item_size(); ++i) {
encoder.put_double(value.f64_array().item(i));
}
break;
case common::Value::kI32Array:
encoder.put_int(value.i32_array().item_size());
for (auto i = 0; i < value.i32_array().item_size(); ++i) {
encoder.put_int(value.i32_array().item(i));
}
break;
case common::Value::kI64Array:
encoder.put_int(value.i64_array().item_size());
for (auto i = 0; i < value.i64_array().item_size(); ++i) {
encoder.put_long(value.i64_array().item(i));
}
break;
default:
LOG(ERROR) << "Not recognizable param type" << static_cast<int>(item_case);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
package com.alibaba.graphscope.common.ir.meta.procedure;

import com.alibaba.graphscope.common.config.Configs;
import com.alibaba.graphscope.common.config.FrontendConfig;
import com.alibaba.graphscope.common.ir.type.GraphTypeFactoryImpl;
import com.google.common.collect.ImmutableBiMap;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;

import org.apache.calcite.jdbc.JavaTypeFactoryImpl;
import org.apache.calcite.rel.type.*;
import org.yaml.snakeyaml.Yaml;

Expand All @@ -33,7 +34,11 @@
import java.util.stream.Collectors;

public class StoredProcedureMeta {
private static final RelDataTypeFactory typeFactory = new JavaTypeFactoryImpl();
private static final RelDataTypeFactory typeFactory =
new GraphTypeFactoryImpl(
new Configs(
ImmutableMap.of(
FrontendConfig.CALCITE_DEFAULT_CHARSET.getKey(), "UTF-8")));

private final String name;
private final RelDataType returnType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ public List<InputStream> getStoredProcedures() throws IOException {
getProcedureNameWithInputStream(procedureDir);
for (String enableProcedure : enableProcedureList) {
InputStream enableInput = procedureInputMap.get(enableProcedure);
if (enableInput == null) {
logger.error("procedure not found {}", enableProcedure);
continue;
}
Preconditions.checkArgument(
enableInput != null,
"can not find procedure with name=%s under directory=%s, candidates are %s",
Expand Down

0 comments on commit 0f36609

Please sign in to comment.