[GitHub] [hudi] ChestnutQiang commented on a diff in pull request #8449: [HUDI-6071] If the Flink Hive Catalog is used and the table type is B…

2023-04-17 Thread via GitHub


ChestnutQiang commented on code in PR #8449:
URL: https://github.com/apache/hudi/pull/8449#discussion_r1169409412


##
hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/util/TestExpressionUtils.java:
##
@@ -0,0 +1,166 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.hudi.util;
+
+import org.apache.flink.table.api.DataTypes;
+import org.apache.flink.table.expressions.CallExpression;
+import org.apache.flink.table.expressions.Expression;
+import org.apache.flink.table.expressions.FieldReferenceExpression;
+import org.apache.flink.table.expressions.ValueLiteralExpression;
+import org.apache.flink.table.functions.BuiltInFunctionDefinitions;
+import org.apache.flink.table.types.AtomicDataType;
+import org.apache.flink.table.types.DataType;
+import org.apache.flink.table.types.logical.BigIntType;
+import org.apache.flink.table.types.logical.BooleanType;
+import org.apache.flink.table.types.logical.DateType;
+import org.apache.flink.table.types.logical.DecimalType;
+import org.apache.flink.table.types.logical.DoubleType;
+import org.apache.flink.table.types.logical.FloatType;
+import org.apache.flink.table.types.logical.IntType;
+import org.apache.flink.table.types.logical.RowType;
+import org.apache.flink.table.types.logical.SmallIntType;
+import org.apache.flink.table.types.logical.TimeType;
+import org.apache.flink.table.types.logical.TimestampType;
+import org.apache.flink.table.types.logical.TinyIntType;
+import org.apache.flink.table.types.logical.VarBinaryType;
+import org.apache.flink.table.types.logical.VarCharType;
+import org.junit.jupiter.api.Test;
+
+import java.math.BigDecimal;
+import java.nio.charset.StandardCharsets;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.ZoneOffset;
+import java.time.temporal.ChronoField;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class TestExpressionUtils {
+
+  private static final DataType ROW_DATA_TYPE = DataTypes.ROW(
+  DataTypes.FIELD("f_tinyint", DataTypes.TINYINT()),
+  DataTypes.FIELD("f_smallint", DataTypes.SMALLINT()),
+  DataTypes.FIELD("f_int", DataTypes.INT()),
+  DataTypes.FIELD("f_long", DataTypes.BIGINT()),
+  DataTypes.FIELD("f_float", DataTypes.FLOAT()),
+  DataTypes.FIELD("f_double", DataTypes.DOUBLE()),
+  DataTypes.FIELD("f_boolean", DataTypes.BOOLEAN()),
+  DataTypes.FIELD("f_decimal", DataTypes.DECIMAL(10, 2)),
+  DataTypes.FIELD("f_bytes", DataTypes.VARBINARY(10)),
+  DataTypes.FIELD("f_string", DataTypes.VARCHAR(10)),
+  DataTypes.FIELD("f_time", DataTypes.TIME(3)),
+  DataTypes.FIELD("f_date", DataTypes.DATE()),
+  DataTypes.FIELD("f_timestamp", DataTypes.TIMESTAMP(3))
+  ).notNull();
+
+
+  private static final DataType ROW_DATA_TYPE_FIELD_NON_NULL = DataTypes.ROW(
+  DataTypes.FIELD("f_tinyint", new AtomicDataType(new TinyIntType(false))),

Review Comment:
   I've already fixed the DataType.notNull to construct the not nullable data 
type.
   @danny0405 



-- 
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: commits-unsubscr...@hudi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [hudi] ChestnutQiang commented on a diff in pull request #8449: [HUDI-6071] If the Flink Hive Catalog is used and the table type is B…

2023-04-17 Thread via GitHub


ChestnutQiang commented on code in PR #8449:
URL: https://github.com/apache/hudi/pull/8449#discussion_r1168372630


##
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/util/ExpressionUtils.java:
##
@@ -150,23 +150,27 @@ public static Object 
getValueFromLiteral(ValueLiteralExpression expr) {
 switch (logicalType.getTypeRoot()) {
   case TIMESTAMP_WITHOUT_TIME_ZONE:
 return expr.getValueAs(LocalDateTime.class)
-.map(ldt -> ldt.toInstant(ZoneOffset.UTC).toEpochMilli())
-.orElse(null);
+   .map(ldt -> ldt.toInstant(ZoneOffset.UTC).toEpochMilli())
+   .orElse(null);
   case TIME_WITHOUT_TIME_ZONE:
 return expr.getValueAs(LocalTime.class)
-.map(lt -> lt.get(ChronoField.MILLI_OF_DAY))
-.orElse(null);
+   .map(lt -> lt.get(ChronoField.MILLI_OF_DAY))
+   .orElse(null);

Review Comment:
   Redundant format revert ,
   But others will have problems modifying this file because it does not follow 
the check-style format。
   
   
   @danny0405



-- 
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: commits-unsubscr...@hudi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [hudi] ChestnutQiang commented on a diff in pull request #8449: [HUDI-6071] If the Flink Hive Catalog is used and the table type is B…

2023-04-17 Thread via GitHub


ChestnutQiang commented on code in PR #8449:
URL: https://github.com/apache/hudi/pull/8449#discussion_r1168363628


##
hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/util/TestExpressionUtils.java:
##
@@ -0,0 +1,166 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.hudi.util;
+
+import org.apache.flink.table.api.DataTypes;
+import org.apache.flink.table.expressions.CallExpression;
+import org.apache.flink.table.expressions.Expression;
+import org.apache.flink.table.expressions.FieldReferenceExpression;
+import org.apache.flink.table.expressions.ValueLiteralExpression;
+import org.apache.flink.table.functions.BuiltInFunctionDefinitions;
+import org.apache.flink.table.types.AtomicDataType;
+import org.apache.flink.table.types.DataType;
+import org.apache.flink.table.types.logical.BigIntType;
+import org.apache.flink.table.types.logical.BooleanType;
+import org.apache.flink.table.types.logical.DateType;
+import org.apache.flink.table.types.logical.DecimalType;
+import org.apache.flink.table.types.logical.DoubleType;
+import org.apache.flink.table.types.logical.FloatType;
+import org.apache.flink.table.types.logical.IntType;
+import org.apache.flink.table.types.logical.RowType;
+import org.apache.flink.table.types.logical.SmallIntType;
+import org.apache.flink.table.types.logical.TimeType;
+import org.apache.flink.table.types.logical.TimestampType;
+import org.apache.flink.table.types.logical.TinyIntType;
+import org.apache.flink.table.types.logical.VarBinaryType;
+import org.apache.flink.table.types.logical.VarCharType;
+import org.junit.jupiter.api.Test;
+
+import java.math.BigDecimal;
+import java.nio.charset.StandardCharsets;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.ZoneOffset;
+import java.time.temporal.ChronoField;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class TestExpressionUtils {
+
+  private static final DataType ROW_DATA_TYPE = DataTypes.ROW(
+  DataTypes.FIELD("f_tinyint", DataTypes.TINYINT()),
+  DataTypes.FIELD("f_smallint", DataTypes.SMALLINT()),
+  DataTypes.FIELD("f_int", DataTypes.INT()),
+  DataTypes.FIELD("f_long", DataTypes.BIGINT()),
+  DataTypes.FIELD("f_float", DataTypes.FLOAT()),
+  DataTypes.FIELD("f_double", DataTypes.DOUBLE()),
+  DataTypes.FIELD("f_boolean", DataTypes.BOOLEAN()),
+  DataTypes.FIELD("f_decimal", DataTypes.DECIMAL(10, 2)),
+  DataTypes.FIELD("f_bytes", DataTypes.VARBINARY(10)),
+  DataTypes.FIELD("f_string", DataTypes.VARCHAR(10)),
+  DataTypes.FIELD("f_time", DataTypes.TIME(3)),
+  DataTypes.FIELD("f_date", DataTypes.DATE()),
+  DataTypes.FIELD("f_timestamp", DataTypes.TIMESTAMP(3))
+  ).notNull();
+
+
+  private static final DataType ROW_DATA_TYPE_FIELD_NON_NULL = DataTypes.ROW(
+  DataTypes.FIELD("f_tinyint", new AtomicDataType(new TinyIntType(false))),

Review Comment:
   Redundant format revert @danny0405 



-- 
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: commits-unsubscr...@hudi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [hudi] ChestnutQiang commented on a diff in pull request #8449: [HUDI-6071] If the Flink Hive Catalog is used and the table type is B…

2023-04-17 Thread via GitHub


ChestnutQiang commented on code in PR #8449:
URL: https://github.com/apache/hudi/pull/8449#discussion_r1168353273


##
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/util/ExpressionUtils.java:
##
@@ -150,23 +150,27 @@ public static Object 
getValueFromLiteral(ValueLiteralExpression expr) {
 switch (logicalType.getTypeRoot()) {
   case TIMESTAMP_WITHOUT_TIME_ZONE:
 return expr.getValueAs(LocalDateTime.class)
-.map(ldt -> ldt.toInstant(ZoneOffset.UTC).toEpochMilli())
-.orElse(null);
+   .map(ldt -> ldt.toInstant(ZoneOffset.UTC).toEpochMilli())
+   .orElse(null);
   case TIME_WITHOUT_TIME_ZONE:
 return expr.getValueAs(LocalTime.class)
-.map(lt -> lt.get(ChronoField.MILLI_OF_DAY))
-.orElse(null);
+   .map(lt -> lt.get(ChronoField.MILLI_OF_DAY))
+   .orElse(null);

Review Comment:
   There is a problem with the submission format above, I follow the plugin 
'Save Actions' configured by the community docs, as long as I save, this place 
will be formatted.



##
hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/util/TestExpressionUtils.java:
##
@@ -0,0 +1,166 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.hudi.util;
+
+import org.apache.flink.table.api.DataTypes;
+import org.apache.flink.table.expressions.CallExpression;
+import org.apache.flink.table.expressions.Expression;
+import org.apache.flink.table.expressions.FieldReferenceExpression;
+import org.apache.flink.table.expressions.ValueLiteralExpression;
+import org.apache.flink.table.functions.BuiltInFunctionDefinitions;
+import org.apache.flink.table.types.AtomicDataType;
+import org.apache.flink.table.types.DataType;
+import org.apache.flink.table.types.logical.BigIntType;
+import org.apache.flink.table.types.logical.BooleanType;
+import org.apache.flink.table.types.logical.DateType;
+import org.apache.flink.table.types.logical.DecimalType;
+import org.apache.flink.table.types.logical.DoubleType;
+import org.apache.flink.table.types.logical.FloatType;
+import org.apache.flink.table.types.logical.IntType;
+import org.apache.flink.table.types.logical.RowType;
+import org.apache.flink.table.types.logical.SmallIntType;
+import org.apache.flink.table.types.logical.TimeType;
+import org.apache.flink.table.types.logical.TimestampType;
+import org.apache.flink.table.types.logical.TinyIntType;
+import org.apache.flink.table.types.logical.VarBinaryType;
+import org.apache.flink.table.types.logical.VarCharType;
+import org.junit.jupiter.api.Test;
+
+import java.math.BigDecimal;
+import java.nio.charset.StandardCharsets;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.ZoneOffset;
+import java.time.temporal.ChronoField;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class TestExpressionUtils {
+
+  private static final DataType ROW_DATA_TYPE = DataTypes.ROW(
+  DataTypes.FIELD("f_tinyint", DataTypes.TINYINT()),
+  DataTypes.FIELD("f_smallint", DataTypes.SMALLINT()),
+  DataTypes.FIELD("f_int", DataTypes.INT()),
+  DataTypes.FIELD("f_long", DataTypes.BIGINT()),
+  DataTypes.FIELD("f_float", DataTypes.FLOAT()),
+  DataTypes.FIELD("f_double", DataTypes.DOUBLE()),
+  DataTypes.FIELD("f_boolean", DataTypes.BOOLEAN()),
+  DataTypes.FIELD("f_decimal", DataTypes.DECIMAL(10, 2)),
+  DataTypes.FIELD("f_bytes", DataTypes.VARBINARY(10)),
+  DataTypes.FIELD("f_string", DataTypes.VARCHAR(10)),
+  DataTypes.FIELD("f_time", DataTypes.TIME(3)),
+  DataTypes.FIELD("f_date", DataTypes.DATE()),
+  DataTypes.FIELD("f_timestamp", DataTypes.TIMESTAMP(3))
+  ).notNull();
+
+
+  private static final DataType ROW_DATA_TYPE_FIELD_NON_NULL = DataTypes.ROW(
+  DataTypes.FIELD("f_tinyint", new AtomicDataType(new TinyIntType(false))),

Review Comment:
   @danny0405 



-- 
This is an automated message from the Apache Git Service.
To respond t

[GitHub] [hudi] ChestnutQiang commented on a diff in pull request #8449: [HUDI-6071] If the Flink Hive Catalog is used and the table type is B…

2023-04-17 Thread via GitHub


ChestnutQiang commented on code in PR #8449:
URL: https://github.com/apache/hudi/pull/8449#discussion_r1168347479


##
hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/util/TestExpressionUtils.java:
##
@@ -0,0 +1,166 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.hudi.util;
+
+import org.apache.flink.table.api.DataTypes;
+import org.apache.flink.table.expressions.CallExpression;
+import org.apache.flink.table.expressions.Expression;
+import org.apache.flink.table.expressions.FieldReferenceExpression;
+import org.apache.flink.table.expressions.ValueLiteralExpression;
+import org.apache.flink.table.functions.BuiltInFunctionDefinitions;
+import org.apache.flink.table.types.AtomicDataType;
+import org.apache.flink.table.types.DataType;
+import org.apache.flink.table.types.logical.BigIntType;
+import org.apache.flink.table.types.logical.BooleanType;
+import org.apache.flink.table.types.logical.DateType;
+import org.apache.flink.table.types.logical.DecimalType;
+import org.apache.flink.table.types.logical.DoubleType;
+import org.apache.flink.table.types.logical.FloatType;
+import org.apache.flink.table.types.logical.IntType;
+import org.apache.flink.table.types.logical.RowType;
+import org.apache.flink.table.types.logical.SmallIntType;
+import org.apache.flink.table.types.logical.TimeType;
+import org.apache.flink.table.types.logical.TimestampType;
+import org.apache.flink.table.types.logical.TinyIntType;
+import org.apache.flink.table.types.logical.VarBinaryType;
+import org.apache.flink.table.types.logical.VarCharType;
+import org.junit.jupiter.api.Test;
+
+import java.math.BigDecimal;
+import java.nio.charset.StandardCharsets;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.ZoneOffset;
+import java.time.temporal.ChronoField;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class TestExpressionUtils {
+
+  private static final DataType ROW_DATA_TYPE = DataTypes.ROW(
+  DataTypes.FIELD("f_tinyint", DataTypes.TINYINT()),
+  DataTypes.FIELD("f_smallint", DataTypes.SMALLINT()),
+  DataTypes.FIELD("f_int", DataTypes.INT()),
+  DataTypes.FIELD("f_long", DataTypes.BIGINT()),
+  DataTypes.FIELD("f_float", DataTypes.FLOAT()),
+  DataTypes.FIELD("f_double", DataTypes.DOUBLE()),
+  DataTypes.FIELD("f_boolean", DataTypes.BOOLEAN()),
+  DataTypes.FIELD("f_decimal", DataTypes.DECIMAL(10, 2)),
+  DataTypes.FIELD("f_bytes", DataTypes.VARBINARY(10)),
+  DataTypes.FIELD("f_string", DataTypes.VARCHAR(10)),
+  DataTypes.FIELD("f_time", DataTypes.TIME(3)),
+  DataTypes.FIELD("f_date", DataTypes.DATE()),
+  DataTypes.FIELD("f_timestamp", DataTypes.TIMESTAMP(3))
+  ).notNull();
+
+
+  private static final DataType ROW_DATA_TYPE_FIELD_NON_NULL = DataTypes.ROW(
+  DataTypes.FIELD("f_tinyint", new AtomicDataType(new TinyIntType(false))),

Review Comment:
   
   The following method verifies that using ROW_DATA_TYPE will result in an 
exception
   
   `new ValueLiteralExpression(dataList.get(i), dataTypes.get(i))`
   
   ```java
validateValueDataType(
 value, Preconditions.checkNotNull(dataType, "Data type must not be 
null."));
   
   private static void validateValueDataType(Object value, DataType dataType) {
   final LogicalType logicalType = dataType.getLogicalType();
   if (value == null) {
// --> there is a check  non-null  <-
   if (!logicalType.isNullable()) {  
   throw new ValidationException(
   String.format("Data type '%s' does not support null 
values.", dataType));
   }
   return;
   }
   
   if (logicalType.isNullable()) {
   throw new ValidationException(
   "Literals that have a non-null value must not have a 
nullable data type.");
   }
 ...
   }
   ```
   
   



-- 
This is an automated message from the Apache Git S

[GitHub] [hudi] ChestnutQiang commented on a diff in pull request #8449: [HUDI-6071] If the Flink Hive Catalog is used and the table type is B…

2023-04-16 Thread via GitHub


ChestnutQiang commented on code in PR #8449:
URL: https://github.com/apache/hudi/pull/8449#discussion_r1168193918


##
hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/util/ExpressionUtilsTest.java:
##
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.hudi.util;
+
+import org.apache.flink.table.api.DataTypes;
+import org.apache.flink.table.expressions.CallExpression;
+import org.apache.flink.table.expressions.Expression;
+import org.apache.flink.table.expressions.FieldReferenceExpression;
+import org.apache.flink.table.expressions.ValueLiteralExpression;
+import org.apache.flink.table.functions.BuiltInFunctionDefinitions;
+import org.apache.flink.table.types.DataType;
+import org.apache.flink.table.types.logical.RowType;
+import org.junit.jupiter.api.Test;
+
+import java.util.Arrays;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class ExpressionUtilsTest {
+

Review Comment:
   @danny0405



-- 
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: commits-unsubscr...@hudi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [hudi] ChestnutQiang commented on a diff in pull request #8449: [HUDI-6071] If the Flink Hive Catalog is used and the table type is B…

2023-04-16 Thread via GitHub


ChestnutQiang commented on code in PR #8449:
URL: https://github.com/apache/hudi/pull/8449#discussion_r1168173285


##
hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/util/ExpressionUtilsTest.java:
##
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.hudi.util;
+
+import org.apache.flink.table.api.DataTypes;
+import org.apache.flink.table.expressions.CallExpression;
+import org.apache.flink.table.expressions.Expression;
+import org.apache.flink.table.expressions.FieldReferenceExpression;
+import org.apache.flink.table.expressions.ValueLiteralExpression;
+import org.apache.flink.table.functions.BuiltInFunctionDefinitions;
+import org.apache.flink.table.types.DataType;
+import org.apache.flink.table.types.logical.RowType;
+import org.junit.jupiter.api.Test;
+
+import java.util.Arrays;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class ExpressionUtilsTest {
+

Review Comment:
   I have added tests for non null literals in TestExpressionUtils.



-- 
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: commits-unsubscr...@hudi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [hudi] ChestnutQiang commented on a diff in pull request #8449: [HUDI-6071] If the Flink Hive Catalog is used and the table type is B…

2023-04-13 Thread via GitHub


ChestnutQiang commented on code in PR #8449:
URL: https://github.com/apache/hudi/pull/8449#discussion_r1165610719


##
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/util/ExpressionUtils.java:
##
@@ -167,6 +167,8 @@ public static Object 
getValueFromLiteral(ValueLiteralExpression expr) {
   case SMALLINT:
   case INTEGER:
 return expr.getValueAs(Integer.class).orElse(null);
+  case BIGINT:
+return expr.getValueAs(Long.class).orElse(null);
   case FLOAT:
 return expr.getValueAs(Float.class).orElse(null);

Review Comment:
   I have added a unit test, please help me to check, thank you.



-- 
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: commits-unsubscr...@hudi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org