zstan commented on code in PR #13037:
URL: https://github.com/apache/ignite/pull/13037#discussion_r3115597918


##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/prepare/ddl/DdlSqlToCommandConverter.java:
##########
@@ -74,20 +75,40 @@
 import static 
org.apache.ignite.internal.processors.query.calcite.sql.IgniteSqlCreateTableOptionEnum.KEY_TYPE;
 import static 
org.apache.ignite.internal.processors.query.calcite.sql.IgniteSqlCreateTableOptionEnum.TEMPLATE;
 import static 
org.apache.ignite.internal.processors.query.calcite.sql.IgniteSqlCreateTableOptionEnum.VALUE_TYPE;
+import static 
org.apache.ignite.internal.processors.query.calcite.sql.IgniteSqlCreateTableOptionEnum.WRAP_KEY;
+import static 
org.apache.ignite.internal.processors.query.calcite.sql.IgniteSqlCreateTableOptionEnum.WRAP_VALUE;
 import static 
org.apache.ignite.internal.processors.query.calcite.sql.IgniteSqlCreateTableOptionEnum.WRITE_SYNCHRONIZATION_MODE;
 import static 
org.apache.ignite.internal.processors.query.calcite.util.PlanUtils.deriveObjectName;
 import static 
org.apache.ignite.internal.processors.query.calcite.util.PlanUtils.deriveSchemaName;
 
 /** */
 public class DdlSqlToCommandConverter {
+    /** */
+    private static final String SIMPLE_PREDICATE = "a simple identifier";
+
     /** Processor that validates a value is a Sql Identifier. */
     private static final BiFunction<IgniteSqlCreateTableOption, 
PlanningContext, String> VALUE_IS_IDENTIFIER_VALIDATOR = (opt, ctx) -> {
-        if (!(opt.value() instanceof SqlIdentifier) || 
!((SqlIdentifier)opt.value()).isSimple())
-            throwOptionParsingException(opt, "a simple identifier", 
ctx.query());
+        SqlNode val = opt.value();
+        if (!(val instanceof SqlIdentifier) || 
!((SqlIdentifier)val).isSimple())
+            throwOptionParsingException(opt, SIMPLE_PREDICATE, ctx.query());
 
-        return ((SqlIdentifier)opt.value()).getSimple();
+        return ((SqlIdentifier)val).getSimple();
     };
 
+    /** Processor that validates that value can be parsed as boolean. */
+    private static final BiFunction<IgniteSqlCreateTableOption, 
PlanningContext, Boolean> VALUE_IS_BOOL_IDENTIFIER_VALIDATOR =
+        (opt, ctx) -> {
+            SqlNode val = opt.value();
+            if (!(val instanceof SqlIdentifier) || 
!((SqlIdentifier)val).isSimple())
+                throwOptionParsingException(opt, SIMPLE_PREDICATE, 
ctx.query());
+
+            String simple = 
((SqlIdentifier)val).getSimple().toLowerCase(Locale.ROOT);
+            if (!"true".equals(simple) && !"false".equals(simple))

Review Comment:
   done



-- 
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