How to read whole data at a time including all spaces in text - indexing

WTX map contains one text field as series with 10 occurances and each of occurance 30 bytes. How to read whole data at a time including all spaces in text. When I am trying to read using index like [1] it reads only data but not spaces in that field. And it is not able to read the occurance only having spaces of 30 bytes.

Related

HiveQL is cutting zeros from fields

when I bring some data to the hive, it ends up cutting the 0 both at the beginning and at the end, normally this data comes from a document.
However, the CPF comes with 11 digits and the CNPJ comes with 14, and when the data is entered in the table, it ends up cutting the zeros (depending on the document, it can be at the beginning or at the end), how can I avoid this problem even though I understand that can you enter two types of documents in the column?
Measuring shell size with LEGTH doesn't work, because of these cuts in zeros.

BaseX Index or Query Optimization for Partial String Match

I am currently having an issue where my BaseX query is taking a lot longer than it should to search through my dataset. The problem is that I am searching for the substring of a fixed length text field. If I search for the exact string, for example, it returns in a matter of 6ms vs searching for the last 8 character of a 15 character string takes 5 sec. I have tried writing the search 3 different ways and every time it takes 5 sec. My concern is that it needs an index for the last characters and it only seems to allow for indexing of the full string. Anyhow, here is some sample info:
xml:
<xmlfile><sometag>FIXED39LENGTH</sometag></xmlfile>
query:
<result>{
for $c in db:open('Test')
where $c/xmlfile/sometag[text() contains text ".{6,6}9LENGTH" using wildcards]
return <result sometag="{$c/xmlfile/sometag}"/>
}</result>
As for the "full-text" index, it would just be specified as "sometag".

Shorten text codes

My question is more of cryptographic matter than programming.
I have codes of 5 chars each, that can be concatenated in pairs. The result is a code of 10 chars.
The problem is that the database field where I must store these values is only 6 chars width, and i'd prefer not to resize it.
Is there a known method or algorithm which could shorten the pairs of value, to change from 10 chars to 6 chars max ? The result can be made of any printable chars (preferably ASCII), and must avoid any duplicated values for two distinct pairs of codes.
Another solution may be shortening the 5 chars codes to 3 chars, but the remaining problem is also about no duplicates allowed when concatenated by pairs.
Thank you for any idea. I tried several solution (including Base64 encoding !) but my results are always too long, or they include duplicated values.
This question has nothing to do with cryptography. It should probably be tagged information-theory.
There are 97 printable ASCII characters, so the maximum amount of information that you can store in 6 chars is 39.6 bits (=6 × log2(97)). If you spread the same amount of information across 10 characters, then you only can only carry 3.96 bits in each character. That means you can use an alphabet of 15 characters for your codes (e.g., uppercase letters from A to O).

Most Compact File Storage of Time Stamp and String Pairs

I would like to write a time stamp and string pair to file in the most compact way possible. I started out writing the string representation of Ticks, then ASCII 31 as a seperator, then the string, then a CR.
Then I realised that as ticks is a long and can be stored as only 8 bytes I should convert ticks to bytes and write those bytes to the file. That's fine except those timestamp bytes might contain a byte whose value is 31 so my ASCII 31 delimiter is no longer unique.
What is the most compact way to store a timestamp and string pair to file?
Thanks.
Since Ticks has a fixed maximum length, you could avoid using the separator, reading the first 8 bytes of Ticks data and then reading the remaining bytes as the string.
:)

in sql,How does fixed-length data type take place in memory?

I want to know in sql,how fixed-length data type take places length in memory?I know is that for varchar,if we specify length is (20),and if user input length is 15,it takes 20 by setting space.for varchar2,if we specify length is (20),and if user input is 15,it only take 15 length in memory.So how about fixed-length data type take place?I searched in Google,but I did not find explanation with example.Please explain me with example.Thanks in advance.
A fixed length data field always consumes its full size.
In the old days (FORTRAN), it was padded at the end with space characters. Modern databases might do that too, but either implicitly trim trailing blanks off or the query might have to do it explicitly.
Variable length fields are a relative newcomer to databases, probably in the 1970s or 1980s they made widespread appearances.
It is considerably easier to manage fixed length record offsets and sizes rather than compute the offset of each data item in a record which has variable length fields. Furthermore, a fixed length data record is easily addressed in a data file by computing the byte offset of its beginning by multiplying the record size times the record number (and adding the length of whatever fixed header data is at the beginning of file).