This is an automated email from the ASF dual-hosted git repository. jackie pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push: new 572d56d24e Add float type into literal thrift (#11697) 572d56d24e is described below commit 572d56d24e4eff3e461fc33a6a95d3eab54568e0 Author: Xiaotian (Jackie) Jiang <17555551+jackie-ji...@users.noreply.github.com> AuthorDate: Wed Sep 27 16:31:58 2023 -0700 Add float type into literal thrift (#11697) --- .../apache/pinot/common/request/BrokerRequest.java | 2 +- .../apache/pinot/common/request/DataSource.java | 2 +- .../apache/pinot/common/request/Expression.java | 2 +- .../pinot/common/request/ExpressionType.java | 2 +- .../org/apache/pinot/common/request/Function.java | 2 +- .../apache/pinot/common/request/Identifier.java | 2 +- .../pinot/common/request/InstanceRequest.java | 2 +- .../java/org/apache/pinot/common/request/Join.java | 2 +- .../org/apache/pinot/common/request/JoinType.java | 2 +- .../org/apache/pinot/common/request/Literal.java | 62 +++++++++++++++++++++- .../apache/pinot/common/request/PinotQuery.java | 2 +- .../apache/pinot/common/request/QuerySource.java | 2 +- .../pinot/common/response/ProcessingException.java | 2 +- pinot-common/src/thrift/query.thrift | 2 + 14 files changed, 74 insertions(+), 14 deletions(-) diff --git a/pinot-common/src/main/java/org/apache/pinot/common/request/BrokerRequest.java b/pinot-common/src/main/java/org/apache/pinot/common/request/BrokerRequest.java index cda2f3db9d..54d3edca6c 100644 --- a/pinot-common/src/main/java/org/apache/pinot/common/request/BrokerRequest.java +++ b/pinot-common/src/main/java/org/apache/pinot/common/request/BrokerRequest.java @@ -25,7 +25,7 @@ package org.apache.pinot.common.request; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) -@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-08-31") +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-09-27") public class BrokerRequest implements org.apache.thrift.TBase<BrokerRequest, BrokerRequest._Fields>, java.io.Serializable, Cloneable, Comparable<BrokerRequest> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("BrokerRequest"); diff --git a/pinot-common/src/main/java/org/apache/pinot/common/request/DataSource.java b/pinot-common/src/main/java/org/apache/pinot/common/request/DataSource.java index 7b9c20eea2..bb45e0ab7a 100644 --- a/pinot-common/src/main/java/org/apache/pinot/common/request/DataSource.java +++ b/pinot-common/src/main/java/org/apache/pinot/common/request/DataSource.java @@ -25,7 +25,7 @@ package org.apache.pinot.common.request; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) -@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-08-31") +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-09-27") public class DataSource implements org.apache.thrift.TBase<DataSource, DataSource._Fields>, java.io.Serializable, Cloneable, Comparable<DataSource> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("DataSource"); diff --git a/pinot-common/src/main/java/org/apache/pinot/common/request/Expression.java b/pinot-common/src/main/java/org/apache/pinot/common/request/Expression.java index 083b244b35..40683bd1b7 100644 --- a/pinot-common/src/main/java/org/apache/pinot/common/request/Expression.java +++ b/pinot-common/src/main/java/org/apache/pinot/common/request/Expression.java @@ -25,7 +25,7 @@ package org.apache.pinot.common.request; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) -@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-08-31") +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-09-27") public class Expression implements org.apache.thrift.TBase<Expression, Expression._Fields>, java.io.Serializable, Cloneable, Comparable<Expression> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Expression"); diff --git a/pinot-common/src/main/java/org/apache/pinot/common/request/ExpressionType.java b/pinot-common/src/main/java/org/apache/pinot/common/request/ExpressionType.java index 2b1a3a7945..16891a3386 100644 --- a/pinot-common/src/main/java/org/apache/pinot/common/request/ExpressionType.java +++ b/pinot-common/src/main/java/org/apache/pinot/common/request/ExpressionType.java @@ -25,7 +25,7 @@ package org.apache.pinot.common.request; -@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-08-31") +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-09-27") public enum ExpressionType implements org.apache.thrift.TEnum { LITERAL(0), IDENTIFIER(1), diff --git a/pinot-common/src/main/java/org/apache/pinot/common/request/Function.java b/pinot-common/src/main/java/org/apache/pinot/common/request/Function.java index 9c471f8e41..8055f29402 100644 --- a/pinot-common/src/main/java/org/apache/pinot/common/request/Function.java +++ b/pinot-common/src/main/java/org/apache/pinot/common/request/Function.java @@ -25,7 +25,7 @@ package org.apache.pinot.common.request; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) -@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-08-31") +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-09-27") public class Function implements org.apache.thrift.TBase<Function, Function._Fields>, java.io.Serializable, Cloneable, Comparable<Function> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Function"); diff --git a/pinot-common/src/main/java/org/apache/pinot/common/request/Identifier.java b/pinot-common/src/main/java/org/apache/pinot/common/request/Identifier.java index 36eeb344fe..d52140725a 100644 --- a/pinot-common/src/main/java/org/apache/pinot/common/request/Identifier.java +++ b/pinot-common/src/main/java/org/apache/pinot/common/request/Identifier.java @@ -25,7 +25,7 @@ package org.apache.pinot.common.request; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) -@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-08-31") +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-09-27") public class Identifier implements org.apache.thrift.TBase<Identifier, Identifier._Fields>, java.io.Serializable, Cloneable, Comparable<Identifier> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Identifier"); diff --git a/pinot-common/src/main/java/org/apache/pinot/common/request/InstanceRequest.java b/pinot-common/src/main/java/org/apache/pinot/common/request/InstanceRequest.java index 603925e129..24870f77be 100644 --- a/pinot-common/src/main/java/org/apache/pinot/common/request/InstanceRequest.java +++ b/pinot-common/src/main/java/org/apache/pinot/common/request/InstanceRequest.java @@ -25,7 +25,7 @@ package org.apache.pinot.common.request; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) -@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-08-31") +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-09-27") public class InstanceRequest implements org.apache.thrift.TBase<InstanceRequest, InstanceRequest._Fields>, java.io.Serializable, Cloneable, Comparable<InstanceRequest> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("InstanceRequest"); diff --git a/pinot-common/src/main/java/org/apache/pinot/common/request/Join.java b/pinot-common/src/main/java/org/apache/pinot/common/request/Join.java index acd305266c..bfe4ec3bbe 100644 --- a/pinot-common/src/main/java/org/apache/pinot/common/request/Join.java +++ b/pinot-common/src/main/java/org/apache/pinot/common/request/Join.java @@ -25,7 +25,7 @@ package org.apache.pinot.common.request; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) -@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-08-31") +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-09-27") public class Join implements org.apache.thrift.TBase<Join, Join._Fields>, java.io.Serializable, Cloneable, Comparable<Join> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Join"); diff --git a/pinot-common/src/main/java/org/apache/pinot/common/request/JoinType.java b/pinot-common/src/main/java/org/apache/pinot/common/request/JoinType.java index 6f08b2a2b0..e9d53f88f5 100644 --- a/pinot-common/src/main/java/org/apache/pinot/common/request/JoinType.java +++ b/pinot-common/src/main/java/org/apache/pinot/common/request/JoinType.java @@ -25,7 +25,7 @@ package org.apache.pinot.common.request; -@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-08-31") +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-09-27") public enum JoinType implements org.apache.thrift.TEnum { INNER(0), LEFT(1), diff --git a/pinot-common/src/main/java/org/apache/pinot/common/request/Literal.java b/pinot-common/src/main/java/org/apache/pinot/common/request/Literal.java index c0249aaf7d..9c442a091f 100644 --- a/pinot-common/src/main/java/org/apache/pinot/common/request/Literal.java +++ b/pinot-common/src/main/java/org/apache/pinot/common/request/Literal.java @@ -25,7 +25,7 @@ package org.apache.pinot.common.request; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) -@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-08-31") +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-09-27") public class Literal extends org.apache.thrift.TUnion<Literal, Literal._Fields> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Literal"); private static final org.apache.thrift.protocol.TField BOOL_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("boolValue", org.apache.thrift.protocol.TType.BOOL, (short)1); @@ -38,6 +38,7 @@ public class Literal extends org.apache.thrift.TUnion<Literal, Literal._Fields> private static final org.apache.thrift.protocol.TField BINARY_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("binaryValue", org.apache.thrift.protocol.TType.STRING, (short)8); private static final org.apache.thrift.protocol.TField NULL_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("nullValue", org.apache.thrift.protocol.TType.BOOL, (short)9); private static final org.apache.thrift.protocol.TField BIG_DECIMAL_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("bigDecimalValue", org.apache.thrift.protocol.TType.STRING, (short)10); + private static final org.apache.thrift.protocol.TField FLOAT_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("floatValue", org.apache.thrift.protocol.TType.I32, (short)11); /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { @@ -50,7 +51,8 @@ public class Literal extends org.apache.thrift.TUnion<Literal, Literal._Fields> STRING_VALUE((short)7, "stringValue"), BINARY_VALUE((short)8, "binaryValue"), NULL_VALUE((short)9, "nullValue"), - BIG_DECIMAL_VALUE((short)10, "bigDecimalValue"); + BIG_DECIMAL_VALUE((short)10, "bigDecimalValue"), + FLOAT_VALUE((short)11, "floatValue"); private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>(); @@ -86,6 +88,8 @@ public class Literal extends org.apache.thrift.TUnion<Literal, Literal._Fields> return NULL_VALUE; case 10: // BIG_DECIMAL_VALUE return BIG_DECIMAL_VALUE; + case 11: // FLOAT_VALUE + return FLOAT_VALUE; default: return null; } @@ -149,6 +153,8 @@ public class Literal extends org.apache.thrift.TUnion<Literal, Literal._Fields> new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); tmpMap.put(_Fields.BIG_DECIMAL_VALUE, new org.apache.thrift.meta_data.FieldMetaData("bigDecimalValue", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))); + tmpMap.put(_Fields.FLOAT_VALUE, new org.apache.thrift.meta_data.FieldMetaData("floatValue", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Literal.class, metaDataMap); } @@ -240,6 +246,12 @@ public class Literal extends org.apache.thrift.TUnion<Literal, Literal._Fields> return x; } + public static Literal floatValue(int value) { + Literal x = new Literal(); + x.setFloatValue(value); + return x; + } + @Override protected void checkType(_Fields setField, java.lang.Object value) throws java.lang.ClassCastException { @@ -294,6 +306,11 @@ public class Literal extends org.apache.thrift.TUnion<Literal, Literal._Fields> break; } throw new java.lang.ClassCastException("Was expecting value of type java.nio.ByteBuffer for field 'bigDecimalValue', but got " + value.getClass().getSimpleName()); + case FLOAT_VALUE: + if (value instanceof java.lang.Integer) { + break; + } + throw new java.lang.ClassCastException("Was expecting value of type java.lang.Integer for field 'floatValue', but got " + value.getClass().getSimpleName()); default: throw new java.lang.IllegalArgumentException("Unknown field id " + setField); } @@ -394,6 +411,15 @@ public class Literal extends org.apache.thrift.TUnion<Literal, Literal._Fields> org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); return null; } + case FLOAT_VALUE: + if (field.type == FLOAT_VALUE_FIELD_DESC.type) { + java.lang.Integer floatValue; + floatValue = iprot.readI32(); + return floatValue; + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); + return null; + } default: throw new java.lang.IllegalStateException("setField wasn't null, but didn't match any of the case statements!"); } @@ -446,6 +472,10 @@ public class Literal extends org.apache.thrift.TUnion<Literal, Literal._Fields> java.nio.ByteBuffer bigDecimalValue = (java.nio.ByteBuffer)value_; oprot.writeBinary(bigDecimalValue); return; + case FLOAT_VALUE: + java.lang.Integer floatValue = (java.lang.Integer)value_; + oprot.writeI32(floatValue); + return; default: throw new java.lang.IllegalStateException("Cannot write union with unknown field " + setField_); } @@ -496,6 +526,10 @@ public class Literal extends org.apache.thrift.TUnion<Literal, Literal._Fields> java.nio.ByteBuffer bigDecimalValue; bigDecimalValue = iprot.readBinary(); return bigDecimalValue; + case FLOAT_VALUE: + java.lang.Integer floatValue; + floatValue = iprot.readI32(); + return floatValue; default: throw new java.lang.IllegalStateException("setField wasn't null, but didn't match any of the case statements!"); } @@ -547,6 +581,10 @@ public class Literal extends org.apache.thrift.TUnion<Literal, Literal._Fields> java.nio.ByteBuffer bigDecimalValue = (java.nio.ByteBuffer)value_; oprot.writeBinary(bigDecimalValue); return; + case FLOAT_VALUE: + java.lang.Integer floatValue = (java.lang.Integer)value_; + oprot.writeI32(floatValue); + return; default: throw new java.lang.IllegalStateException("Cannot write union with unknown field " + setField_); } @@ -575,6 +613,8 @@ public class Literal extends org.apache.thrift.TUnion<Literal, Literal._Fields> return NULL_VALUE_FIELD_DESC; case BIG_DECIMAL_VALUE: return BIG_DECIMAL_VALUE_FIELD_DESC; + case FLOAT_VALUE: + return FLOAT_VALUE_FIELD_DESC; default: throw new java.lang.IllegalArgumentException("Unknown field id " + setField); } @@ -746,6 +786,19 @@ public class Literal extends org.apache.thrift.TUnion<Literal, Literal._Fields> value_ = java.util.Objects.requireNonNull(value,"_Fields.BIG_DECIMAL_VALUE"); } + public int getFloatValue() { + if (getSetField() == _Fields.FLOAT_VALUE) { + return (java.lang.Integer)getFieldValue(); + } else { + throw new java.lang.RuntimeException("Cannot get field 'floatValue' because union is currently set to " + getFieldDesc(getSetField()).name); + } + } + + public void setFloatValue(int value) { + setField_ = _Fields.FLOAT_VALUE; + value_ = value; + } + public boolean isSetBoolValue() { return setField_ == _Fields.BOOL_VALUE; } @@ -796,6 +849,11 @@ public class Literal extends org.apache.thrift.TUnion<Literal, Literal._Fields> } + public boolean isSetFloatValue() { + return setField_ == _Fields.FLOAT_VALUE; + } + + public boolean equals(java.lang.Object other) { if (other instanceof Literal) { return equals((Literal)other); diff --git a/pinot-common/src/main/java/org/apache/pinot/common/request/PinotQuery.java b/pinot-common/src/main/java/org/apache/pinot/common/request/PinotQuery.java index d947b6bd31..8bc9113e95 100644 --- a/pinot-common/src/main/java/org/apache/pinot/common/request/PinotQuery.java +++ b/pinot-common/src/main/java/org/apache/pinot/common/request/PinotQuery.java @@ -25,7 +25,7 @@ package org.apache.pinot.common.request; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) -@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-08-31") +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-09-27") public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuery._Fields>, java.io.Serializable, Cloneable, Comparable<PinotQuery> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("PinotQuery"); diff --git a/pinot-common/src/main/java/org/apache/pinot/common/request/QuerySource.java b/pinot-common/src/main/java/org/apache/pinot/common/request/QuerySource.java index 4035ea9b87..c65e2fbbb3 100644 --- a/pinot-common/src/main/java/org/apache/pinot/common/request/QuerySource.java +++ b/pinot-common/src/main/java/org/apache/pinot/common/request/QuerySource.java @@ -25,7 +25,7 @@ package org.apache.pinot.common.request; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) -@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-08-31") +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-09-27") public class QuerySource implements org.apache.thrift.TBase<QuerySource, QuerySource._Fields>, java.io.Serializable, Cloneable, Comparable<QuerySource> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("QuerySource"); diff --git a/pinot-common/src/main/java/org/apache/pinot/common/response/ProcessingException.java b/pinot-common/src/main/java/org/apache/pinot/common/response/ProcessingException.java index 32b74a7fe8..68a7b37816 100644 --- a/pinot-common/src/main/java/org/apache/pinot/common/response/ProcessingException.java +++ b/pinot-common/src/main/java/org/apache/pinot/common/response/ProcessingException.java @@ -29,7 +29,7 @@ package org.apache.pinot.common.response; * Processing exception * */ -@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-08-31") +@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-09-27") public class ProcessingException extends org.apache.thrift.TException implements org.apache.thrift.TBase<ProcessingException, ProcessingException._Fields>, java.io.Serializable, Cloneable, Comparable<ProcessingException> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ProcessingException"); diff --git a/pinot-common/src/thrift/query.thrift b/pinot-common/src/thrift/query.thrift index 946a37eb27..a88f964e73 100644 --- a/pinot-common/src/thrift/query.thrift +++ b/pinot-common/src/thrift/query.thrift @@ -79,6 +79,8 @@ union Literal { // Set to true when the literal value is a null. 9: optional bool nullValue; 10: optional binary bigDecimalValue; + // Use i32 to represent float since there is no native float type + 11: optional i32 floatValue; } struct Identifier { --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org