twalthr commented on a change in pull request #18107:
URL: https://github.com/apache/flink/pull/18107#discussion_r769478798



##########
File path: 
flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/logical/SymbolType.java
##########
@@ -21,52 +21,57 @@
 import org.apache.flink.annotation.PublicEvolving;
 import org.apache.flink.table.api.TableException;
 import org.apache.flink.table.expressions.TableSymbol;
-import org.apache.flink.util.Preconditions;
 
 import java.util.Collections;
 import java.util.List;
-import java.util.Objects;
 
 /**
  * Logical type for representing symbol values. The symbol type is an 
extension to the SQL standard
  * and only serves as a helper type within the expression stack.
  *
- * <p>A symbol type only accepts conversions from and to its enum class.
+ * <p>A symbol type accepts conversions from and to {@link Enum}. But note 
that this is not an enum
+ * type for users.
  *
  * <p>This type has no serializable string representation.
  *
- * @param <T> table symbol
+ * @param <T> Legacy generic that will be dropped in the next major version. 
If we dropped it
+ *     earlier, we would break {@link LogicalTypeVisitor} implementation.
  */
+@SuppressWarnings("unused")
 @PublicEvolving
 public final class SymbolType<T extends TableSymbol> extends LogicalType {
-    private static final long serialVersionUID = 1L;
+    private static final long serialVersionUID = 2L;
 
-    private static final String FORMAT = "SYMBOL('%s')";
+    private static final String FORMAT = "SYMBOL";
 
-    private final Class<T> symbolClass;
+    /** @deprecated Symbol types have been simplified to not require a class. 
*/
+    @Deprecated
+    public SymbolType(boolean isNullable, Class<T> clazz) {
+        this(isNullable);
+    }
 
-    public SymbolType(boolean isNullable, Class<T> symbolClass) {
-        super(isNullable, LogicalTypeRoot.SYMBOL);
-        this.symbolClass =
-                Preconditions.checkNotNull(symbolClass, "Symbol class must not 
be null.");
+    /** @deprecated Symbol types have been simplified to not require a class. 
*/
+    @Deprecated
+    public SymbolType(Class<T> clazz) {
+        this();
     }
 
-    public SymbolType(Class<T> symbolClass) {
-        this(true, symbolClass);
+    public SymbolType(boolean isNullable) {
+        super(isNullable, LogicalTypeRoot.SYMBOL);
     }
 
-    public Class<T> getSymbolClass() {
-        return symbolClass;
+    public SymbolType() {
+        this(true);
     }

Review comment:
       Let's do this as a followup. We can do the same with `IntType` and many 
other predefined types. I was also thinking about reducing the creation of 
objects.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to