-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move PG code out of pgduckdb_filter.cpp
- Loading branch information
Showing
8 changed files
with
125 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#pragma once | ||
|
||
#include "pgduckdb/pg/declarations.hpp" | ||
|
||
extern "C" { | ||
|
||
|
||
namespace pgduckdb::pg { | ||
int GetDetoastedDatumLen(const Datum value, bool is_bpchar); | ||
const char* GetDetoastedDatumVal(const Datum value); | ||
|
||
bool DatumGetBool(Datum datum); | ||
char DatumGetChar(Datum datum); | ||
int16_t DatumGetInt16(Datum datum); | ||
int32_t DatumGetInt32(Datum datum); | ||
int64_t DatumGetInt64(Datum datum); | ||
float DatumGetFloat4(Datum datum); | ||
double DatumGetFloat8(Datum datum); | ||
int32_t DatumGetDateADT(Datum datum); | ||
int64_t DatumGetTimestamp(Datum datum); | ||
int64_t DatumGetTimestampTz(Datum datum); | ||
|
||
} // namespace pgduckdb::pg | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,4 +66,6 @@ struct TableAmRoutine; | |
typedef uint32_t CommandId; | ||
|
||
typedef uint32_t SubTransactionId; | ||
|
||
struct varlena; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#include "pgduckdb/pg/datum.hpp" | ||
|
||
extern "C" { | ||
#include "postgres.h" | ||
#include "utils/builtins.h" | ||
#include "utils/date.h" | ||
#include "utils/timestamp.h" | ||
#if PG_VERSION_NUM >= 160000 | ||
#include "varatt.h" | ||
#endif | ||
} | ||
|
||
namespace pgduckdb::pg { | ||
int GetDetoastedDatumLen(const Datum value, bool is_bpchar) { | ||
return is_bpchar ? bpchartruelen(VARDATA_ANY(value), VARSIZE_ANY_EXHDR(value)) | ||
: VARSIZE_ANY_EXHDR(value); | ||
} | ||
const char* GetDetoastedDatumVal(const Datum value) { | ||
return static_cast<const char *>(VARDATA_ANY(value)); | ||
} | ||
|
||
bool DatumGetBool(Datum datum) { | ||
return ::DatumGetBool(datum); | ||
} | ||
|
||
char DatumGetChar(Datum datum) { | ||
return ::DatumGetChar(datum); | ||
} | ||
|
||
int16_t DatumGetInt16(Datum datum) { | ||
return ::DatumGetInt16(datum); | ||
} | ||
|
||
int32_t DatumGetInt32(Datum datum) { | ||
return ::DatumGetInt32(datum); | ||
} | ||
|
||
int64_t DatumGetInt64(Datum datum) { | ||
return ::DatumGetInt64(datum); | ||
} | ||
|
||
float DatumGetFloat4(Datum datum) { | ||
return ::DatumGetFloat4(datum); | ||
} | ||
|
||
double DatumGetFloat8(Datum datum) { | ||
return ::DatumGetFloat8(datum); | ||
} | ||
|
||
int32_t DatumGetDateADT(Datum datum) { | ||
return ::DatumGetDateADT(datum); | ||
} | ||
|
||
int64_t DatumGetTimestamp(Datum datum) { | ||
return ::DatumGetTimestamp(datum); | ||
} | ||
|
||
int64_t DatumGetTimestampTz(Datum datum) { | ||
return ::DatumGetTimestampTz(datum); | ||
} | ||
} // namespace pgduckdb::pg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters