liuneng1994 commented on code in PR #5455:
URL: https://github.com/apache/incubator-gluten/pull/5455#discussion_r1592013619


##########
cpp-ch/local-engine/Functions/FunctionGetDateData.h:
##########
@@ -0,0 +1,171 @@
+/*
+ * 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.
+ */
+#include <Common/LocalDate.h>
+#include <Common/DateLUT.h>
+#include <Common/DateLUTImpl.h>
+#include <Columns/ColumnString.h>
+#include <Columns/ColumnVector.h>
+#include <Columns/ColumnNullable.h>
+#include <DataTypes/DataTypeNullable.h>
+#include <Functions/FunctionFactory.h>
+#include <IO/ReadBufferFromMemory.h>
+#include <IO/ReadHelpers.h>
+#include <IO/parseDateTimeBestEffort.h>
+
+using namespace DB;
+
+namespace DB
+{
+namespace ErrorCodes
+{
+    extern const int ILLEGAL_TYPE_OF_ARGUMENT;
+    extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
+}
+}
+
+namespace local_engine
+{
+template<bool get_year, bool get_date, typename T>
+class FunctionGetDateData : public DB::IFunction
+{
+public:
+    FunctionGetDateData() = default;
+    ~FunctionGetDateData() override = default;
+    bool checkAndGetDateData(DB::ReadBuffer & buf, size_t buf_size, T &x, 
const DateLUTImpl & date_lut, UInt8 & can_be_parsed) const
+    {
+        auto checkNumbericASCII = [&](DB::ReadBuffer & rb, size_t start, 
size_t length) -> bool
+        {
+            for (size_t i = start; i < start + length; ++i)
+            {
+                if (!isNumericASCII(*(rb.position() + i)))

Review Comment:
   对readbuffer内部缓冲区的访问,需要检查是否越界



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to