@@ -1002,12 +1002,12 @@ calculate_num_hidden(const ErasedView& view, const t_view_config& config) {
10021002template <typename A>
10031003static t_tscalar
10041004coerce_to (const t_dtype dtype, const A& val) {
1005- if constexpr (std::is_same_v<A, std::string >) {
1005+ if constexpr (std::is_same_v<A, const char * >) {
10061006 t_tscalar scalar;
10071007 scalar.clear ();
10081008 switch (dtype) {
10091009 case DTYPE_STR:
1010- scalar.set (val. c_str () );
1010+ scalar.set (val);
10111011 return scalar;
10121012 case DTYPE_BOOL:
10131013 scalar.set (val == " true" );
@@ -1585,6 +1585,8 @@ ProtoServer::_handle_request(std::uint32_t client_id, const Request& req) {
15851585 ));
15861586 }
15871587
1588+ t_vocab vocab;
1589+ vocab.init (false );
15881590 std::vector<
15891591 std::tuple<std::string, std::string, std::vector<t_tscalar>>>
15901592 filter;
@@ -1617,9 +1619,24 @@ ProtoServer::_handle_request(std::uint32_t client_id, const Request& req) {
16171619 " Filter column not in schema: " + f.column ()
16181620 );
16191621 }
1620- a = coerce_to (
1621- schema->get_dtype (f.column ()), arg.string ()
1622- );
1622+
1623+ if (!t_tscalar::can_store_inplace (
1624+ arg.string ().c_str ()
1625+ )) {
1626+
1627+ a = coerce_to (
1628+ schema->get_dtype (f.column ()),
1629+ vocab.unintern_c (
1630+ vocab.get_interned (arg.string ())
1631+ )
1632+ );
1633+ } else {
1634+
1635+ a = coerce_to (
1636+ schema->get_dtype (f.column ()),
1637+ arg.string ().c_str ()
1638+ );
1639+ }
16231640 args.push_back (a);
16241641 break ;
16251642 }
@@ -1715,6 +1732,7 @@ ProtoServer::_handle_request(std::uint32_t client_id, const Request& req) {
17151732 LOG_DEBUG (" FILTER_OP: " << filter_op);
17161733
17171734 auto config = std::make_shared<t_view_config>(
1735+ vocab,
17181736 row_pivots,
17191737 column_pivots,
17201738 aggregates,
@@ -1906,7 +1924,7 @@ ProtoServer::_handle_request(std::uint32_t client_id, const Request& req) {
19061924 auto * f = proto_filter->Add ();
19071925 f->set_column (filter.m_colname );
19081926 f->set_op (filter_op_to_str (filter.m_op ));
1909- auto vals = std::vector<t_tscalar>(filter.m_bag .size () + 1 );
1927+ auto vals = std::vector<t_tscalar>(filter.m_bag .size ());
19101928 if (filter.m_op != FILTER_OP_NOT_IN
19111929 && filter.m_op != FILTER_OP_IN) {
19121930 vals.push_back (filter.m_threshold );
@@ -1915,6 +1933,7 @@ ProtoServer::_handle_request(std::uint32_t client_id, const Request& req) {
19151933 vals.push_back (scalar);
19161934 }
19171935 }
1936+
19181937 for (const auto & scalar : vals) {
19191938 auto * s = f->mutable_value ()->Add ();
19201939 switch (scalar.get_dtype ()) {
0 commit comments