123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564 |
- #include <yql/essentials/parser/pg_wrapper/interface/interface.h>
- #include <yql/essentials/minikql/computation/mkql_computation_node_pack_impl.h>
- #include <yql/essentials/minikql/mkql_buffer.h>
- namespace NSQLTranslationPG {
- NYql::TAstParseResult PGToYql(const TString& query, const NSQLTranslation::TTranslationSettings& settings, NYql::TStmtParseInfo* stmtParseInfo) {
- Y_UNUSED(query);
- Y_UNUSED(settings);
- Y_UNUSED(stmtParseInfo);
- NYql::TAstParseResult result;
- result.Issues.AddIssue(NYql::TIssue("PostgreSQL parser is not available"));
- return result;
- }
- TVector<NYql::TAstParseResult> PGToYqlStatements(const TString& query, const NSQLTranslation::TTranslationSettings& settings, TVector<NYql::TStmtParseInfo>* stmtParseInfo) {
- Y_UNUSED(query);
- Y_UNUSED(settings);
- Y_UNUSED(stmtParseInfo);
- return {};
- }
- std::unique_ptr<NYql::NPg::IExtensionSqlParser> CreateExtensionSqlParser() {
- throw yexception() << "CreateExtensionSqlParser: PG types are not supported";
- }
- std::unique_ptr<NYql::NPg::ISystemFunctionsParser> CreateSystemFunctionsParser() {
- throw yexception() << "CreateSystemFunctionsParser: PG types are not supported";
- }
- std::unique_ptr<NYql::NPg::ISqlLanguageParser> CreateSqlLanguageParser() {
- throw yexception() << "CreateSqlLanguageParser: PG types are not supported";
- }
- } // NSQLTranslationPG
- namespace NYql {
- namespace NCommon {
- TString PgValueToString(const NUdf::TUnboxedValuePod& value, ui32 pgTypeId) {
- Y_UNUSED(value);
- Y_UNUSED(pgTypeId);
- throw yexception() << "PgValueToString: PG types are not supported";
- }
- NUdf::TUnboxedValue PgValueFromString(const TStringBuf text, ui32 pgTypeId) {
- Y_UNUSED(text);
- Y_UNUSED(pgTypeId);
- throw yexception() << "PgValueFromString: PG types are not supported";
- }
- TString PgValueToNativeText(const NUdf::TUnboxedValuePod& value, ui32 pgTypeId) {
- Y_UNUSED(value);
- Y_UNUSED(pgTypeId);
- throw yexception() << "PgValueToNativeText: PG types are not supported";
- }
- NUdf::TUnboxedValue PgValueFromNativeText(const TStringBuf text, ui32 pgTypeId) {
- Y_UNUSED(text);
- Y_UNUSED(pgTypeId);
- throw yexception() << "PgValueFromNativeText: PG types are not supported";
- }
- TString PgValueToNativeBinary(const NUdf::TUnboxedValuePod& value, ui32 pgTypeId) {
- Y_UNUSED(value);
- Y_UNUSED(pgTypeId);
- throw yexception() << "PgValueToNativeBinary: PG types are not supported";
- }
- NUdf::TUnboxedValue PgValueFromNativeBinary(const TStringBuf binary, ui32 pgTypeId) {
- Y_UNUSED(binary);
- Y_UNUSED(pgTypeId);
- throw yexception() << "PgValueFromNativeBinary: PG types are not supported";
- }
- TString PgValueCoerce(const NUdf::TUnboxedValuePod& value, ui32 pgTypeId, i32 typMod, TMaybe<TString>* error) {
- Y_UNUSED(value);
- Y_UNUSED(pgTypeId);
- Y_UNUSED(typMod);
- Y_UNUSED(error);
- throw yexception() << "PgValueCoerce: PG types are not supported";
- }
- void WriteYsonValuePg(NResult::TYsonResultWriter& writer, const NUdf::TUnboxedValuePod& value, NKikimr::NMiniKQL::TPgType* type,
- const TVector<ui32>* structPositions) {
- Y_UNUSED(writer);
- Y_UNUSED(value);
- Y_UNUSED(type);
- Y_UNUSED(structPositions);
- throw yexception() << "WriteYsonValuePg: PG types are not supported";
- }
- void WriteYsonValueInTableFormatPg(TOutputBuf& buf, NKikimr::NMiniKQL::TPgType* type, const NKikimr::NUdf::TUnboxedValuePod& value, bool topLevel) {
- Y_UNUSED(buf);
- Y_UNUSED(type);
- Y_UNUSED(value);
- Y_UNUSED(topLevel);
- throw yexception() << "WriteYsonValueInTableFormatPg: PG types are not supported";
- }
- NUdf::TUnboxedValue ReadYsonValueInTableFormatPg(NKikimr::NMiniKQL::TPgType* type, char cmd, TInputBuf& buf) {
- Y_UNUSED(type);
- Y_UNUSED(cmd);
- Y_UNUSED(buf);
- throw yexception() << "ReadYsonValueInTableFormatPg: PG types are not supported";
- }
- NUdf::TUnboxedValue ReadYsonValuePg(NKikimr::NMiniKQL::TPgType* type, char cmd, TInputBuf& buf) {
- Y_UNUSED(type);
- Y_UNUSED(cmd);
- Y_UNUSED(buf);
- throw yexception() << "ReadYsonValuePg: PG types are not supported";
- }
- void SkipSkiffPg(NKikimr::NMiniKQL::TPgType* type, NCommon::TInputBuf& buf) {
- Y_UNUSED(type);
- Y_UNUSED(buf);
- throw yexception() << "SkipSkiffPg: PG types are not supported";
- }
- NKikimr::NUdf::TUnboxedValue ReadSkiffPg(NKikimr::NMiniKQL::TPgType* type, NCommon::TInputBuf& buf) {
- Y_UNUSED(type);
- Y_UNUSED(buf);
- throw yexception() << "ReadSkiffPg: PG types are not supported";
- }
- void WriteSkiffPg(NKikimr::NMiniKQL::TPgType* type, const NKikimr::NUdf::TUnboxedValuePod& value, NCommon::TOutputBuf& buf) {
- Y_UNUSED(type);
- Y_UNUSED(value);
- Y_UNUSED(buf);
- throw yexception() << "WriteSkiffPg: PG types are not supported";
- }
- extern "C" void ReadSkiffPgValue(NKikimr::NMiniKQL::TPgType* type, NKikimr::NUdf::TUnboxedValue& value, NCommon::TInputBuf& buf) {
- Y_UNUSED(type);
- Y_UNUSED(value);
- Y_UNUSED(buf);
- throw yexception() << "ReadSkiffPgValue: PG types are not supported";
- }
- extern "C" void WriteSkiffPgValue(NKikimr::NMiniKQL::TPgType* type, const NKikimr::NUdf::TUnboxedValuePod& value, NCommon::TOutputBuf& buf) {
- Y_UNUSED(type);
- Y_UNUSED(value);
- Y_UNUSED(buf);
- throw yexception() << "WriteSkiffPgValue: PG types are not supported";
- }
- } // namespace NCommon
- } // NYql
- namespace NKikimr {
- namespace NMiniKQL {
- void* PgInitializeMainContext() {
- return nullptr;
- }
- void PgDestroyMainContext(void* ctx) {
- Y_UNUSED(ctx);
- }
- void PgAcquireThreadContext(void* ctx) {
- Y_UNUSED(ctx);
- }
- void PgReleaseThreadContext(void* ctx) {
- Y_UNUSED(ctx);
- }
- void PgSetGUCSettings(void* ctx, const TGUCSettings::TPtr& GUCSettings) {
- Y_UNUSED(ctx);
- Y_UNUSED(GUCSettings);
- }
- std::unique_ptr<NYql::NPg::IExtensionLoader> CreateExtensionLoader() {
- throw yexception() << "PG types are not supported";
- }
- std::optional<std::string> PGGetGUCSetting(const std::string& key) {
- Y_UNUSED(key);
- throw yexception() << "PG types are not supported";
- }
- ui64 PgValueSize(const NUdf::TUnboxedValuePod& value, i32 typeLen) {
- Y_UNUSED(typeLen);
- Y_UNUSED(value);
- throw yexception() << "PG types are not supported";
- }
- ui64 PgValueSize(ui32 type, const NUdf::TUnboxedValuePod& value) {
- Y_UNUSED(type);
- Y_UNUSED(value);
- throw yexception() << "PG types are not supported";
- }
- ui64 PgValueSize(const TPgType* type, const NUdf::TUnboxedValuePod& value) {
- Y_UNUSED(type);
- Y_UNUSED(value);
- throw yexception() << "PG types are not supported";
- }
- void PGPackImpl(bool stable, const TPgType* type, const NUdf::TUnboxedValuePod& value, TBuffer& buf) {
- Y_UNUSED(stable);
- Y_UNUSED(type);
- Y_UNUSED(value);
- Y_UNUSED(buf);
- throw yexception() << "PG types are not supported";
- }
- void PGPackImpl(bool stable, const TPgType* type, const NUdf::TUnboxedValuePod& value, NKikimr::NMiniKQL::TPagedBuffer& buf) {
- Y_UNUSED(stable);
- Y_UNUSED(type);
- Y_UNUSED(value);
- Y_UNUSED(buf);
- throw yexception() << "PG types are not supported";
- }
- NUdf::TUnboxedValue PGUnpackImpl(const TPgType* type, TStringBuf& buf) {
- Y_UNUSED(type);
- Y_UNUSED(buf);
- throw yexception() << "PG types are not supported";
- }
- NUdf::TUnboxedValue PGUnpackImpl(const TPgType* type, NDetails::TChunkedInputBuffer& buf) {
- Y_UNUSED(type);
- Y_UNUSED(buf);
- throw yexception() << "PG types are not supported";
- }
- void EncodePresortPGValue(TPgType* type, const NUdf::TUnboxedValue& value, TVector<ui8>& output) {
- Y_UNUSED(type);
- Y_UNUSED(value);
- Y_UNUSED(output);
- throw yexception() << "PG types are not supported";
- }
- NUdf::TUnboxedValue DecodePresortPGValue(TPgType* type, TStringBuf& input, TVector<ui8>& buffer) {
- Y_UNUSED(type);
- Y_UNUSED(input);
- Y_UNUSED(buffer);
- throw yexception() << "PG types are not supported";
- }
- void* PgInitializeContext(const std::string_view& contextType) {
- Y_UNUSED(contextType);
- return nullptr;
- }
- void PgDestroyContext(const std::string_view& contextType, void* ctx) {
- Y_UNUSED(contextType);
- Y_UNUSED(ctx);
- }
- NUdf::IHash::TPtr MakePgHash(const NMiniKQL::TPgType* type) {
- Y_UNUSED(type);
- throw yexception() << "PG types are not supported";
- }
- NUdf::ICompare::TPtr MakePgCompare(const NMiniKQL::TPgType* type) {
- Y_UNUSED(type);
- throw yexception() << "PG types are not supported";
- }
- NUdf::IEquate::TPtr MakePgEquate(const NMiniKQL::TPgType* type) {
- Y_UNUSED(type);
- throw yexception() << "PG types are not supported";
- }
- NUdf::IBlockItemComparator::TPtr MakePgItemComparator(ui32 typeId) {
- Y_UNUSED(typeId);
- throw yexception() << "PG types are not supported";
- }
- NUdf::IBlockItemHasher::TPtr MakePgItemHasher(ui32 typeId) {
- Y_UNUSED(typeId);
- throw yexception() << "PG types are not supported";
- }
- void RegisterPgBlockAggs(THashMap<TString, std::unique_ptr<IBlockAggregatorFactory>>& registry) {
- Y_UNUSED(registry);
- }
- } // namespace NMiniKQL
- } // namespace NKikimr
- namespace NYql {
- arrow::Datum MakePgScalar(NKikimr::NMiniKQL::TPgType* type, const NKikimr::NUdf::TUnboxedValuePod& value, arrow::MemoryPool& pool) {
- Y_UNUSED(type);
- Y_UNUSED(value);
- Y_UNUSED(pool);
- return arrow::Datum();
- }
- arrow::Datum MakePgScalar(NKikimr::NMiniKQL::TPgType* type, const NUdf::TBlockItem& value, arrow::MemoryPool& pool) {
- Y_UNUSED(type);
- Y_UNUSED(value);
- Y_UNUSED(pool);
- return arrow::Datum();
- }
- TColumnConverter BuildPgColumnConverter(const std::shared_ptr<arrow::DataType>& originalType, NKikimr::NMiniKQL::TPgType* targetType) {
- Y_UNUSED(originalType);
- Y_UNUSED(targetType);
- return {};
- }
- ui32 ConvertToPgType(NKikimr::NUdf::EDataSlot slot) {
- Y_UNUSED(slot);
- throw yexception() << "PG types are not supported";
- }
- TMaybe<NKikimr::NUdf::EDataSlot> ConvertFromPgType(ui32 typeId) {
- Y_UNUSED(typeId);
- return Nothing();
- }
- bool ParsePgIntervalModifier(const TString& str, i32& ret) {
- Y_UNUSED(str);
- Y_UNUSED(ret);
- return false;
- }
- class TPgDummyBuilder : public NUdf::IPgBuilder {
- public:
- NUdf::TUnboxedValue ValueFromText(ui32 typeId, const NUdf::TStringRef& value, NUdf::TStringValue& error) const override {
- Y_UNUSED(typeId);
- Y_UNUSED(value);
- error = NUdf::TStringValue(TStringBuf("TPgDummyBuilder::ValueFromText does nothing"));
- return NUdf::TUnboxedValue();
- }
- NUdf::TUnboxedValue ValueFromBinary(ui32 typeId, const NUdf::TStringRef& value, NUdf::TStringValue& error) const override {
- Y_UNUSED(typeId);
- Y_UNUSED(value);
- error = NUdf::TStringValue(TStringBuf("TPgDummyBuilder::ValueFromBinary does nothing"));
- return NUdf::TUnboxedValue();
- }
- NUdf::TUnboxedValue ConvertFromPg(NUdf::TUnboxedValue source, ui32 sourceTypeId, const NUdf::TType* targetType) const override {
- Y_UNUSED(source);
- Y_UNUSED(sourceTypeId);
- Y_UNUSED(targetType);
- ythrow yexception() << "TPgDummyBuilder::ConvertFromPg does nothing";
- }
- NUdf::TUnboxedValue ConvertToPg(NUdf::TUnboxedValue source, const NUdf::TType* sourceType, ui32 targetTypeId) const override {
- Y_UNUSED(source);
- Y_UNUSED(sourceType);
- Y_UNUSED(targetTypeId);
- ythrow yexception() << "TPgDummyBuilder::ConvertToPg does nothing";
- }
- NUdf::TUnboxedValue NewString(i32 typeLen, ui32 targetTypeId, NUdf::TStringRef data) const override {
- Y_UNUSED(typeLen);
- Y_UNUSED(targetTypeId);
- Y_UNUSED(data);
- ythrow yexception() << "TPgDummyBuilder::NewString does nothing";
- }
- NUdf::TStringRef AsCStringBuffer(const NUdf::TUnboxedValue& value) const override {
- Y_UNUSED(value);
- ythrow yexception() << "TPgDummyBuilder::AsCStringBuffer does nothing";
- }
- NUdf::TStringRef AsTextBuffer(const NUdf::TUnboxedValue& value) const override {
- Y_UNUSED(value);
- ythrow yexception() << "TPgDummyBuilder::AsTextBuffer does nothing";
- }
- NUdf::TUnboxedValue MakeCString(const char* value) const override {
- Y_UNUSED(value);
- ythrow yexception() << "TPgDummyBuilder::MakeCString does nothing";
- }
- NUdf::TUnboxedValue MakeText(const char* value) const override {
- Y_UNUSED(value);
- ythrow yexception() << "TPgDummyBuilder::MakeText does nothing";
- }
- NUdf::TStringRef AsFixedStringBuffer(const NUdf::TUnboxedValue& value, ui32 length) const override {
- Y_UNUSED(value);
- Y_UNUSED(length);
- ythrow yexception() << "TPgDummyBuilder::AsFixedStringBuffer does nothing";
- }
- };
- std::unique_ptr<NUdf::IPgBuilder> CreatePgBuilder() {
- return std::make_unique<TPgDummyBuilder>();
- }
- bool HasPgKernel(ui32 procOid) {
- Y_UNUSED(procOid);
- return false;
- }
- std::function<NKikimr::NMiniKQL::IComputationNode* (NKikimr::NMiniKQL::TCallable&,
- const NKikimr::NMiniKQL::TComputationNodeFactoryContext&)> GetPgFactory()
- {
- return [] (
- NKikimr::NMiniKQL::TCallable& callable,
- const NKikimr::NMiniKQL::TComputationNodeFactoryContext& ctx
- ) -> NKikimr::NMiniKQL::IComputationNode* {
- Y_UNUSED(callable);
- Y_UNUSED(ctx);
- return nullptr;
- };
- }
- IOptimizer* MakePgOptimizerInternal(const IOptimizer::TInput& input, const std::function<void(const TString&)>& log)
- {
- Y_UNUSED(input);
- Y_UNUSED(log);
- ythrow yexception() << "PgJoinSearch does nothing";
- }
- IOptimizerNew* MakePgOptimizerNew(IProviderContext& pctx, TExprContext& ctx, const std::function<void(const TString&)>& log)
- {
- Y_UNUSED(pctx);
- Y_UNUSED(ctx);
- Y_UNUSED(log);
- ythrow yexception() << "PgJoinSearch does nothing";
- }
- } // NYql
- namespace NKikimr::NPg {
- ui32 PgTypeIdFromTypeDesc(const ITypeDesc* typeDesc) {
- Y_UNUSED(typeDesc);
- return 0;
- }
- const ITypeDesc* TypeDescFromPgTypeId(ui32 pgTypeId) {
- Y_UNUSED(pgTypeId);
- return {};
- }
- TString PgTypeNameFromTypeDesc(const ITypeDesc* typeDesc, const TString& typeMod) {
- Y_UNUSED(typeDesc);
- Y_UNUSED(typeMod);
- return "";
- }
- const ITypeDesc* TypeDescFromPgTypeName(const TStringBuf name) {
- Y_UNUSED(name);
- return {};
- }
- TString TypeModFromPgTypeName(const TStringBuf name) {
- Y_UNUSED(name);
- return {};
- }
- bool TypeDescIsComparable(const ITypeDesc* typeDesc) {
- Y_UNUSED(typeDesc);
- throw yexception() << "PG types are not supported";
- }
- i32 TypeDescGetTypeLen(const ITypeDesc* typeDesc) {
- Y_UNUSED(typeDesc);
- throw yexception() << "PG types are not supported";
- }
- ui32 TypeDescGetStoredSize(const ITypeDesc* typeDesc) {
- Y_UNUSED(typeDesc);
- throw yexception() << "PG types are not supported";
- }
- bool TypeDescNeedsCoercion(const ITypeDesc* typeDesc) {
- Y_UNUSED(typeDesc);
- throw yexception() << "PG types are not supported";
- }
- int PgNativeBinaryCompare(const char* dataL, size_t sizeL, const char* dataR, size_t sizeR, const ITypeDesc* typeDesc) {
- Y_UNUSED(dataL);
- Y_UNUSED(sizeL);
- Y_UNUSED(dataR);
- Y_UNUSED(sizeR);
- Y_UNUSED(typeDesc);
- throw yexception() << "PG types are not supported";
- }
- ui64 PgNativeBinaryHash(const char* data, size_t size, const ITypeDesc* typeDesc) {
- Y_UNUSED(data);
- Y_UNUSED(size);
- Y_UNUSED(typeDesc);
- throw yexception() << "PG types are not supported";
- }
- TTypeModResult BinaryTypeModFromTextTypeMod(const TString& str, const ITypeDesc* typeDesc) {
- Y_UNUSED(str);
- Y_UNUSED(typeDesc);
- throw yexception() << "PG types are not supported";
- }
- TMaybe<TString> PgNativeBinaryValidate(const TStringBuf binary, const ITypeDesc* typeDesc) {
- Y_UNUSED(binary);
- Y_UNUSED(typeDesc);
- throw yexception() << "PG types are not supported";
- }
- TCoerceResult PgNativeBinaryCoerce(const TStringBuf binary, const ITypeDesc* typeDesc, i32 typmod) {
- Y_UNUSED(binary);
- Y_UNUSED(typeDesc);
- Y_UNUSED(typmod);
- throw yexception() << "PG types are not supported";
- }
- TConvertResult PgNativeBinaryFromNativeText(const TString& str, const ITypeDesc* typeDesc) {
- Y_UNUSED(str);
- Y_UNUSED(typeDesc);
- throw yexception() << "PG types are not supported";
- }
- TConvertResult PgNativeBinaryFromNativeText(const TString& str, ui32 pgTypeId) {
- Y_UNUSED(str);
- Y_UNUSED(pgTypeId);
- throw yexception() << "PG types are not supported";
- }
- TConvertResult PgNativeTextFromNativeBinary(const TStringBuf binary, const ITypeDesc* typeDesc) {
- Y_UNUSED(binary);
- Y_UNUSED(typeDesc);
- throw yexception() << "PG types are not supported";
- }
- TConvertResult PgNativeTextFromNativeBinary(const TStringBuf binary, ui32 pgTypeId) {
- Y_UNUSED(binary);
- Y_UNUSED(pgTypeId);
- throw yexception() << "PG types are not supported";
- }
- TString GetPostgresServerVersionNum() {
- return "-1";
- }
- TString GetPostgresServerVersionStr() {
- return "pg_sql_dummy";
- }
- } // namespace NKikimr::NPg
- namespace NYql {
- ui64 HexEncode(const char *src, size_t len, char *dst) {
- Y_UNUSED(src);
- Y_UNUSED(len);
- Y_UNUSED(dst);
- throw yexception() << "HexEncode in pg_dummy does nothing";
- }
- std::unique_ptr<IYtColumnConverter> BuildPgTopLevelColumnReader(std::unique_ptr<NKikimr::NUdf::IArrayBuilder>&& /* builder */, const NKikimr::NMiniKQL::TPgType* /* targetType */) {
- throw yexception() << "PG types are not supported";
- }
- std::unique_ptr<IYsonComplexTypeReader> BuildPgYsonColumnReader(const NUdf::TPgTypeDescription& /* desc */) {
- throw yexception() << "PG types are not supported";
- }
- } // NYql
|