Files
doris/be/src/exec/es/es_scroll_parser.h
qiye 7e9ffad933 [fix](ES catalog)Doris cannot parse ES date field without time zone (#24864)
1. Add support for Doris to parse ES date field without time zone info. eg: `2023-04-17T23:01:18.151`, this time will be treated as UTC time, since ES assumes that the time zone for time fields without time zones is UTC.
2. Change local time zone convertion from system local time zone to session variable time zone.
2023-10-08 19:28:08 +08:00

64 lines
2.2 KiB
C++

// 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.
#pragma once
#include <rapidjson/rapidjson.h>
#include <map>
#include <string>
#include <vector>
#include "rapidjson/document.h"
#include "vec/data_types/data_type.h"
namespace doris {
class Status;
class TupleDescriptor;
class ScrollParser {
public:
ScrollParser(bool doc_value_mode);
~ScrollParser();
Status parse(const std::string& scroll_result, bool exactly_once = false);
// Add time_zone info to convert time field of ES to local time zone of Doris
Status fill_columns(const TupleDescriptor* _tuple_desc,
std::vector<vectorized::MutableColumnPtr>& columns, bool* line_eof,
const std::map<std::string, std::string>& docvalue_context,
const cctz::time_zone& time_zone);
const std::string& get_scroll_id();
int get_size() const;
private:
std::string _scroll_id;
int _size;
rapidjson::SizeType _line_index;
rapidjson::Document _document_node;
rapidjson::Value _inner_hits_node;
// todo(milimin): ScrollParser should be divided into two classes: SourceParser and DocValueParser,
// including remove some variables in the current implementation, e.g. pure_doc_value.
// All above will be done in the DOE refactoring projects.
// Current bug fixes minimize the scope of changes to avoid introducing other new bugs.
// bool _doc_value_mode;
};
} // namespace doris