@Test
  // Test basic assign to vector.
  public void testAssignBytesColumnVector()  {
      BytesColumnVector outV = new BytesColumnVector(VectorizedRowBatch.DEFAULT_SIZE);
      outV.initBuffer(35); // initialize with estimated element size 35

      int i = 0;

      int expectedResultLen;

      Assert.assertTrue(StringExpr.characterCount(blue, 0, blue.length) == 4);
      StringExpr.assign(outV, i, blue, 0, blue.length);
      expectedResultLen = blue.length;
      Assert.assertTrue(vectorEqual(outV, i, blue, 0, expectedResultLen));
      i++;
      Assert.assertTrue(StringExpr.characterCount(redgreen, 0, redgreen.length) == 8);
      StringExpr.assign(outV, i, redgreen, 0, redgreen.length);
      expectedResultLen =  redgreen.length;
      Assert.assertTrue(vectorEqual(outV, i, redgreen, 0, expectedResultLen));
      i++;
      Assert.assertTrue(StringExpr.characterCount(ascii_sentence, 0, ascii_sentence.length) == 31);
      StringExpr.assign(outV, i, ascii_sentence, 0, ascii_sentence.length);
      expectedResultLen =  ascii_sentence.length;
      Assert.assertTrue(vectorEqual(outV, i, ascii_sentence, 0, expectedResultLen));
      i++;
      Assert.assertTrue(StringExpr.characterCount(blanksLeft, 0, blanksLeft.length) == 5);
      StringExpr.assign(outV, i, blanksLeft, 0, blanksLeft.length);
      expectedResultLen =  blanksLeft.length;
      Assert.assertTrue(vectorEqual(outV, i, blanksLeft, 0, expectedResultLen));
      i++;

      // Multi-byte characters with blank ranges.
      byte[] sentenceBlankRanges = new byte[100];
      int sentenceBlankRangesLen = addMultiByteCharSentenceBlankRanges(sentenceBlankRanges, 0);

      Assert.assertTrue(StringExpr.characterCount(sentenceBlankRanges, 0, sentenceBlankRangesLen) == 17);
      StringExpr.assign(outV, i, sentenceBlankRanges, 0, sentenceBlankRangesLen);
      expectedResultLen = sentenceBlankRangesLen;
      Assert.assertTrue(vectorEqual(outV, i, sentenceBlankRanges, 0, expectedResultLen));
      i++;
      Assert.assertTrue(StringExpr.characterCount(sentenceBlankRanges, 0, sentenceBlankRangesLen - 3) == 16);
      StringExpr.assign(outV, i, sentenceBlankRanges, 0, sentenceBlankRangesLen - 3);
      expectedResultLen = sentenceBlankRangesLen - 3;
      Assert.assertTrue(vectorEqual(outV, i, sentenceBlankRanges, 0, expectedResultLen));
      i++;

      // Some non-zero offsets.
      Assert.assertTrue(StringExpr.characterCount(sentenceBlankRanges, 4, sentenceBlankRangesLen - 4) == 16);
      StringExpr.assign(outV, i, sentenceBlankRanges, 4, sentenceBlankRangesLen - 4);
      expectedResultLen = sentenceBlankRangesLen - 4;
      Assert.assertTrue(vectorEqual(outV, i, sentenceBlankRanges, 4, expectedResultLen));
      Assert.assertTrue(vectorCharacterCount(outV, i) == 16);
      i++;
      Assert.assertTrue(StringExpr.characterCount(sentenceBlankRanges, 7, 17) == 13);
      StringExpr.assign(outV, i, sentenceBlankRanges, 7, 17);
      expectedResultLen = 17;
      Assert.assertTrue(vectorEqual(outV, i, sentenceBlankRanges, 7, expectedResultLen));
      Assert.assertTrue(vectorCharacterCount(outV, i) == 13);
      i++;
  }
Test vectorized expression and filter evaluation for strings.
ql/src/test/org/apache/hadoop/hive/ql/exec/vector/expressions/TestVectorStringExpressions.java