| 494 | } |
| 495 | |
| 496 | void HS2ColumnarResultSet::InitColumns() { |
| 497 | result_set_->__isset.columns = true; |
| 498 | for (const TColumn& col_input : metadata_.columns) { |
| 499 | const vector<TTypeNode>& type_nodes = col_input.columnType.types; |
| 500 | DCHECK(type_nodes.size() > 0); |
| 501 | ThriftTColumn col_output; |
| 502 | if (type_nodes[0].type == TTypeNodeType::STRUCT |
| 503 | || type_nodes[0].type == TTypeNodeType::ARRAY |
| 504 | || type_nodes[0].type == TTypeNodeType::MAP) { |
| 505 | // Return structs, arrays and maps as string. |
| 506 | col_output.__isset.stringVal = true; |
| 507 | } else { |
| 508 | DCHECK(type_nodes.size() == 1); |
| 509 | DCHECK(type_nodes[0].__isset.scalar_type); |
| 510 | TPrimitiveType::type input_type = type_nodes[0].scalar_type.type; |
| 511 | switch (input_type) { |
| 512 | case TPrimitiveType::BOOLEAN: |
| 513 | col_output.__isset.boolVal = true; |
| 514 | break; |
| 515 | case TPrimitiveType::TINYINT: |
| 516 | col_output.__isset.byteVal = true; |
| 517 | break; |
| 518 | case TPrimitiveType::SMALLINT: |
| 519 | col_output.__isset.i16Val = true; |
| 520 | break; |
| 521 | case TPrimitiveType::INT: |
| 522 | col_output.__isset.i32Val = true; |
| 523 | break; |
| 524 | case TPrimitiveType::BIGINT: |
| 525 | col_output.__isset.i64Val = true; |
| 526 | break; |
| 527 | case TPrimitiveType::FLOAT: |
| 528 | case TPrimitiveType::DOUBLE: |
| 529 | col_output.__isset.doubleVal = true; |
| 530 | break; |
| 531 | case TPrimitiveType::NULL_TYPE: |
| 532 | case TPrimitiveType::TIMESTAMP: |
| 533 | case TPrimitiveType::DATE: |
| 534 | case TPrimitiveType::DECIMAL: |
| 535 | case TPrimitiveType::VARCHAR: |
| 536 | case TPrimitiveType::CHAR: |
| 537 | case TPrimitiveType::STRING: |
| 538 | col_output.__isset.stringVal = true; |
| 539 | break; |
| 540 | case TPrimitiveType::BINARY: |
| 541 | col_output.__isset.binaryVal = true; |
| 542 | break; |
| 543 | default: |
| 544 | DCHECK(false) << "Unhandled column type: " |
| 545 | << TypeToString(ThriftToType(input_type)); |
| 546 | } |
| 547 | } |
| 548 | result_set_->columns.push_back(col_output); |
| 549 | } |
| 550 | } |
| 551 | |
| 552 | HS2RowOrientedResultSet::HS2RowOrientedResultSet( |
| 553 | const TResultSetMetadata& metadata, TRowSet* rowset) |
nothing calls this directly
no test coverage detected