Package org.apache.flink.sql.parser
Class SqlParseUtils
- java.lang.Object
-
- org.apache.flink.sql.parser.SqlParseUtils
-
public class SqlParseUtils extends Object
Utils methods for parsing DDLs.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends Enum<T>>
TextractEnum(org.apache.calcite.sql.SqlLiteral literal, Class<T> enumClass)static List<String>extractList(org.apache.calcite.sql.SqlNodeList sqlNodeList, Function<org.apache.calcite.sql.SqlNode,String> mapper)static Map<String,String>extractMap(org.apache.calcite.sql.SqlNodeList propList)static Set<String>extractSet(org.apache.calcite.sql.SqlNodeList sqlNodeList, Function<org.apache.calcite.sql.SqlNode,String> mapper)static StringextractString(org.apache.calcite.sql.SqlLiteral literal)static StringextractString(org.apache.calcite.sql.SqlNode node)static LinkedHashMap<String,String>getPartitionKVs(org.apache.calcite.sql.SqlNodeList partitionSpec)Get static partition key value pair as strings.
-
-
-
Method Detail
-
getPartitionKVs
public static LinkedHashMap<String,String> getPartitionKVs(org.apache.calcite.sql.SqlNodeList partitionSpec)
Get static partition key value pair as strings.For character literals we return the unquoted and unescaped values. For other types we use
SqlNode.toString()to get the string format of the value literal.- Returns:
- the mapping of column names to values of partition specifications, returns an empty map if there is no partition specifications.
-
extractString
@Nullable public static String extractString(@Nullable org.apache.calcite.sql.SqlLiteral literal)
-
extractString
@Nullable public static String extractString(@Nullable org.apache.calcite.sql.SqlNode node)
-
extractMap
public static Map<String,String> extractMap(@Nullable org.apache.calcite.sql.SqlNodeList propList)
-
extractList
public static List<String> extractList(@Nullable org.apache.calcite.sql.SqlNodeList sqlNodeList, Function<org.apache.calcite.sql.SqlNode,String> mapper)
-
extractSet
public static Set<String> extractSet(@Nullable org.apache.calcite.sql.SqlNodeList sqlNodeList, Function<org.apache.calcite.sql.SqlNode,String> mapper)
-
-