Skip to content
Permalink
Browse files
[fix](httpv2) make http v2 and v1 interface compatible (#7848)
http v2 TableSchemaAction adds the return value of aggregation_type,
and modifies the corresponding code of Flink/Spark Connector
  • Loading branch information
hf200012 committed Jan 31, 2022
1 parent 73b3d5c commit ea65872e1bf12e9a68c55bd909ec812c9b9696c8
Showing 4 changed files with 16 additions and 6 deletions.
@@ -33,7 +33,7 @@ public class SchemaUtils {
*/
public static Schema convertToSchema(List<TScanColumnDesc> tscanColumnDescs) {
Schema schema = new Schema(tscanColumnDescs.size());
tscanColumnDescs.stream().forEach(desc -> schema.put(new Field(desc.getName(), desc.getType().name(), "", 0, 0)));
tscanColumnDescs.stream().forEach(desc -> schema.put(new Field(desc.getName(), desc.getType().name(), "", 0, 0, "")));
return schema;
}
}
@@ -25,16 +25,26 @@ public class Field {
private String comment;
private int precision;
private int scale;
private String aggregation_type;

public Field() {
}

public Field(String name, String type, String comment, int precision, int scale) {
public Field(String name, String type, String comment, int precision, int scale, String aggregation_type) {
this.name = name;
this.type = type;
this.comment = comment;
this.precision = precision;
this.scale = scale;
this.aggregation_type = aggregation_type;
}

public String getAggregation_type() {
return aggregation_type;
}

public void setAggregation_type(String aggregation_type) {
this.aggregation_type = aggregation_type;
}

public String getName() {
@@ -58,8 +58,8 @@ public void setProperties(List<Field> properties) {
this.properties = properties;
}

public void put(String name, String type, String comment, int scale, int precision) {
properties.add(new Field(name, type, comment, scale, precision));
public void put(String name, String type, String comment, int scale, int precision, String aggregation_type) {
properties.add(new Field(name, type, comment, scale, precision, aggregation_type));
}

public void put(Field f) {
@@ -232,8 +232,8 @@ public void testRowBatch() throws Exception {
+ "\"name\":\"k4\",\"comment\":\"\"},{\"type\":\"FLOAT\",\"name\":\"k9\",\"comment\":\"\"},"
+ "{\"type\":\"DOUBLE\",\"name\":\"k8\",\"comment\":\"\"},{\"type\":\"DATE\",\"name\":\"k10\","
+ "\"comment\":\"\"},{\"type\":\"DATETIME\",\"name\":\"k11\",\"comment\":\"\"},"
+ "{\"name\":\"k5\",\"scale\":\"9\",\"comment\":\"\","
+ "\"type\":\"DECIMAL\",\"precision\":\"2\"},{\"type\":\"CHAR\",\"name\":\"k6\",\"comment\":\"\"}],"
+ "{\"name\":\"k5\",\"scale\":\"0\",\"comment\":\"\","
+ "\"type\":\"DECIMAL\",\"precision\":\"9\",\"aggregation_type\":\"\"},{\"type\":\"CHAR\",\"name\":\"k6\",\"comment\":\"\",\"aggregation_type\":\"REPLACE_IF_NOT_NULL\"}],"
+ "\"status\":200}";

Schema schema = RestService.parseSchema(schemaStr, logger);

0 comments on commit ea65872

Please sign in to comment.