Github user DaveBirdsall commented on a diff in the pull request:
https://github.com/apache/trafodion/pull/1746#discussion_r235210675
--- Diff: core/sql/optimizer/hiveHook.h ---
@@ -140,31 +145,42 @@ struct hive_sd_desc
char* nullFormat_;
NABoolean isCompressed_;
+ const char *partitionColValues_;
struct hive_sd_desc* next_;
- hive_sd_desc(Int32 sdID, const char* loc, Int64 creationTS, Int32
buckets,
+ hive_sd_desc(NAHeap *heap, Int32 sdID, const char* loc, Int64
creationTS, Int32 buckets,
const char* ift, const char* of,
const char* nf,
char knd,
struct hive_column_desc* column,
struct hive_skey_desc* skey,
struct hive_bkey_desc* bkey,
char fieldTerminator, char recordTerminator,
- const NABoolean isCompressed
+ const NABoolean isCompressed,
+ const char *pColVals
)
- : sdID_(sdID), buckets_(buckets), kind_(knd), column_(column),
- skey_(skey), bkey_(bkey),
- fieldTerminator_(fieldTerminator),
- recordTerminator_(recordTerminator),
- isCompressed_(isCompressed),
- next_(NULL)
- {
- location_ = strduph(loc, CmpCommon::contextHeap());
- inputFormat_ = strduph(ift, CmpCommon::contextHeap());
- outputFormat_= strduph(of, CmpCommon::contextHeap());
- nullFormat_ = (nf ? strduph(nf, CmpCommon::contextHeap()) : NULL);
- }
+
+ : heap_(heap), sdID_(sdID), creationTS_(creationTS),
+ buckets_(buckets), kind_(knd), column_(column),
+ skey_(skey), bkey_(bkey),
+ fieldTerminator_(fieldTerminator),
+ recordTerminator_(recordTerminator),
+ isCompressed_(isCompressed),
+ next_(NULL)
+ {
+ if (loc != NULL)
+ location_ = strduph(loc, heap_);
+ else
+ location_ = NULL;
+ inputFormat_ = strduph(ift, heap_);
+ outputFormat_= strduph(of, heap_);
+ nullFormat_ = (nf ? strduph(nf, heap_) : NULL);
+ if (pColVals)
+ partitionColValues_ = strduph(pColVals, heap_);
+ else
+ partitionColValues_ = NULL;
--- End diff --
The code is correct. It's interesting that the styles are mixed though: For
nf, we use a ternary operator and for loc and pColVals we use if/then/else.
---